fix: invalid write fix
This commit is contained in:
parent
8a6a0012dc
commit
9787d71b85
7
env/env_fill.c
vendored
7
env/env_fill.c
vendored
@ -6,12 +6,11 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/16 16:29:08 by cchauvet #+# #+# */
|
/* Created: 2023/02/16 16:29:08 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/02/20 15:39:28 by starnakin ### ########.fr */
|
/* Updated: 2023/03/27 16:42:27 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "./env_private.h"
|
#include "./env_private.h"
|
||||||
#include "env.h"
|
|
||||||
|
|
||||||
static char *ft_getkey(const char *str)
|
static char *ft_getkey(const char *str)
|
||||||
{
|
{
|
||||||
@ -97,12 +96,12 @@ char *ft_env_filler(t_data *data, const char *str)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
temp = ft_strreplace(out, value, i, key_len + i);
|
temp = ft_strreplace(out, value, i, key_len + i);
|
||||||
i = i + ft_strlen(value);
|
i = i + ft_strlen(value);
|
||||||
free(out);
|
ft_freer_ultimate(2, value, out);
|
||||||
free(value);
|
|
||||||
if (temp == NULL)
|
if (temp == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
out = temp;
|
out = temp;
|
||||||
}
|
}
|
||||||
|
if (out[i] != '\0')
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return (out);
|
return (out);
|
||||||
|
Loading…
Reference in New Issue
Block a user