mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -05:00
fix parsing of non-decimal integers in configuration files
safe_strtoll() now accepts numbers in any base. It formerly assumed that its input was a decimal number, which had the consequence that hexadecimal or octal numbers would be parsed as strings when occurring outside of parameter lists. This obsoletes some workarounds in the file permission parsing code that relied on this bug.
This commit is contained in:
parent
a7bc1dd80c
commit
0211bc3b68
3 changed files with 10 additions and 18 deletions
|
|
@ -470,7 +470,7 @@ static int safe_strtoll(const char *str, long long *val)
|
|||
if (!*str)
|
||||
return -EINVAL;
|
||||
errno = 0;
|
||||
if (sscanf(str, "%Ld%n", &v, &endidx) < 1)
|
||||
if (sscanf(str, "%Li%n", &v, &endidx) < 1)
|
||||
return -EINVAL;
|
||||
if (str[endidx])
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue