fixes #2200: new WinZip tokenizer hex data length problem

pull/2217/head
philsmd 5 years ago
parent 11c8a4040b
commit 17b7eb1dce

@ -162,7 +162,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
token.len_max[6] = 6;
token.sep[6] = '*';
token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH
| TOKEN_ATTR_VERIFY_DIGIT;
| TOKEN_ATTR_VERIFY_HEX;
token.len_min[7] = 0;
token.len_max[7] = 16384;
@ -233,7 +233,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u8 *compress_length_pos = token.buf[6];
const u32 compress_length = hc_strtoul ((const char *) compress_length_pos, NULL, 10);
const u32 compress_length = hc_strtoul ((const char *) compress_length_pos, NULL, 16);
zip2->compress_length = compress_length;
@ -384,7 +384,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
sprintf (auth_tmp + j, "%02x", ptr[i]);
}
const int line_len = snprintf (line_buf, line_size, "%s*%u*%u*%u*%s*%x*%u*%s*%s*%s",
const int line_len = snprintf (line_buf, line_size, "%s*%u*%u*%u*%s*%x*%x*%s*%s*%s",
SIGNATURE_ZIP2_START,
zip2->type,
zip2->mode,

@ -94,7 +94,7 @@ sub module_generate_hash
my $auth = hmac_hex ($data, $key_bin, \&sha1, 64);
my $hash = sprintf ('$zip2$*%u*%u*%u*%s*%s*%u*%s*%s*$/zip2$', $type, $mode, $magic, $salt, $verify_bytes, $compress_length, $data, substr ($auth, 0, 20));
my $hash = sprintf ('$zip2$*%u*%u*%u*%s*%s*%x*%s*%s*$/zip2$', $type, $mode, $magic, $salt, $verify_bytes, $compress_length, $data, substr ($auth, 0, 20));
return $hash;
}

Loading…
Cancel
Save