Fix fuzzy error handling in pg_basebackup when opening gzFile

Michael Paquier <michael@paquier.xyz>

Commit: 177be9edf4bb966400db7769d61e479aa0fe0201
Author: Michael Paquier <michael@paquier.xyz>
Date: 2020-02-04T04:56:04Z
Releases: 13.0
Fix fuzzy error handling in pg_basebackup when opening gzFile

First, this code did not bother checking for a failure when calling
dup().  Then, per zlib, gzerror() returns NULL for a NULL input, which
can happen if passing down to gzdopen() an invalid file descriptor or if
there was an allocation failure.

No back-patch is done as this would unlikely be a problem in the field.

Per Coverity.

Reported-by: Tom Lane

Files

PathChange+/−
src/bin/pg_basebackup/pg_basebackup.c modified +14 −1