Browse Source

limit malloc'ed data in eax_decrypt_verify_memory()

Steffen Jaeckel 8 years ago
parent
commit
9f020b17df
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/encauth/eax/eax_decrypt_verify_memory.c

+ 3 - 0
src/encauth/eax/eax_decrypt_verify_memory.c

@@ -55,6 +55,9 @@ int eax_decrypt_verify_memory(int cipher,
    /* default to zero */
    /* default to zero */
    *stat = 0;
    *stat = 0;
 
 
+   /* limit taglen */
+   taglen = MIN(taglen, MAXBLOCKSIZE);
+
    /* allocate ram */
    /* allocate ram */
    buf = XMALLOC(taglen);
    buf = XMALLOC(taglen);
    eax = XMALLOC(sizeof(*eax));
    eax = XMALLOC(sizeof(*eax));