From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Explicit NULL dereference (src/backend/commands/tablecmds.c) |
Date: | 2021-05-13 14:04:12 |
Message-ID: | CAEudQApoJeWf8XKshcJjdnAPaV+SN0x_hHPoE9+xKLC7ifVFuQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Per Coverity.
CID 1453114 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)
53. var_deref_model: Passing null pointer child_expr to strcmp, which
dereferences it.
It is agreed that asserts should be used for error conditions that can
never occur in the release.
But with errors that can occur, using assert does not make sense.
Better to make sure that strcmp can be called without risk.
Meanwhile, fix the strcmp call signature (const char).
#include <stdio.h>
#include <string.h>
int main()
{
const char * s1="";
const char * s2="0";
if (strstr(s1, s2) != 0) {
printf("found");
} else {
printf("not found");
}
}
not found!
regards,
Ranier Vilela
Attachment | Content-Type | Size |
---|---|---|
fix_null_dereference_tablecmds.patch | application/octet-stream | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-05-13 14:10:48 | Re: Explicit NULL dereference (src/backend/commands/tablecmds.c) |
Previous Message | vignesh C | 2021-05-13 13:35:55 | Re: subscriptioncheck failure |