Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c62356

Browse files
committed
Add an assertion that we don't pass NULL to snprintf("%s").
Per commite748e90, we appear to have little or no coverage in thebuildfarm of machines that will dump core when asked to printf anull string pointer. Let's try to improve that situation by addingan assertion that will make src/port/snprintf.c behave that way.Since it's just an assertion, it won't break anything in productionbuilds, but it will help developers find this type of oversight.Note that while our buildfarm coverage of machines that use thatsnprintf implementation is pretty thin on the Unix side (apparentlyamounting only to gaur/pademelon), all of the MSVC critters use it.Discussion:https://postgr.es/m/156b989dbc6fe7c4d3223cf51da61195@postgrespro.ru
1 parente748e90 commit0c62356

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎src/port/snprintf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ dopr(PrintfTarget *target, const char *format, va_list args)
745745
strvalue=argvalues[fmtpos].cptr;
746746
else
747747
strvalue=va_arg(args,char*);
748+
/* Whine if someone tries to print a NULL string */
749+
Assert(strvalue!=NULL);
748750
fmtstr(strvalue,leftjust,fieldwidth,precision,pointflag,
749751
target);
750752
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp