Skip to content

Commit 8255d98

Browse files
committed
Resolve char array truncation error from NUL terminator
1 parent 5196046 commit 8255d98

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@
3636
/**
3737
* Day names
3838
*/
39-
const char day_names_p[7][3] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
39+
const char day_names_p[7][3] = { { 'S', 'u', 'n' }, { 'M', 'o', 'n' }, { 'T', 'u', 'e' }, { 'W', 'e', 'd' },
40+
{ 'T', 'h', 'u' }, { 'F', 'r', 'i' }, { 'S', 'a', 't' } };
4041

4142
/**
4243
* Month names
4344
*/
44-
const char month_names_p[12][3] = {
45-
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
46-
};
45+
const char month_names_p[12][3] = { { 'J', 'a', 'n' }, { 'F', 'e', 'b' }, { 'M', 'a', 'r' }, { 'A', 'p', 'r' },
46+
{ 'M', 'a', 'y' }, { 'J', 'u', 'n' }, { 'J', 'u', 'l' }, { 'A', 'u', 'g' },
47+
{ 'S', 'e', 'p' }, { 'O', 'c', 't' }, { 'N', 'o', 'v' }, { 'D', 'e', 'c' } };
4748

4849
/**
4950
* Calculate the elapsed days since Unix Epoch

0 commit comments

Comments
 (0)