util: Make parse_int_string() only succeed if it parses a non-empty string.
strtoull() doesn't necessarily set errno if it finds nothing to parse, but
this code didn't check for that case.
Reported-by: Ilya Maximets
Reported-at:
@@ -968,8 +968,8 @@ free:
errno = 0;
integer = strtoull(s, tail, 0);
- if (errno) {
- return errno;
+ if (errno || s == *tail) {
+ return errno ? errno : EINVAL;
}
for (i = field_width - 1; i >= 0; i--) {
