mirror of
https://github.com/postgres/postgres.git
synced 2025-06-08 22:02:03 +03:00
Fix access past end of string in date parsing.
This affects date_in(), and a couple of other funcions that use DecodeDate(). Hitoshi Harada
This commit is contained in:
parent
d617b28c6c
commit
6c00b2bbf7
@ -2169,9 +2169,12 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
|
|||||||
while (*str != '\0' && nf < MAXDATEFIELDS)
|
while (*str != '\0' && nf < MAXDATEFIELDS)
|
||||||
{
|
{
|
||||||
/* skip field separators */
|
/* skip field separators */
|
||||||
while (!isalnum((unsigned char) *str))
|
while (*str != '\0' && !isalnum((unsigned char) *str))
|
||||||
str++;
|
str++;
|
||||||
|
|
||||||
|
if (*str == '\0')
|
||||||
|
return DTERR_BAD_FORMAT; /* end of string after separator */
|
||||||
|
|
||||||
field[nf] = str;
|
field[nf] = str;
|
||||||
if (isdigit((unsigned char) *str))
|
if (isdigit((unsigned char) *str))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user