acl-plugin: take 2 at VPP-991 fix, this time with a test case which verifies it.
[vpp.git] / src / vppinfra / unformat.c
index 7c636cc..5b17562 100644 (file)
@@ -306,6 +306,11 @@ unformat_hex_string (unformat_input_t * input, va_list * va)
       vec_free (s);
       return 0;
     }
+  /* Make sure something was processed. */
+  else if (s == 0)
+    {
+      return 0;
+    }
 
   *hexstring_return = s;
   return 1;
@@ -396,7 +401,7 @@ unformat_line (unformat_input_t * i, va_list * va)
     }
 
   *result = line;
-  return 1;
+  return vec_len (line);
 }
 
 /* Parse a line ending with \n and return it as an unformat_input_t. */
@@ -405,7 +410,8 @@ unformat_line_input (unformat_input_t * i, va_list * va)
 {
   unformat_input_t *result = va_arg (*va, unformat_input_t *);
   u8 *line;
-  unformat_user (i, unformat_line, &line);
+  if (!unformat_user (i, unformat_line, &line))
+    return 0;
   unformat_init_vector (result, line);
   return 1;
 }