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

Commit57379cd

Browse files
committed
Fix thinkos from4f4061b for libpq integer parsing
A check was redundant. While on it, add an assertion to make sure thatthe parsing routine is never called with a NULL input. All the codepaths currently calling the parsing routine are careful with NULL inputsalready, but future callers may forget that.Reported-by: Peter Eisentraut, Lars KanisDiscussion:https://postgr.es/m/ec64956b-4597-56b6-c3db-457d15250fe4@2ndquadrant.comBackpatch-through: 12
1 parente3db3f8 commit57379cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,8 @@ parse_int_param(const char *value, int *result, PGconn *conn,
16961696
char*end;
16971697
longnumval;
16981698

1699+
Assert(value!=NULL);
1700+
16991701
*result=0;
17001702

17011703
/* strtol(3) skips leading whitespaces */
@@ -1713,10 +1715,10 @@ parse_int_param(const char *value, int *result, PGconn *conn,
17131715
* Skip any trailing whitespace; if anything but whitespace remains before
17141716
* the terminating character, fail
17151717
*/
1716-
while (*end&&*end!='\0'&&isspace((unsignedchar)*end))
1718+
while (*end!='\0'&&isspace((unsignedchar)*end))
17171719
end++;
17181720

1719-
if (*end&&*end!='\0')
1721+
if (*end!='\0')
17201722
gotoerror;
17211723

17221724
*result=numval;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp