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

Commita6a95d4

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 parent399b8d1 commita6a95d4

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
@@ -1663,6 +1663,8 @@ parse_int_param(const char *value, int *result, PGconn *conn,
16631663
char*end;
16641664
longnumval;
16651665

1666+
Assert(value!=NULL);
1667+
16661668
*result=0;
16671669

16681670
/* strtol(3) skips leading whitespaces */
@@ -1680,10 +1682,10 @@ parse_int_param(const char *value, int *result, PGconn *conn,
16801682
* Skip any trailing whitespace; if anything but whitespace remains before
16811683
* the terminating character, fail
16821684
*/
1683-
while (*end&&*end!='\0'&&isspace((unsignedchar)*end))
1685+
while (*end!='\0'&&isspace((unsignedchar)*end))
16841686
end++;
16851687

1686-
if (*end&&*end!='\0')
1688+
if (*end!='\0')
16871689
gotoerror;
16881690

16891691
*result=numval;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp