projects
/
postgresql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
54152d0
)
Fix access past end of string in date parsing.
author
Heikki Linnakangas
Tue, 2 Oct 2012 07:43:48 +0000
(10:43 +0300)
committer
Heikki Linnakangas
Tue, 2 Oct 2012 07:56:40 +0000
(10:56 +0300)
This affects date_in(), and a couple of other funcions that use DecodeDate().
Hitoshi Harada
src/backend/utils/adt/datetime.c
patch
|
blob
|
blame
|
history
diff --git
a/src/backend/utils/adt/datetime.c
b/src/backend/utils/adt/datetime.c
index a74dce79f504cf18a255057f688476a2e87f5007..899aeb7ae717b82133a2d5d6274f074a145a91f1 100644
(file)
--- a/
src/backend/utils/adt/datetime.c
+++ b/
src/backend/utils/adt/datetime.c
@@
-2168,9
+2168,12
@@
DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
while (*str != '\0' && nf < MAXDATEFIELDS)
{
/* skip field separators */
- while (!isalnum((unsigned char) *str))
+ while (
*str != '\0' &&
!isalnum((unsigned char) *str))
str++;
+ if (*str == '\0')
+ return DTERR_BAD_FORMAT; /* end of string after separator */
+
field[nf] = str;
if (isdigit((unsigned char) *str))
{