diff options
author | Kamil Rytarowski <n54@gmx.com> | 2015-11-20 04:20:36 +0100 |
---|---|---|
committer | Arun Raghavan <git@arunraghavan.net> | 2015-12-08 08:56:07 +0530 |
commit | 93cccdee8d80905f3df79822c1682baf5d3c4c95 (patch) | |
tree | f164ffb383d403c95cf464f4a2c1794e53ae2e32 /src/pulsecore/core-util.c | |
parent | 9dd77827ad55bf2c6e58f3ce24537afb42616e8e (diff) | |
download | pulseaudio-93cccdee8d80905f3df79822c1682baf5d3c4c95.tar.gz |
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)
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r-- | src/pulsecore/core-util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 1eb534ab4..19c89a9d0 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -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; } |