mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
core-util: Handle zero-length volume string
Without checking for zero we end up accessing memory outside the str buffer: str[len - 1]. Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/768
This commit is contained in:
parent
cd4a69374c
commit
4dba56c1af
1 changed files with 1 additions and 1 deletions
|
|
@ -879,7 +879,7 @@ int pa_parse_volume(const char *v, pa_volume_t *volume) {
|
||||||
|
|
||||||
len = strlen(v);
|
len = strlen(v);
|
||||||
|
|
||||||
if (len >= 64)
|
if (len <= 0 || len >= 64)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memcpy(str, v, len + 1);
|
memcpy(str, v, len + 1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue