diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2026-01-09 14:18:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-09 14:18:31 +0100 |
| commit | f694f4cd4dfead0da6feab04d92335d9bbe185b6 (patch) | |
| tree | cd48ccd1fdac7a2b08eb0351fd95d2f6770a2277 /lib | |
| parent | d13413916e72a6d564c796692e1233b92962d58c (diff) | |
| parent | 7484fcc2606fe1e49dff1ab5f24a69290786b78d (diff) | |
| download | monitoring-plugins-f694f4cd4dfead0da6feab04d92335d9bbe185b6.tar.gz | |
Merge pull request #2218 from RincewindsHat/fix/compiler_warnings
Fix some minor compiler warnings
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/parse_ini.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/parse_ini.c b/lib/parse_ini.c index db337622..196cac79 100644 --- a/lib/parse_ini.c +++ b/lib/parse_ini.c | |||
| @@ -352,15 +352,17 @@ static int add_option(FILE *filePointer, np_arg_list **optlst) { | |||
| 352 | optnew->next = NULL; | 352 | optnew->next = NULL; |
| 353 | 353 | ||
| 354 | read_pos = 0; | 354 | read_pos = 0; |
| 355 | optnew->arg = malloc(cfg_len + 1); | 355 | size_t arg_length = cfg_len + 1; |
| 356 | optnew->arg = malloc(arg_length); | ||
| 356 | /* 1-character params needs only one dash */ | 357 | /* 1-character params needs only one dash */ |
| 357 | if (opt_len == 1) { | 358 | if (opt_len == 1) { |
| 358 | strncpy(&optnew->arg[read_pos], "-", 1); | 359 | strncpy(&optnew->arg[read_pos], "-", arg_length); |
| 359 | read_pos += 1; | 360 | read_pos += 1; |
| 360 | } else { | 361 | } else { |
| 361 | strncpy(&optnew->arg[read_pos], "--", 2); | 362 | strncpy(&optnew->arg[read_pos], "--", arg_length); |
| 362 | read_pos += 2; | 363 | read_pos += 2; |
| 363 | } | 364 | } |
| 365 | |||
| 364 | strncpy(&optnew->arg[read_pos], optptr, opt_len); | 366 | strncpy(&optnew->arg[read_pos], optptr, opt_len); |
| 365 | read_pos += opt_len; | 367 | read_pos += opt_len; |
| 366 | if (value) { | 368 | if (value) { |
