mirror of
https://github.com/flatpak/flatpak.git
synced 2026-02-02 20:11:27 -05:00
common/utils: Fix is_number("") to return FALSE
Previously, it was possible to enter ‘ ’ (a space) at a number prompt, and it would be stripped, passed to is_number() (which would erroneously return TRUE), then passed to strtol() and the return value used unconditionally. Fix that by fixing is_number() to return FALSE for the empty string. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
committed by
Alexander Larsson
parent
2d0ceef446
commit
2faffecc42
@@ -5320,6 +5320,9 @@ flatpak_yes_no_prompt (const char *prompt, ...)
|
||||
static gboolean
|
||||
is_number (const char *s)
|
||||
{
|
||||
if (*s == '\0')
|
||||
return FALSE;
|
||||
|
||||
while (*s != 0)
|
||||
{
|
||||
if (!g_ascii_isdigit (*s))
|
||||
|
||||
Reference in New Issue
Block a user