mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 13:28:05 +01:00
util: fix possible buffer overrun in the function that create L2 menus (Coverity #50219)
As pointed by Coverity, the buffer used to store the command for the menu has a fixed size, so a check is welcome to avoid buffer overflow. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
7c142f54d0
commit
36ac3b3344
@@ -419,7 +419,9 @@ static void find_and_write(const char *group, char *list[][2], int this_is_termi
|
||||
} else {
|
||||
char comm[PATH_MAX], *ptr;
|
||||
|
||||
strcpy(comm, list[i][1]);
|
||||
strncpy(comm, list[i][1], sizeof(comm) - 1);
|
||||
comm[sizeof(comm) - 1] = '\0';
|
||||
|
||||
/* delete character " !" from the command */
|
||||
ptr = strchr(comm, '!');
|
||||
while (ptr >= comm && (*ptr == '!' || isspace(*ptr)))
|
||||
|
||||
Reference in New Issue
Block a user