util: Fix bad constant in ovs_scan() implementation on 64-bit.
authorBen Pfaff <blp@nicira.com>
Fri, 15 Nov 2013 18:34:34 +0000 (10:34 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 15 Nov 2013 18:34:34 +0000 (10:34 -0800)
scan_chars() compares an "unsigned int" against SIZE_MAX, which will
always be false on 64-bit architectures.  The correct constant is
UINT_MAX.

Reported-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/util.c

index b633166..c252886 100644 (file)
@@ -1497,7 +1497,7 @@ scan_set(const char *s, const struct scan_spec *spec, const char **pp,
 static const char *
 scan_chars(const char *s, const struct scan_spec *spec, va_list *args)
 {
-    unsigned int n = spec->width == SIZE_MAX ? 1 : spec->width;
+    unsigned int n = spec->width == UINT_MAX ? 1 : spec->width;
 
     if (strlen(s) < n) {
         return NULL;