Missing null termination fix in the shell detection #463 from ihsinme/patch-1

This commit is contained in:
Martin Dvorak 2022-12-10 20:53:11 +01:00 committed by GitHub
commit f945c7f209
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -217,7 +217,7 @@ char *get_shell_name_by_ppid(const int pid)
shell=strrchr(shell,'/');
if(shell != NULL) {
shell++;
unsigned len=strlen(shell)*sizeof(char);
unsigned len=(strlen(shell)+1)*sizeof(char);
name = realloc(name, len);
strncpy(name, shell, len);
}