Skip to content

Commit c7c7d71

Browse files
committed
fix null pointer access in get_tableoids_list()
1 parent fe6e10c commit c7c7d71

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/utils.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ get_tableoids_list(List *tlist)
101101
if (!IsA(var, Var))
102102
continue;
103103

104-
if (strlen(te->resname) > TABLEOID_STR_BASE_LEN &&
105-
0 == strncmp(te->resname, TABLEOID_STR(""), TABLEOID_STR_BASE_LEN) &&
106-
var->varoattno == TableOidAttributeNumber)
104+
/* Check that column name begins with TABLEOID_STR & it's tableoid */
105+
if (var->varoattno == TableOidAttributeNumber &&
106+
(te->resname && strlen(te->resname) > TABLEOID_STR_BASE_LEN) &&
107+
0 == strncmp(te->resname, TABLEOID_STR(""), TABLEOID_STR_BASE_LEN))
107108
{
108109
result = lappend(result, te);
109110
}

0 commit comments

Comments
 (0)