Skip to content

Commit

Permalink
lib/getrange.c: getrange(): Report an error when min>max
Browse files Browse the repository at this point in the history
Cc: Serge Hallyn <[email protected]>
Cc: Iker Pedrosa <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar committed May 9, 2024
1 parent 655d06b commit 23aef62
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/getrange.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ getrange(const char *range,
if (NULL == range)
return -1;

*min = 0;
*has_min = false;
*has_max = false;

Expand All @@ -58,7 +59,7 @@ getrange(const char *range,
if (!isdigit((unsigned char) *end))
return -1;

if (a2ul(max, end, NULL, 10, 0, ULONG_MAX) == -1)
if (a2ul(max, end, NULL, 10, *min, ULONG_MAX) == -1)
return -1;
*has_max = true;

Expand Down

0 comments on commit 23aef62

Please sign in to comment.