1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-11 00:01:16 +00:00

Testfix for CID 1402439 (#1 of 1): Out-of-bounds read

This commit is contained in:
jsteube 2017-02-14 18:07:33 +01:00
parent 958ca90132
commit d069c980d0

View File

@ -719,14 +719,14 @@ int _old_apply_rule (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len,
case RULE_OP_MANGLE_APPEND_MEMORY:
if (mem_len < 1) return (RULE_RC_REJECT_ERROR);
if ((out_len + mem_len) > BLOCK_SIZE) return (RULE_RC_REJECT_ERROR);
if ((out_len + mem_len) >= BLOCK_SIZE) return (RULE_RC_REJECT_ERROR);
memcpy (out + out_len, mem, mem_len);
out_len += mem_len;
break;
case RULE_OP_MANGLE_PREPEND_MEMORY:
if (mem_len < 1) return (RULE_RC_REJECT_ERROR);
if ((mem_len + out_len) > BLOCK_SIZE) return (RULE_RC_REJECT_ERROR);
if ((mem_len + out_len) >= BLOCK_SIZE) return (RULE_RC_REJECT_ERROR);
memcpy (mem + mem_len, out, out_len);
out_len += mem_len;
memcpy (out, mem, out_len);