diff options
Diffstat (limited to 'misc/hsearch_r.c')
-rw-r--r-- | misc/hsearch_r.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c index 81c27d800c..4414a25cba 100644 --- a/misc/hsearch_r.c +++ b/misc/hsearch_r.c @@ -19,7 +19,7 @@ #include <errno.h> #include <malloc.h> #include <string.h> - +#include <stdint.h> #include <search.h> /* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986 @@ -73,6 +73,13 @@ hcreate_r (nel, htab) return 0; } + if (nel >= SIZE_MAX / sizeof (_ENTRY)) + { + __set_errno (ENOMEM); + return 0; + } + + /* There is still another table active. Return with error. */ if (htab->table != NULL) return 0; |