mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
json: empty string should not give a valid number
This commit is contained in:
parent
b868ec36c5
commit
947d15a60a
2 changed files with 18 additions and 2 deletions
|
|
@ -238,7 +238,7 @@ static inline int spa_json_parse_float(const char *val, int len, float *result)
|
|||
{
|
||||
char *end;
|
||||
*result = strtof(val, &end);
|
||||
return end == val + len;
|
||||
return len > 0 && end == val + len;
|
||||
}
|
||||
static inline bool spa_json_is_float(const char *val, int len)
|
||||
{
|
||||
|
|
@ -259,7 +259,7 @@ static inline int spa_json_parse_int(const char *val, int len, int *result)
|
|||
{
|
||||
char *end;
|
||||
*result = strtol(val, &end, 0);
|
||||
return end == val + len;
|
||||
return len > 0 && end == val + len;
|
||||
}
|
||||
static inline bool spa_json_is_int(const char *val, int len)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue