@@ -118,11 +118,11 @@ free(ret_str); return NULL; } cfw_string_set_nocopy(ret, ret_str, ret_len); - if (stream->cache_len - i - 1 > 0) { + if (stream->cache_len > i + 1) { if ((new_cache = malloc( stream->cache_len - i - 1)) == NULL) return NULL; memcpy(new_cache, stream->cache + i + 1, stream->cache_len - i - 1); @@ -205,11 +205,11 @@ free(ret_str); return NULL; } cfw_string_set_nocopy(ret, ret_str, ret_len); - if (buf_len - i - 1 > 0) { + if (buf_len > i + 1) { new_cache = malloc(buf_len - i - 1); if (new_cache == NULL) { free(buf); return NULL; }