We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af8c834 commit 05fab37Copy full SHA for 05fab37
1 file changed
libc/include/string.h
@@ -96,10 +96,15 @@ static __inline__ size_t strlen(const char * s) {
96
97
static __inline__ char * strncat(char * s1, const char * s2, size_t n) {
98
char * r = s1;
99
+ char c;
100
101
while (*s1)
102
s1++;
- strncpy(s1, s2, n);
103
+
104
+ while (n-- && (c = *s2++))
105
+ *s1++ = c;
106
107
+ *s1 = 0;
108
109
return r;
110
}
0 commit comments