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
parent fd3078d6bb
commit 7004355c0f

View file

@ -651,7 +651,7 @@ reserve(const char *name, coffee_page_t pages,
}
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.flags = HDR_FLAG_ALLOCATED | flags;
write_header(&hdr, page);