add extra byte for null terminator

This commit is contained in:
Andrew Pamment 2018-05-15 12:58:58 +10:00
parent 5100a21163
commit b9dbf0f21f

View File

@ -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); 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) { if (hashids_encode_v(hashids, hashid, 4, gUser->id, dir, sub, fid) == 0) {
hashids_free(hashids); hashids_free(hashids);