projects
/
Libft.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dfb54cd
)
Repaired ft_strndup. It duplicated n - 1 characters.
author
Lukas Jiriste
<ljiriste@student.42prague.com>
Thu, 24 Aug 2023 09:24:05 +0000
(11:24 +0200)
committer
Lukas Jiriste
<ljiriste@student.42prague.com>
Thu, 24 Aug 2023 09:24:05 +0000
(11:24 +0200)
ft_strndup.c
patch
|
blob
|
history
diff --git
a/ft_strndup.c
b/ft_strndup.c
index 84e4bde8541befef8cec5f38f75ad08f41bd5af2..66088030f072f7988275e7fe715c252bcfeb2b8b 100644
(file)
--- a/
ft_strndup.c
+++ b/
ft_strndup.c
@@
-24,7
+24,7
@@
char *ft_strndup(const char *s, size_t n)
dest = malloc((n + 1) * sizeof(char));
if (dest == NULL)
return (dest);
- ft_strlcpy(dest, s, n);
+ ft_strlcpy(dest, s, n
+ 1
);
dest[n + 1] = '\0';
return (dest);
}