cmac-aes256: Correct size of local rk[] array. 20131224030506/pspp
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 24 Dec 2013 03:24:42 +0000 (19:24 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 24 Dec 2013 03:24:42 +0000 (19:24 -0800)
This array was undersized, yielding undefined behavior.  It happened to
work OK when compiled -O2 with GCC 4.7.x for x86, and fail with compiled
-O0 in the same environment.  This fixes the problem.

Reported by John Darrington.

src/libpspp/cmac-aes256.c

index fb8ea165fafb70aaeaa9f87c62e501e8f56c38ba..718b3062dcd68c18e11ce18f3603c526f132d729 100644 (file)
@@ -44,7 +44,7 @@ cmac_aes256(const uint8_t key[32],
             uint8_t cmac[16])
 {
   const char zeros[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-  uint32_t rk[4 * RIJNDAEL_MAXNR + 1];
+  uint32_t rk[4 * (RIJNDAEL_MAXNR + 1)];
   uint8_t k1[16], k2[16], L[16];
   const uint8_t *data = data_;
   uint8_t c[16], tmp[16];