From: Jaroslav Kysela Date: Sun, 26 Jan 2025 12:19:59 +0000 (+0100) Subject: pcxhrloader: fix gcc warnings (string truncation) X-Git-Tag: v1.2.14~17 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=48128777e0f528d3aaf3eca65f9d16a393901c63;p=alsa-tools.git pcxhrloader: fix gcc warnings (string truncation) Signed-off-by: Jaroslav Kysela --- diff --git a/pcxhrloader/pcxhrloader.c b/pcxhrloader/pcxhrloader.c index de9420e..5cd1845 100644 --- a/pcxhrloader/pcxhrloader.c +++ b/pcxhrloader/pcxhrloader.c @@ -89,7 +89,8 @@ static int get_file_name(const char *key, unsigned int idx, char *fname) for (p = buf + len; *p && isspace(*p); p++) ; if (*p == '/') { - strncpy(fname, p, MAX_PATH); + strncpy(fname, p, MAX_PATH - 1); + fname[MAX_PATH - 1] = '\0'; } else { snprintf(fname, MAX_PATH, "%s/%s", DATAPATH, p); }