42us-stupidity
42us-stupidity copied to clipboard
False positive on d07ex00 / June piscine 2018
Here's the code I turned in that passed stupidity:
int ft_strlen(char *str)
{
int length;
length = 0;
while (str[length])
{
length++;
}
return (length);
}
char *ft_strdup(char *src)
{
int i;
int len;
char *str;
len = 0;
while (src[len])
len++;
str = (char*)malloc(sizeof(*str) * (len + 1));
i = 0;
while (i < len)
{
str[i] = src[i];
i++;
}
return (str);
}
Here's the deepthought trace:
$> /usr/bin/norminette -R CheckForbiddenSourceHeader ft_strdup.c | grep -E '^(Error|Warning)'
$> gcc -Wextra -Wall -Werror main.c ft_strdup.c -o user_exe
= Test 1 ===================================================
$> ./4p5fgfaqiyfj45do7eipjx1e
$> diff -U 3 user_output_test1 test1.output | cat -e
--- user_output_test1 2018-05-26 13:14:15.000000000 -0700$
+++ test1.output 2018-05-26 13:14:15.000000000 -0700$
@@ -1,10 +1,10 @@$
$
hello 42$
vyTIfpsL8uP7tiyPPtuNkz9kFeHd$
-shEnUD4mhYOEJeBBhtPjo5UDpgvRBp27UmtIJ802DGrQ^?$
+shEnUD4mhYOEJeBBhtPjo5UDpgvRBp27UmtIJ802DGr$
vzcVeYyGX5z$
-mBTFeYyGX5z$
+mBTF$
yfCFaIRCa74b7WJQPzqmWvftxFATVHMeEN4bY2$
6Hx5onUljlg$
XE15quu2ogn$
-ItTg6Oj2ogn$
+ItTg6Oj$
Diff KO :(
Grade: 0