diff options
| author | Jerry Hoemann <jerry.hoemann@hpe.com> | 2018-07-03 09:56:27 +0200 |
|---|---|---|
| committer | Jean Delvare <jdelvare@suse.de> | 2018-07-03 09:56:27 +0200 |
| commit | 5a83719602d847290f80e79c898f0a7543ce8778 (patch) | |
| tree | 858d30f8460c85bbb63d71ec6f13055226cb95dd /dmiopt.c | |
| parent | a40f10bcae68caf6fd00379c06f92f34ba5c8d07 (diff) | |
| download | dmidecode-git-5a83719602d847290f80e79c898f0a7543ce8778.tar.gz | |
dmidecode: Argument processing
Tighten up the numeric argument processing for parse_opt_type and
parse_opt_oem_string to catch more typos.
Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'dmiopt.c')
| -rw-r--r-- | dmiopt.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -113,7 +113,7 @@ static u8 *parse_opt_type(u8 *p, const char *arg) char *next; val = strtoul(arg, &next, 0); - if (next == arg) + if (next == arg || (*next != '\0' && *next != ',' && *next != ' ')) { fprintf(stderr, "Invalid type keyword: %s\n", arg); print_opt_type_list(); @@ -228,7 +228,7 @@ static int parse_opt_oem_string(const char *arg) goto done; val = strtoul(arg, &next, 10); - if (next == arg || val == 0x00 || val > 0xff) + if (next == arg || *next != '\0' || val == 0x00 || val > 0xff) { fprintf(stderr, "Invalid OEM string number: %s\n", arg); return -1; |
