From b9dbf0f21fd95f9aa9acf20cbfb829322e88a2fe Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Tue, 15 May 2018 12:58:58 +1000 Subject: [PATCH] add extra byte for null terminator --- src/www_files.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/www_files.c b/src/www_files.c index 4f6cc17..59fd0b4 100644 --- a/src/www_files.c +++ b/src/www_files.c @@ -257,9 +257,9 @@ char *www_create_link(int dir, int sub, int fid) { sizereq = hashids_estimate_encoded_size_v(hashids, 4, gUser->id, dir, sub, fid); - hashid = (char *)malloc(sizereq); + hashid = (char *)malloc(sizereq + 1); - memset(hashid, 0, sizereq); + memset(hashid, 0, sizereq + 1); if (hashids_encode_v(hashids, hashid, 4, gUser->id, dir, sub, fid) == 0) { hashids_free(hashids);