Skip to content

Commit 2adfbca

Browse files
committed
[update] enable asctime_r function parameter legal.
1 parent 065f958 commit 2adfbca

File tree

1 file changed

+3
-0
lines changed
  • components/libc/compilers/common

1 file changed

+3
-0
lines changed

components/libc/compilers/common/time.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ RTM_EXPORT(mktime);
239239

240240
char* asctime_r(const struct tm *t, char *buf)
241241
{
242+
RT_ASSERT(rt_strlen(days) > (t->tm_wday << 2));
243+
RT_ASSERT(rt_strlen(months) > (t->tm_mon << 2));
244+
242245
/* "Wed Jun 30 21:49:08 1993\n" */
243246
*(int*) buf = *(int*) (days + (t->tm_wday << 2));
244247
*(int*) (buf + 4) = *(int*) (months + (t->tm_mon << 2));

0 commit comments

Comments
 (0)