From: Andre Noll Date: Sat, 9 Oct 2021 15:20:06 +0000 (+0200) Subject: audiod: Use para_malloc(). X-Git-Tag: v0.6.4~7 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=fed61968a113bd37b196bb86d9f2591d53b15162;p=paraslash.git audiod: Use para_malloc(). 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. --- diff --git a/audiod.c b/audiod.c index a5a77437..88599c3f 100644 --- 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);