Skip to content

Commit

Permalink
7z: copy/paste error in error checking, found by static analysis.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
icculus committed May 17, 2020
1 parent 3169a5e commit 00599b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/physfs_archiver_7z.c
Expand Up @@ -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);
Expand Down

0 comments on commit 00599b7

Please sign in to comment.