pkarashchenko commented on a change in pull request #5519:
URL: https://github.com/apache/incubator-nuttx/pull/5519#discussion_r809137279
##########
File path: libs/libc/time/lib_asctimer.c
##########
@@ -70,10 +70,13 @@ static const char * const g_mon_name[12] =
FAR char *asctime_r(FAR const struct tm *tp, FAR char *buf)
{
- snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
+ char tmp[128];
+
+ snprintf(tmp, 128, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
Review comment:
```suggestion
snprintf(tmp, sizeof(tmp), "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
```
##########
File path: sched/wqueue/kwork_thread.c
##########
@@ -205,11 +205,11 @@ static int work_thread_create(FAR const char *name, int
priority,
FAR struct kwork_wqueue_s *wqueue)
{
FAR char *argv[2];
- char args[16];
+ char args[32];
int wndx;
int pid;
- snprintf(args, 16, "0x%" PRIxPTR, (uintptr_t)wqueue);
+ snprintf(args, 32, "0x%" PRIxPTR, (uintptr_t)wqueue);
Review comment:
```suggestion
snprintf(args, sizeof(args), "0x%" PRIxPTR, (uintptr_t)wqueue);
```
##########
File path: libs/libc/string/lib_strchr.c
##########
@@ -48,19 +48,16 @@
#undef strchr /* See mm/README.txt */
FAR char *strchr(FAR const char *s, int c)
{
- if (s)
+ for (; ; s++)
{
- for (; ; s++)
+ if (*s == c)
{
- if (*s == c)
- {
- return (FAR char *)s;
- }
+ return (FAR char *)s;
+ }
- if (!*s)
- {
- break;
- }
+ if (!*s)
Review comment:
```suggestion
if (*s == '\0')
```
##########
File path: libs/libc/string/lib_strdup.c
##########
@@ -36,13 +36,11 @@
FAR char *strdup(FAR const char *s)
{
FAR char *news = NULL;
- if (s)
+
+ news = (FAR char *)lib_malloc(strlen(s) + 1);
Review comment:
```suggestion
FAR char *news = (FAR char *)lib_malloc(strlen(s) + 1);
```
optional
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]