Browse Source

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

Steffen Jaeckel 11 years ago
parent
commit
8652f33f35
1 changed files with 3 additions and 0 deletions
  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;
           break;
        }
        }
    }
    }
+   if (poly >= (int)(sizeof(polys)/sizeof(polys[0]))) {
+      return CRYPT_INVALID_ARG;
+    }
    if (polys[poly].len != pmac->block_len) {
    if (polys[poly].len != pmac->block_len) {
       return CRYPT_INVALID_ARG;
       return CRYPT_INVALID_ARG;
    }
    }