mirror of
https://github.com/dvorka/hstr.git
synced 2024-11-10 09:03:06 +08:00
Fix a potential buffer overflow in 'get_shell_name_by_ppid' (#411)
This commit is contained in:
parent
33f7f5b593
commit
cba16a2d71
1 changed files with 3 additions and 1 deletions
|
@ -217,7 +217,9 @@ char *get_shell_name_by_ppid(const int pid)
|
|||
shell=strrchr(shell,'/');
|
||||
if(shell != NULL) {
|
||||
shell++;
|
||||
strncpy(name,shell,sizeof(char)*strlen(shell));
|
||||
unsigned len=strlen(shell)*sizeof(char);
|
||||
name = realloc(name, len);
|
||||
strncpy(name, shell, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue