Pārlūkot izejas kodu

pmac_init: prevent possible out of bounds access of polys[]

Steffen Jaeckel 11 gadi atpakaļ
vecāks
revīzija
8652f33f35
1 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  1. 3 0
      src/mac/pmac/pmac_init.c

+ 3 - 0
src/mac/pmac/pmac_init.c

@@ -63,6 +63,9 @@ int pmac_init(pmac_state *pmac, int cipher, const unsigned char *key, unsigned l
           break;
        }
    }
+   if (poly >= (int)(sizeof(polys)/sizeof(polys[0]))) {
+      return CRYPT_INVALID_ARG;
+    }
    if (polys[poly].len != pmac->block_len) {
       return CRYPT_INVALID_ARG;
    }