Re: Interesting message about printf()'s in PostgreSQL - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Interesting message about printf()'s in PostgreSQL
Date
Msg-id 28308.1029134117@sss.pgh.pa.us
Whole thread Raw
In response to Re: Interesting message about printf()'s in PostgreSQL  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
>> src/backend/port/dynloader/freebsd.c
> This one is perhaps dodgy.  You ahve this:
> static char error_message[BUFSIZ];
> Then you have this:
>         sprintf(error_message, "dlopen (%s) not supported", file);
> Where file isn't restricted in length I think...

Yeah.  In practice I'm not sure there's a problem --- the callers may
all limit the filename string to MAXPGPATH, which is well below BUFSIZ.
But changing the sprintf to snprintf is a cheap, localized way to be
sure.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Interesting message about printf()'s in PostgreSQL
Next
From: Mario Weilguni
Date:
Subject: Re: OOP real life example (was Re: Why is MySQL more chosen