Skip to content

Commit 0899556

Browse files
committed
Fix access past end of string in date parsing.
This affects date_in(), and a couple of other funcions that use DecodeDate(). Hitoshi Harada
1 parent dbdb217 commit 0899556

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/utils/adt/datetime.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,9 +2176,12 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
21762176
while (*str != '\0' && nf < MAXDATEFIELDS)
21772177
{
21782178
/* skip field separators */
2179-
while (!isalnum((unsigned char) *str))
2179+
while (*str != '\0' && !isalnum((unsigned char) *str))
21802180
str++;
21812181

2182+
if (*str == '\0')
2183+
return DTERR_BAD_FORMAT; /* end of string after separator */
2184+
21822185
field[nf] = str;
21832186
if (isdigit((unsigned char) *str))
21842187
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy