From 00599b7dac6cd54c819bda14a0abac6474c0e788 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 17 May 2020 01:26:31 -0400 Subject: [PATCH] 7z: copy/paste error in error checking, found by static analysis. This was clearly copied from a previous line but wasn't updated with the correct condition to check, so if malloc() failed, it would dereference NULL instead of reporting an error. --- src/physfs_archiver_7z.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physfs_archiver_7z.c b/src/physfs_archiver_7z.c index 914f6916..6b882c4d 100644 --- a/src/physfs_archiver_7z.c +++ b/src/physfs_archiver_7z.c @@ -290,7 +290,7 @@ static PHYSFS_Io *SZIP_openRead(void *opaque, const char *path) io = NULL; buf = allocator.Malloc(outSizeProcessed); - GOTO_IF(rc != SZ_OK, PHYSFS_ERR_OUT_OF_MEMORY, SZIP_openRead_failed); + GOTO_IF(buf == NULL, PHYSFS_ERR_OUT_OF_MEMORY, SZIP_openRead_failed); memcpy(buf, outBuffer + offset, outSizeProcessed); alloc->Free(alloc, outBuffer);