]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
audiod: Use para_malloc().
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 9 Oct 2021 15:20:06 +0000 (17:20 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 9 Oct 2021 15:49:12 +0000 (17:49 +0200)
If the allocation fails we feed NULL to strncpy(3) which should
result in a segfault. With para_malloc() a clear error message will
be shown instead.

Found by gcc's -fanalyzer option.

audiod.c

index a5a774376b37c50eba92a76a02b1389bd6df67f4..88599c3fa297337b6a3f598b31f92d6e6b4b0993 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -801,7 +801,7 @@ static int parse_stream_command(const char *txt, const char **cmd)
                return -E_MISSING_COLON;
        *cmd = p + 1;
        len = p - txt;
-       re = malloc(len + 1);
+       re = para_malloc(len + 1);
        strncpy(re, txt, len);
        re[len] = '\0';
        ret = get_matching_audio_format_nums(re);