Do not copy more bytes than the filename string contains.

This commit is contained in:
Nicolas Tsiftes 2014-06-10 21:32:29 +02:00 committed by harald
parent a952a96b6e
commit df0cc061f6

View file

@ -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);