From 4dba56c1af96b4b93574a18e878d054e70bcaa62 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Fri, 27 Dec 2019 07:33:52 +0200 Subject: [PATCH] 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 --- src/pulsecore/core-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 174987e4a..d75f1d215 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -879,7 +879,7 @@ int pa_parse_volume(const char *v, pa_volume_t *volume) { len = strlen(v); - if (len >= 64) + if (len <= 0 || len >= 64) return -1; memcpy(str, v, len + 1); -- 2.34.1