sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

commit 1eb587973e37752fdbd96dae505ba298d813dce5
parent 2adf2ce8ca208d31ae754065bbd35e0672a50610
Author: Quentin Rameau <quinq@fifth.space>
Date:   Fri, 23 Jun 2017 20:50:43 +0200

Check for 0 size in xreallocarray

Diffstat:
sacc.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/sacc.c b/sacc.c @@ -50,6 +50,10 @@ xreallocarray(void *m, const size_t n, const size_t s) { void *nm; + if (n == 0 || s == 0) { + free(m); + return NULL; + } if (s && n > (size_t)-1/s) die("realloc: overflow"); if (!(nm = realloc(m, n * s)))