diff --git a/sds.c b/sds.c index 3a7eae7..f8651e6 100644 --- a/sds.c +++ b/sds.c @@ -227,7 +227,12 @@ sds sdsMakeRoomFor(sds s, size_t addlen) { if (type == SDS_TYPE_5) type = SDS_TYPE_8; hdrlen = sdsHdrSize(type); - assert(hdrlen + newlen + 1 > reqlen); /* Catch size_t overflow */ + + if (hdrlen + newlen + 1 < reqlen) + { + return NULL; + } + if (oldtype==type) { newsh = s_realloc(sh, hdrlen+newlen+1); if (newsh == NULL) return NULL;