diff --git a/src/interfaces/ecpg/pgtypeslib/dt_common.c b/src/interfaces/ecpg/pgtypeslib/dt_common.c index 7ca4dd51ce06f59c0b0ca48948e58b1c021d603b..2286acd428f77c68c402cfe519374bd45271c147 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt_common.c +++ b/src/interfaces/ecpg/pgtypeslib/dt_common.c @@ -1682,6 +1682,7 @@ DecodePosixTimezone(char *str, int *tzp) * * The "lowstr" work buffer must have at least strlen(timestr) + MAXDATEFIELDS * bytes of space. On output, field[] entries will point into it. + * The field[] and ftype[] arrays must have at least MAXDATEFIELDS entries. */ int ParseDateTime(char *timestr, char *lowstr, @@ -1695,9 +1696,9 @@ ParseDateTime(char *timestr, char *lowstr, while (*(*endstr) != '\0') { /* Record start of current field */ - field[nf] = lp; if (nf >= MAXDATEFIELDS) return -1; + field[nf] = lp; /* leading digit? then date or time */ if (isdigit((unsigned char) *(*endstr)))