archive: fix handling of name lengths of exactly 100 bytes

cute-signatures
Timo Teräs 2013-09-20 21:51:57 +03:00
parent cecb810746
commit 73820e4a3e
1 changed files with 3 additions and 0 deletions

View File

@ -158,6 +158,9 @@ int apk_tar_parse(struct apk_istream *is, apk_archive_entry_parser parser,
}; };
teis.csum = NULL; teis.csum = NULL;
buf.mode[0] = 0; /* to nul terminate 100-byte buf.name */
buf.magic[0] = 0; /* to nul terminate 100-byte buf.linkname */
if (memcmp(di->id, "APK2", 4) == 0 && if (memcmp(di->id, "APK2", 4) == 0 &&
di->size <= sizeof(entry.csum.data)) { di->size <= sizeof(entry.csum.data)) {
entry.csum.type = di->size; entry.csum.type = di->size;