summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/time.c
diff options
context:
space:
mode:
authorliukangcc <[email protected]>2021-09-15 14:16:38 +0800
committerliukangcc <[email protected]>2021-09-15 14:19:26 +0800
commit2adfbcaeca0c3b565583cbb3d808c1e02ac8bd6d (patch)
treeaf4b001c90e717e66269d29a33b58bb3dabba90b /components/libc/compilers/common/time.c
parent065f9586d038c52b50190a436e3d1f8101cdbf94 (diff)
[update] enable asctime_r function parameter legal.
Diffstat (limited to 'components/libc/compilers/common/time.c')
-rw-r--r--components/libc/compilers/common/time.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index 50f6d4c71e..efcfe4dec0 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -239,6 +239,9 @@ RTM_EXPORT(mktime);
char* asctime_r(const struct tm *t, char *buf)
{
+ RT_ASSERT(rt_strlen(days) > (t->tm_wday << 2));
+ RT_ASSERT(rt_strlen(months) > (t->tm_mon << 2));
+
/* "Wed Jun 30 21:49:08 1993\n" */
*(int*) buf = *(int*) (days + (t->tm_wday << 2));
*(int*) (buf + 4) = *(int*) (months + (t->tm_mon << 2));