commit - 510885f759bdcb9febc6710d120af30902c7173c
commit + 1944573a096bbe0d2b80dd1644f01383b9353af5
blob - 6ec34f370067855ed6e758430e10de7930e72729
blob + 42db173ef1b6dbec1e36f988932ceaaf62802922
--- lib/pack.c
+++ lib/pack.c
return got_error(GOT_ERR_NO_SPACE);
if (pack->map) {
+ if (mapoff + sizeof(sizeN) >= pack->filesize)
+ return got_error(GOT_ERR_BAD_PACKFILE);
sizeN = *(pack->map + mapoff);
mapoff += sizeof(sizeN);
} else {
if (pack->map) {
size_t mapoff;
- if (delta_offset >= pack->filesize)
- return got_error(GOT_ERR_PACK_OFFSET);
mapoff = (size_t)delta_offset + *len;
+ if (mapoff + sizeof(offN) >= pack->filesize)
+ return got_error(GOT_ERR_PACK_OFFSET);
offN = *(pack->map + mapoff);
} else {
ssize_t n;
{
if (pack->map) {
size_t mapoff = delta_offset + tslen;
+ if (mapoff + sizeof(*id) >= pack->filesize)
+ return got_error(GOT_ERR_PACK_OFFSET);
memcpy(id, pack->map + mapoff, sizeof(*id));
} else {
ssize_t n;