Quellcode durchsuchen

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.
Ryan C. Gordon vor 5 Jahren
Ursprung
Commit
00599b7dac
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      src/physfs_archiver_7z.c

+ 1 - 1
src/physfs_archiver_7z.c

@@ -290,7 +290,7 @@ static PHYSFS_Io *SZIP_openRead(void *opaque, const char *path)
     io = NULL;
     io = NULL;
 
 
     buf = allocator.Malloc(outSizeProcessed);
     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);
     memcpy(buf, outBuffer + offset, outSizeProcessed);
 
 
     alloc->Free(alloc, outBuffer);
     alloc->Free(alloc, outBuffer);