ft_strclpy
Alienxbe opened this issue · 4 comments
Alienxbe commented
Actually the function ft_strlcpy shouldn't be protected. But in your unit test it's needed.
alelievr commented
Are you sure about it? There is a test to prevent people from protecting it from null:
void test_ft_strlcpy_null(void *ptr) {
typeof(strlcpy) *ft_strlcpy = ptr;
SET_EXPLANATION("your strlcpy doe not segfault when null parameter is sent");
SANDBOX_PROT(
ft_strlcpy(NULL, NULL, 10);
);
}
alelievr commented
Yes, I misread the issue, it should be fixed now
see7e commented
I know that this issue is closed but the return value of the function is an int and shouldn't return a NULL
pointer as your test expects.
ft_strlcpy : [OK] [OK] [OK] [OK] [OK] [OK] [NO CRASH]
[no crash]: your strlcpy doe not segfault when null parameter is sent
This raise
if (!dest && !src)
return (NULL);
✖ Executing: make fclean all bonus
ft_strlcpy.c: In function ‘ft_strlcpy’:
ft_strlcpy.c:23:10: error: returning ‘void *’ from a function with return type ‘unsigned int’ makes integer from pointer without a cast [-Werror=int-conversion]
23 | return (NULL);
| ^
cc1: all warnings being treated as errors
make: *** [<builtin>: ft_strlcpy.o] Error 1