Page MenuHomeFreeBSD

D54093.diff
No OneTemporary

D54093.diff

diff --git a/sys/libkern/strndup.c b/sys/libkern/strndup.c
--- a/sys/libkern/strndup.c
+++ b/sys/libkern/strndup.c
@@ -40,9 +40,9 @@
size_t len;
char *copy;
- len = strnlen(string, maxlen) + 1;
- copy = malloc(len, type, M_WAITOK);
+ len = strnlen(string, maxlen);
+ copy = malloc(len + 1, type, M_WAITOK);
memcpy(copy, string, len);
- copy[len - 1] = '\0';
+ copy[len] = '\0';
return (copy);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 12, 8:31 PM (15 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26763167
Default Alt Text
D54093.diff (407 B)

Event Timeline