mirror of
https://github.com/dvorka/hstr.git
synced 2024-11-10 09:03:06 +08:00
there is no place for null termination.
you will always return a string truncated by one character. add one more byte
This commit is contained in:
parent
be59f8cf5a
commit
eb7637beaa
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue