mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -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
|
|
@ -2332,7 +2332,7 @@ int pa_atou(const char *s, uint32_t *ret_u) {
|
|||
pa_assert(ret_u);
|
||||
|
||||
/* strtoul() ignores leading spaces. We don't. */
|
||||
if (isspace(*s)) {
|
||||
if (isspace((unsigned char)*s)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -2376,7 +2376,7 @@ int pa_atol(const char *s, long *ret_l) {
|
|||
pa_assert(ret_l);
|
||||
|
||||
/* strtol() ignores leading spaces. We don't. */
|
||||
if (isspace(*s)) {
|
||||
if (isspace((unsigned char)*s)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -2421,7 +2421,7 @@ int pa_atod(const char *s, double *ret_d) {
|
|||
pa_assert(ret_d);
|
||||
|
||||
/* strtod() ignores leading spaces. We don't. */
|
||||
if (isspace(*s)) {
|
||||
if (isspace((unsigned char)*s)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue