Protect against integer overflow in malloca() calls.
[gnulib.git] / lib / strcasestr.c
index 27145dd..dfbf925 100644 (file)
@@ -39,7 +39,7 @@ knuth_morris_pratt (const char *haystack, const char *needle,
   size_t m = strlen (needle);
 
   /* Allocate the table.  */
-  size_t *table = (size_t *) malloca (m * sizeof (size_t));
+  size_t *table = (size_t *) nmalloca (m, sizeof (size_t));
   if (table == NULL)
     return false;
   /* Fill the table.