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 <[email protected]>
Reported-at: 
https://mail.openvswitch.org/pipermail/ovs-dev/2018-December/354622.html
Signed-off-by: Ben Pfaff <[email protected]>
---
 lib/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/util.c b/lib/util.c
index 66544bff38ea..fcd4e753613e 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -968,7 +968,7 @@ free:
 
     errno = 0;
     integer = strtoull(s, tail, 0);
-    if (errno) {
+    if (errno || s == *tail) {
         return errno;
     }
 
-- 
2.16.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to