Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit237795a

Browse files
committed
Check DCH_MAX_ITEM_SIZ limits with <=, not <.
We reserve space for the full amount, not one less. The affected checksdeal with localized month and day names. Today's DCH_MAX_ITEM_SIZ valuewould suffice for a 60-byte day name, while the longest known is the49-byte mn_CN.utf-8 word for "Saturday." Thus, the upshot of thischange is merely to avoid misdirecting future readers of the code; usersare not expected to see errors either way.
1 parenta7a4adc commit237795a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

‎src/backend/utils/adt/formatting.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,7 +2543,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
25432543
{
25442544
char*str=str_toupper_z(localized_full_months[tm->tm_mon-1],collid);
25452545

2546-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2546+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
25472547
strcpy(s,str);
25482548
else
25492549
ereport(ERROR,
@@ -2563,7 +2563,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
25632563
{
25642564
char*str=str_initcap_z(localized_full_months[tm->tm_mon-1],collid);
25652565

2566-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2566+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
25672567
strcpy(s,str);
25682568
else
25692569
ereport(ERROR,
@@ -2583,7 +2583,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
25832583
{
25842584
char*str=str_tolower_z(localized_full_months[tm->tm_mon-1],collid);
25852585

2586-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2586+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
25872587
strcpy(s,str);
25882588
else
25892589
ereport(ERROR,
@@ -2603,7 +2603,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
26032603
{
26042604
char*str=str_toupper_z(localized_abbrev_months[tm->tm_mon-1],collid);
26052605

2606-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2606+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
26072607
strcpy(s,str);
26082608
else
26092609
ereport(ERROR,
@@ -2622,7 +2622,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
26222622
{
26232623
char*str=str_initcap_z(localized_abbrev_months[tm->tm_mon-1],collid);
26242624

2625-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2625+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
26262626
strcpy(s,str);
26272627
else
26282628
ereport(ERROR,
@@ -2641,7 +2641,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
26412641
{
26422642
char*str=str_tolower_z(localized_abbrev_months[tm->tm_mon-1],collid);
26432643

2644-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2644+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
26452645
strcpy(s,str);
26462646
else
26472647
ereport(ERROR,
@@ -2664,7 +2664,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
26642664
{
26652665
char*str=str_toupper_z(localized_full_days[tm->tm_wday],collid);
26662666

2667-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2667+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
26682668
strcpy(s,str);
26692669
else
26702670
ereport(ERROR,
@@ -2682,7 +2682,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
26822682
{
26832683
char*str=str_initcap_z(localized_full_days[tm->tm_wday],collid);
26842684

2685-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2685+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
26862686
strcpy(s,str);
26872687
else
26882688
ereport(ERROR,
@@ -2700,7 +2700,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
27002700
{
27012701
char*str=str_tolower_z(localized_full_days[tm->tm_wday],collid);
27022702

2703-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2703+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
27042704
strcpy(s,str);
27052705
else
27062706
ereport(ERROR,
@@ -2718,7 +2718,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
27182718
{
27192719
char*str=str_toupper_z(localized_abbrev_days[tm->tm_wday],collid);
27202720

2721-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2721+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
27222722
strcpy(s,str);
27232723
else
27242724
ereport(ERROR,
@@ -2735,7 +2735,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
27352735
{
27362736
char*str=str_initcap_z(localized_abbrev_days[tm->tm_wday],collid);
27372737

2738-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2738+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
27392739
strcpy(s,str);
27402740
else
27412741
ereport(ERROR,
@@ -2752,7 +2752,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
27522752
{
27532753
char*str=str_tolower_z(localized_abbrev_days[tm->tm_wday],collid);
27542754

2755-
if (strlen(str)< (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
2755+
if (strlen(str) <= (n->key->len+TM_SUFFIX_LEN)*DCH_MAX_ITEM_SIZ)
27562756
strcpy(s,str);
27572757
else
27582758
ereport(ERROR,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp