| 1 | diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c |
| 2 | index 9f55e84..559df29 100644 |
| 3 | --- a/misc/hsearch_r.c |
| 4 | +++ b/misc/hsearch_r.c |
| 5 | @@ -19,7 +19,7 @@ |
| 6 | #include <errno.h> |
| 7 | #include <malloc.h> |
| 8 | #include <string.h> |
| 9 | - |
| 10 | +#include <stdint.h> |
| 11 | #include <search.h> |
| 12 | |
| 13 | /* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986 |
| 14 | @@ -73,6 +73,13 @@ __hcreate_r (nel, htab) |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | + if (nel >= SIZE_MAX / sizeof (_ENTRY)) |
| 19 | + { |
| 20 | + __set_errno (ENOMEM); |
| 21 | + return 0; |
| 22 | + } |
| 23 | + |
| 24 | + |
| 25 | /* There is still another table active. Return with error. */ |
| 26 | if (htab->table != NULL) |
| 27 | return 0; |
| 28 | -- |
| 29 | 1.9.4 |