mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
core-util: Don't accept random words in pa_parse_boolean()
The old code accepted any word that started with "y", "Y", "n", "N", "t", "T", "f" or "F". Fix this by having a whitelist of full strings instead of checking just the first letter.
This commit is contained in:
parent
0af05213be
commit
1fd79c4439
1 changed files with 4 additions and 2 deletions
|
|
@ -937,9 +937,11 @@ int pa_parse_boolean(const char *v) {
|
|||
pa_assert(v);
|
||||
|
||||
/* First we check language independent */
|
||||
if (pa_streq(v, "1") || v[0] == 'y' || v[0] == 'Y' || v[0] == 't' || v[0] == 'T' || !strcasecmp(v, "on"))
|
||||
if (pa_streq(v, "1") || !strcasecmp(v, "y") || !strcasecmp(v, "t")
|
||||
|| !strcasecmp(v, "yes") || !strcasecmp(v, "true") || !strcasecmp(v, "on"))
|
||||
return 1;
|
||||
else if (pa_streq(v, "0") || v[0] == 'n' || v[0] == 'N' || v[0] == 'f' || v[0] == 'F' || !strcasecmp(v, "off"))
|
||||
else if (pa_streq(v, "0") || !strcasecmp(v, "n") || !strcasecmp(v, "f")
|
||||
|| !strcasecmp(v, "no") || !strcasecmp(v, "false") || !strcasecmp(v, "off"))
|
||||
return 0;
|
||||
|
||||
#ifdef HAVE_LANGINFO_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue