Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Oct 15, 2019

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 9663e751c25d3bf52e959d8c9025460d2f645b1e:

Merge branch 'fix-corrupt-hist-log' of https://github.com/sitsofe/fio (2019-10-13 11:02:00 -0600)

are available in the Git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 5cd4efe903798f2185a347911a9440324558c89f:

parse: improve detection of bad input string (2019-10-14 08:03:53 -0600)

----------------------------------------------------------------
Jens Axboe (1):
parse: improve detection of bad input string

 parse.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

---

Diff of recent changes:

parse.c +5 -1
index c4fd4626..483a62f6 100644
@@ -373,12 +373,16 @@ int str_to_decimal(const char *str, long long *val, int kilo, void *data,
 #endif
 
 	if (rc == 1) {
+		char *endptr;
+
 		if (strstr(str, "0x") || strstr(str, "0X"))
 			base = 16;
 		else
 			base = 10;
 
-		*val = strtoll(str, NULL, base);
+		*val = strtoll(str, &endptr, base);
+		if (*val == 0 && endptr == str)
+			return 1;
 		if (*val == LONG_MAX && errno == ERANGE)
 			return 1;
 	}