1
0
Fork 0

avoid overflow in memsetptr

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@838 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 11 years ago
parent 00228b0cd6
commit 95e9516102

@ -106,10 +106,13 @@ static void *memsetptr(void *mem, void *content, size_t n)
{
void **p = (void **) mem;
void **end = (char *) mem + n;
while (p < end) {
while (p < end - sizeof(content)) {
*p = content;
p += sizeof(content);
}
if (p < end) {
memset(p, -1, end - p);
}
return mem;
}
')

Loading…
Cancel
Save