Skip to content

Commit 846ea08

Browse files
committed
Oops, sometimes strtol isn't called in pg_atoi, so we do need that badp
check.
1 parent 7aee5ed commit 846ea08

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/utils/adt/numutils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.50 2002/07/16 17:55:25 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.51 2002/07/16 18:34:16 momjian Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -46,7 +46,7 @@ int32
4646
pg_atoi(char *s, int size, int c)
4747
{
4848
long l = 0;
49-
char *badp;
49+
char *badp = NULL;
5050

5151
Assert(s);
5252

@@ -71,7 +71,7 @@ pg_atoi(char *s, int size, int c)
7171
*/
7272
if (errno && errno != EINVAL)
7373
elog(ERROR, "pg_atoi: error reading \"%s\": %m", s);
74-
if (*badp && *badp != c)
74+
if (badp && *badp && *badp != c)
7575
elog(ERROR, "pg_atoi: error in \"%s\": can\'t parse \"%s\"", s, badp);
7676

7777
switch (size)

0 commit comments

Comments
 (0)