diff options
Diffstat (limited to 'mysys/safemalloc.c')
-rw-r--r-- | mysys/safemalloc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index 034b6f2536b..8ccc49bbb23 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -115,9 +115,10 @@ void *sf_malloc(size_t size, myf my_flags) init_done= 1; } - irem= (struct st_irem *) malloc (sizeof(struct st_irem) + size + 4); + if (size > SIZE_T_MAX - 1024L*1024L*16L) /* Wrong call */ + return 0; - if (!irem) + if (!(irem= (struct st_irem *) malloc (sizeof(struct st_irem) + size + 4))) return 0; /* we guarantee the alignment */ |