Fixed a buffer overflow in module_hash_decode() of -m 15500

pull/2431/head
Jens Steube 4 years ago
parent 1e469a96a4
commit 09b2bb0ad7

@ -197,9 +197,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// alias
const u8 *alias_pos = token.buf[6];
strncpy ((char *) jks_sha1->alias, (const char *) alias_pos, 64);
memcpy ((char *) jks_sha1->alias, (const char *) token.buf[6], token.len[6]);
// fake salt
@ -237,6 +235,10 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
u8 *der = (u8 *) jks_sha1->der;
char alias[65] = { 0 };
memcpy (alias, (char *) jks_sha1->alias, 64);
const int line_len = snprintf (line_buf, line_size, "%s*%08X%08X%08X%08X%08X*%08X%08X%08X%08X%08X*%s*%02X*%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X*%s",
SIGNATURE_JKS_SHA1,
byte_swap_32 (jks_sha1->checksum[0]),
@ -265,7 +267,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
der[17],
der[18],
der[19],
(char *) jks_sha1->alias
alias
);
return line_len;

Loading…
Cancel
Save