diff options
author | Daniel Gustafsson | 2023-12-20 21:37:28 +0000 |
---|---|---|
committer | Daniel Gustafsson | 2023-12-20 21:37:28 +0000 |
commit | 30e54d5c5d8fceb7287162c116961fa0627544f5 (patch) | |
tree | be0dbb47001bb78ca088606fadda3444de8cae7c | |
parent | dc212340058b4e7ecfc5a7a81ec50e7a207bf288 (diff) |
Fix unchecked return value from strdup
The pg_dump compression was using strdup() instead of pg_strdup()
and failed to check the returned pointer for out-of-memory before
dereferencing it. Fix by using pg_strdup() instead which probably
was the intention here in the original patch.
Backpatch to v16 where pg_dump compression was introduced.
Reviewed-by: Tristan Partin <[email protected]>
Reviewed-by: Nathan Bossart <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 16
-rw-r--r-- | src/bin/pg_dump/compress_io.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/pg_dump/compress_io.c b/src/bin/pg_dump/compress_io.c index 4fee6e24348..efedc53a173 100644 --- a/src/bin/pg_dump/compress_io.c +++ b/src/bin/pg_dump/compress_io.c @@ -249,7 +249,7 @@ InitDiscoverCompressFileHandle(const char *path, const char *mode) Assert(strcmp(mode, PG_BINARY_R) == 0); - fname = strdup(path); + fname = pg_strdup(path); if (hasSuffix(fname, ".gz")) compression_spec.algorithm = PG_COMPRESSION_GZIP; |