|
Anton Arapov |
c2a608 |
From 5a83719602d847290f80e79c898f0a7543ce8778 Mon Sep 17 00:00:00 2001
|
|
Anton Arapov |
c2a608 |
From: Jerry Hoemann <jerry.hoemann@hpe.com>
|
|
Anton Arapov |
c2a608 |
Date: Tue, 3 Jul 2018 09:56:27 +0200
|
|
Anton Arapov |
c2a608 |
Subject: [PATCH 18/21] dmidecode: Argument processing
|
|
Anton Arapov |
c2a608 |
|
|
Anton Arapov |
c2a608 |
Tighten up the numeric argument processing for parse_opt_type and
|
|
Anton Arapov |
c2a608 |
parse_opt_oem_string to catch more typos.
|
|
Anton Arapov |
c2a608 |
|
|
Anton Arapov |
c2a608 |
Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
|
|
Anton Arapov |
c2a608 |
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
|
Anton Arapov |
c2a608 |
---
|
|
Anton Arapov |
c2a608 |
dmiopt.c | 4 ++--
|
|
Anton Arapov |
c2a608 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
Anton Arapov |
c2a608 |
|
|
Anton Arapov |
c2a608 |
diff --git a/dmiopt.c b/dmiopt.c
|
|
Anton Arapov |
c2a608 |
index 1531ddf..2f285f3 100644
|
|
Anton Arapov |
c2a608 |
--- a/dmiopt.c
|
|
Anton Arapov |
c2a608 |
+++ b/dmiopt.c
|
|
Anton Arapov |
c2a608 |
@@ -113,7 +113,7 @@ static u8 *parse_opt_type(u8 *p, const char *arg)
|
|
Anton Arapov |
c2a608 |
char *next;
|
|
Anton Arapov |
c2a608 |
|
|
Anton Arapov |
c2a608 |
val = strtoul(arg, &next, 0);
|
|
Anton Arapov |
c2a608 |
- if (next == arg)
|
|
Anton Arapov |
c2a608 |
+ if (next == arg || (*next != '\0' && *next != ',' && *next != ' '))
|
|
Anton Arapov |
c2a608 |
{
|
|
Anton Arapov |
c2a608 |
fprintf(stderr, "Invalid type keyword: %s\n", arg);
|
|
Anton Arapov |
c2a608 |
print_opt_type_list();
|
|
Anton Arapov |
c2a608 |
@@ -228,7 +228,7 @@ static int parse_opt_oem_string(const char *arg)
|
|
Anton Arapov |
c2a608 |
goto done;
|
|
Anton Arapov |
c2a608 |
|
|
Anton Arapov |
c2a608 |
val = strtoul(arg, &next, 10);
|
|
Anton Arapov |
c2a608 |
- if (next == arg || val == 0x00 || val > 0xff)
|
|
Anton Arapov |
c2a608 |
+ if (next == arg || *next != '\0' || val == 0x00 || val > 0xff)
|
|
Anton Arapov |
c2a608 |
{
|
|
Anton Arapov |
c2a608 |
fprintf(stderr, "Invalid OEM string number: %s\n", arg);
|
|
Anton Arapov |
c2a608 |
return -1;
|
|
Anton Arapov |
c2a608 |
--
|
|
Anton Arapov |
c2a608 |
2.17.1
|
|
Anton Arapov |
c2a608 |
|