mirror of
https://github.com/postgres/postgres.git
synced 2025-06-10 09:21:54 +03:00
Reject invalid input in int2vectorin.
Since the int2vector type is intended only for internal use, this patch doesn't worry about prettifying the error messages, which has the fringe benefit of avoiding creating additional translatable strings. For a type intended to be used by end-users, we would want to do better, but the approach taken here seems like the correct trade-off for this case. Caleb Welton
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.86 2009/09/04 11:20:22 heikki Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.87 2009/12/30 01:29:22 rhaas Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -146,10 +146,11 @@ int2vectorin(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
for (n = 0; *intString && n < FUNC_MAX_ARGS; n++)
|
for (n = 0; *intString && n < FUNC_MAX_ARGS; n++)
|
||||||
{
|
{
|
||||||
if (sscanf(intString, "%hd", &result->values[n]) != 1)
|
|
||||||
break;
|
|
||||||
while (*intString && isspace((unsigned char) *intString))
|
while (*intString && isspace((unsigned char) *intString))
|
||||||
intString++;
|
intString++;
|
||||||
|
if (*intString == '\0')
|
||||||
|
break;
|
||||||
|
result->values[n] = pg_atoi(intString, sizeof(int16), ' ');
|
||||||
while (*intString && !isspace((unsigned char) *intString))
|
while (*intString && !isspace((unsigned char) *intString))
|
||||||
intString++;
|
intString++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user