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

Commit3d4b0ab

Browse files
committed
Reject invalid input in int2vectorin.
Since the int2vector type is intended only for internal use, this patch doesn'tworry about prettifying the error messages, which has the fringe benefit ofavoiding creating additional translatable strings. For a type intended to beused by end-users, we would want to do better, but the approach taken hereseems like the correct trade-off for this case.Caleb Welton
1 parent540e69a commit3d4b0ab

File tree

1 file changed

+4
-3
lines changed
  • src/backend/utils/adt

1 file changed

+4
-3
lines changed

‎src/backend/utils/adt/int.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.86 2009/09/04 11:20:22heikki Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.87 2009/12/30 01:29:22rhaas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -146,10 +146,11 @@ int2vectorin(PG_FUNCTION_ARGS)
146146

147147
for (n=0;*intString&&n<FUNC_MAX_ARGS;n++)
148148
{
149-
if (sscanf(intString,"%hd",&result->values[n])!=1)
150-
break;
151149
while (*intString&&isspace((unsignedchar)*intString))
152150
intString++;
151+
if (*intString=='\0')
152+
break;
153+
result->values[n]=pg_atoi(intString,sizeof(int16),' ');
153154
while (*intString&& !isspace((unsignedchar)*intString))
154155
intString++;
155156
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp