BUG #18787: pointer te->defn not checked for NULL

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: dan-eli(at)mail(dot)ru
Subject: BUG #18787: pointer te->defn not checked for NULL
Date: 2025-01-28 14:32:06
Message-ID: 18787-676496fef9742cab@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18787
Logged by: Daniel Elishakov
Email address: dan-eli(at)mail(dot)ru
PostgreSQL version: 16.6
Operating system: ubuntu 20.04
Description:

Here is a patch fixing the issue. I think that NULL check is needed here
diff --git a/src/bin/pg_dump/pg_backup_archiver.c
b/src/bin/pg_dump/pg_backup_archiver.c
index 958f88d420..ebb7eca43c 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -3654,7 +3654,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool
isData)
if (!ropt->noOwner &&
(!ropt->use_setsessauth ||
(strcmp(te->desc, "SCHEMA") == 0 &&
- strncmp(te->defn, "--", 2) == 0)) &&
+ (te->defn && strncmp(te->defn, "--", 2) == 0))) &&
te->owner && strlen(te->owner) > 0 &&
te->dropStmt && strlen(te->dropStmt) > 0)
{

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-01-28 15:00:05 Re: BUG #18787: pointer te->defn not checked for NULL
Previous Message PG Bug reporting form 2025-01-28 14:08:55 BUG #18786: Pointer bmr.rel, dereferenced by passing as 1st parameter to function is checked for NULL later