substr alloue memoire en cas de nul
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/11/25 14:01:58 by hulamy #+# #+# */
|
||||
/* Updated: 2019/11/27 19:54:09 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/11/28 16:32:34 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -41,7 +41,7 @@ char *ft_substr(char const *s, unsigned int start, size_t len)
|
||||
if (!s)
|
||||
return (NULL);
|
||||
if (ft_strlen(s) < start)
|
||||
return ("");
|
||||
return (ft_strdup(""));
|
||||
if (!(str = (char *)malloc(sizeof(char) * (len + 1))))
|
||||
return (NULL);
|
||||
i = 0;
|
||||
|
||||
Reference in New Issue
Block a user