diff options
Diffstat (limited to 'lib/parse_ini.c')
| -rw-r--r-- | lib/parse_ini.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/parse_ini.c b/lib/parse_ini.c index db337622..8a54af58 100644 --- a/lib/parse_ini.c +++ b/lib/parse_ini.c | |||
| @@ -173,7 +173,7 @@ static bool read_defaults(FILE *defaults_file, const char *stanza, np_arg_list * | |||
| 173 | continue; | 173 | continue; |
| 174 | } | 174 | } |
| 175 | switch (current_char) { | 175 | switch (current_char) { |
| 176 | /* globble up comment lines */ | 176 | /* gobble up comment lines */ |
| 177 | case ';': | 177 | case ';': |
| 178 | case '#': | 178 | case '#': |
| 179 | GOBBLE_TO(defaults_file, current_char, '\n'); | 179 | GOBBLE_TO(defaults_file, current_char, '\n'); |
| @@ -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) { |
