Do not copy more bytes than the filename string contains.
This commit is contained in:
parent
a952a96b6e
commit
df0cc061f6
|
@ -651,7 +651,7 @@ reserve(const char *name, coffee_page_t pages,
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&hdr, 0, sizeof(hdr));
|
memset(&hdr, 0, sizeof(hdr));
|
||||||
memcpy(hdr.name, name, sizeof(hdr.name) - 1);
|
strncpy(hdr.name, name, sizeof(hdr.name) - 1);
|
||||||
hdr.max_pages = pages;
|
hdr.max_pages = pages;
|
||||||
hdr.flags = HDR_FLAG_ALLOCATED | flags;
|
hdr.flags = HDR_FLAG_ALLOCATED | flags;
|
||||||
write_header(&hdr, page);
|
write_header(&hdr, page);
|
||||||
|
|
Loading…
Reference in a new issue