mirror of
https://github.com/mmozeiko/pkg2zip.git
synced 2026-09-03 03:29:59 +03:00
extra error check for max file name length
This commit is contained in:
@@ -297,8 +297,8 @@ int main(int argc, char* argv[])
|
||||
const char* id2 = id + 13;
|
||||
|
||||
// https://github.com/TheOfficialFloW/NoNpDrm/blob/v1.1/src/main.c#L42
|
||||
uint8_t rif[512] = { 0 };
|
||||
if (argc == 3 && strlen(argv[2]) != 32)
|
||||
uint8_t rif[512];
|
||||
if (argc == 3 && !patch)
|
||||
{
|
||||
zrif_decode(argv[2], rif);
|
||||
if (strncmp((char*)rif + 0x10, content, 0x30) != 0)
|
||||
@@ -397,6 +397,11 @@ int main(int argc, char* argv[])
|
||||
fatal("ERROR: pkg file is too short, possible corrupted\n");
|
||||
}
|
||||
|
||||
if (name_size >= ZIP_MAX_FILENAME)
|
||||
{
|
||||
fatal("ERROR: pkg file contains file with very long name\n");
|
||||
}
|
||||
|
||||
char name[ZIP_MAX_FILENAME];
|
||||
sys_read(pkg, enc_offset + name_offset, name, name_size);
|
||||
aes128_ctr_xor(&key, iv, name_offset / 16, (uint8_t*)name, name_size);
|
||||
|
||||
Reference in New Issue
Block a user