diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-16 21:27:23 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-16 21:27:23 +0200 |
commit | ca1713c01ba190e8b56b0e8e5e56e9d5640be4be (patch) | |
tree | 545997b85d13948b33ecdb95057cd8a1b4d19073 /src/m_argv.c | |
parent | h builtin in progress (diff) | |
download | 42-minishell-ca1713c01ba190e8b56b0e8e5e56e9d5640be4be.tar.gz 42-minishell-ca1713c01ba190e8b56b0e8e5e56e9d5640be4be.tar.bz2 42-minishell-ca1713c01ba190e8b56b0e8e5e56e9d5640be4be.tar.xz 42-minishell-ca1713c01ba190e8b56b0e8e5e56e9d5640be4be.tar.zst 42-minishell-ca1713c01ba190e8b56b0e8e5e56e9d5640be4be.zip |
h still in progress
Diffstat (limited to '')
-rw-r--r-- | src/m_argv.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/m_argv.c b/src/m_argv.c index bdebd23..7661ef7 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -41,10 +41,11 @@ static char *m_get_prev_hist(t_msh *msh) return (NULL); if (stat(histfile, &sb) == -1) return (NULL); - if ((hist = (char*)malloc(sb.st_size * sizeof(char))) == NULL) + if ((hist = (char*)malloc((sb.st_size + 1) * sizeof(char))) == NULL) return (NULL); if (read(fd, hist, sb.st_size) == -1) return (NULL); + hist[sb.st_size] = C_NUL; return (hist); } |