lib/getrange.c: getrange(): Report an error when min>max

Cc: Serge Hallyn <serge@hallyn.com>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar 2024-01-07 01:17:33 +01:00 committed by Iker Pedrosa
parent 29f135777e
commit 0066743c49

View File

@ -33,6 +33,7 @@ getrange(const char *range,
if (NULL == range)
return -1;
*min = 0;
*has_min = false;
*has_max = false;
@ -58,7 +59,7 @@ parse_max:
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;