aplay: fix possible string overflow (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-06-09 10:27:40 +02:00
parent 3d35bce271
commit 651ca88a99

View file

@ -3037,6 +3037,7 @@ static int new_capture_file(char *name, char *namebuf, size_t namelen,
/* get a copy of the original filename */ /* get a copy of the original filename */
strncpy(buf, name, sizeof(buf)); strncpy(buf, name, sizeof(buf));
buf[sizeof(buf)-1] = '\0';
/* separate extension from filename */ /* separate extension from filename */
s = buf + strlen(buf); s = buf + strlen(buf);