diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-30 19:19:38 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-30 19:19:38 +0200 |
commit | e18c67950ddd57b65933cb46cbd7d77e74f00faa (patch) | |
tree | 14cb0be6d6bc34d7248825d3871e3d90a56986ff /src | |
parent | I'm retarded (diff) | |
download | 42-minishell-e18c67950ddd57b65933cb46cbd7d77e74f00faa.tar.gz 42-minishell-e18c67950ddd57b65933cb46cbd7d77e74f00faa.tar.bz2 42-minishell-e18c67950ddd57b65933cb46cbd7d77e74f00faa.tar.xz 42-minishell-e18c67950ddd57b65933cb46cbd7d77e74f00faa.tar.zst 42-minishell-e18c67950ddd57b65933cb46cbd7d77e74f00faa.zip |
Secured strdup
Diffstat (limited to 'src')
-rw-r--r-- | src/u_vars.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/u_vars.c b/src/u_vars.c index 9978df5..377da77 100644 --- a/src/u_vars.c +++ b/src/u_vars.c @@ -127,7 +127,12 @@ static char } if (ptr != NULL) { - varval = ft_strdup(ptr->val); + if (!(varval = ft_strdup(ptr->val))) + { + lcom_clear(&msh->curr); + s_destroy(msh); + fail_alloc(msh); + } return (varval); } else |