projects
/
users
/
bernd
/
postgres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1972847
)
Repair problems with to_char() overrunning its input string.
author
Tom Lane
<
[email protected]
>
Wed, 3 Sep 2003 15:00:07 +0000
(15:00 +0000)
committer
Tom Lane
<
[email protected]
>
Wed, 3 Sep 2003 15:00:07 +0000
(15:00 +0000)
From Karel Zak.
src/backend/utils/adt/formatting.c
patch
|
blob
|
blame
|
history
diff --git
a/src/backend/utils/adt/formatting.c
b/src/backend/utils/adt/formatting.c
index c9fadb331f9307c06c05316dfea6685ca4814a7c..f63a41ccea3db17ef60ef0173783a8f980c4d0ed 100644
(file)
--- a/
src/backend/utils/adt/formatting.c
+++ b/
src/backend/utils/adt/formatting.c
@@
-1264,6
+1264,16
@@
DCH_processor(FormatNode *node, char *inout, int flag, void *data)
for (n = node, s = inout; n->type != NODE_TYPE_END; n++)
{
+ if (flag == FROM_CHAR && *s=='\0')
+ /*
+ * The input string is shorter than format picture,
+ * so it's good time to break this loop...
+ *
+ * Note: this isn't relevant for TO_CHAR mode, beacuse
+ * it use 'inout' allocated by format picture length.
+ */
+ break;
+
if (n->type == NODE_TYPE_ACTION)
{
int len;