diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-08-13 07:28:39 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2021-08-13 07:28:39 -0400 |
commit | da97524252b1313574094dcb90d6ccf395fc88b9 (patch) | |
tree | dfb40084d0e0d4d8db10da0633eb1db1fa584ac2 | |
parent | 2df306923a2b09aa6e46a3e24e9b0335c8016a1d (diff) |
lua strftime fix out of scope buffer
sbuf goes out of scope of the case statement
Change-Id: Ice0553b496bfbfa5bc243dddf5bad90f3baaba51
-rw-r--r-- | apps/plugins/lua/strftime.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/plugins/lua/strftime.c b/apps/plugins/lua/strftime.c index c6152bf492..cc110469bf 100644 --- a/apps/plugins/lua/strftime.c +++ b/apps/plugins/lua/strftime.c @@ -35,6 +35,9 @@ size_t strftime ( char* dst, size_t max, const char* format, const struct tm* t const char* src; unsigned long no; char buf [5]; +#if CONFIG_RTC + char sbuf[101]; +#endif if (!max) return 0; for ( ; *format != '\0'; format++ ) { @@ -83,7 +86,6 @@ again: case 's': { #if CONFIG_RTC time_t t = rb->mktime((struct tm*)tm); - char sbuf[101]; char* c; sbuf[100]=0; for (c=sbuf+99; c>sbuf; --c) { |