summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2018-12-18 19:12:59 -0800
committerBen Pfaff <blp@ovn.org>2018-12-19 09:18:52 -0800
commit46d3a76a10f0108b0ed31030041efa7fd4b4cc0d (patch)
tree21542cacd0defd5524f56c162bc674416484ba30 /lib
parent0f6379e7fa4dfba56d6825c55bff97f9cd340519 (diff)
downloadopenvswitch-46d3a76a10f0108b0ed31030041efa7fd4b4cc0d.tar.gz
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 <i.maximets@samsung.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2018-December/354622.html Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/util.c b/lib/util.c
index 66544bff3..5679232ff 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -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--) {