jgigault / 42FileChecker

42FileChecker is a tiny bash script developed at 42 school for testing and checking files according to the rules of the subjects
Apache License 2.0
306 stars 56 forks source link

[NeedNewTest] 42filechecker doesn't check memory allocation on strjoin #121

Open EPgg92 opened 6 years ago

EPgg92 commented 6 years ago
#include "libft.h"

char    *ft_strjoin(char const *s1, char const *s2)
{
    char    *res;

    if (s1 == NULL || s2 == NULL)
        return (NULL);
    if (!(res = ft_strnew(ft_strlen((char *)s1 + ft_strlen((char *)s2 + 1))))) // +1 is very bad but 42fc don' t check it!
        return (NULL);
    res = ft_strcpy(res, s1);
    res = ft_strcat(res, s2);
    return (res);
}

Thx

jgigault commented 5 years ago

Hello @EPgg92 The idea to check for leaks on "libft" project is nice. Are you interested in developing this test?