mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
core, pulse, modules: Fix undefined behavior with array subscript of invalid type
From the NetBSD manual:
The first argument of these functions is of type int, but only a very
restricted subset of values are actually valid. The argument must either
be the value of the macro EOF (which has a negative value), or must be a
non-negative value within the range representable as unsigned char.
Passing invalid values leads to undefined behavior.
-- ctype(3)
This commit is contained in:
parent
9dd77827ad
commit
93cccdee8d
5 changed files with 15 additions and 15 deletions
|
|
@ -480,7 +480,7 @@ pa_proplist *pa_proplist_from_string(const char *s) {
|
|||
goto success;
|
||||
else if (*p == '=')
|
||||
goto fail;
|
||||
else if (!isspace(*p)) {
|
||||
else if (!isspace((unsigned char)*p)) {
|
||||
key = p;
|
||||
state = KEY;
|
||||
key_len = 1;
|
||||
|
|
@ -492,7 +492,7 @@ pa_proplist *pa_proplist_from_string(const char *s) {
|
|||
goto fail;
|
||||
else if (*p == '=')
|
||||
state = VALUE_START;
|
||||
else if (isspace(*p))
|
||||
else if (isspace((unsigned char)*p))
|
||||
state = AFTER_KEY;
|
||||
else
|
||||
key_len++;
|
||||
|
|
@ -503,7 +503,7 @@ pa_proplist *pa_proplist_from_string(const char *s) {
|
|||
goto fail;
|
||||
else if (*p == '=')
|
||||
state = VALUE_START;
|
||||
else if (!isspace(*p))
|
||||
else if (!isspace((unsigned char)*p))
|
||||
goto fail;
|
||||
break;
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ pa_proplist *pa_proplist_from_string(const char *s) {
|
|||
state = VALUE_DOUBLE_QUOTES;
|
||||
value = p+1;
|
||||
value_len = 0;
|
||||
} else if (!isspace(*p)) {
|
||||
} else if (!isspace((unsigned char)*p)) {
|
||||
state = VALUE_SIMPLE;
|
||||
value = p;
|
||||
value_len = 1;
|
||||
|
|
@ -531,7 +531,7 @@ pa_proplist *pa_proplist_from_string(const char *s) {
|
|||
break;
|
||||
|
||||
case VALUE_SIMPLE:
|
||||
if (*p == 0 || isspace(*p)) {
|
||||
if (*p == 0 || isspace((unsigned char)*p)) {
|
||||
if (proplist_setn(pl, key, key_len, value, value_len) < 0)
|
||||
goto fail;
|
||||
|
||||
|
|
@ -610,7 +610,7 @@ pa_proplist *pa_proplist_from_string(const char *s) {
|
|||
(*p >= 'A' && *p <= 'F') ||
|
||||
(*p >= 'a' && *p <= 'f')) {
|
||||
value_len++;
|
||||
} else if (*p == 0 || isspace(*p)) {
|
||||
} else if (*p == 0 || isspace((unsigned char)*p)) {
|
||||
|
||||
if (proplist_sethex(pl, key, key_len, value, value_len) < 0)
|
||||
goto fail;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue