nuttx/libs/libc/string
Xiang Xiao 4a16cf71f9 Fix -Werror=nonnull-compare and -Werror=format-truncation=
Error: module/mod_insmod.c:203:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
  203 |   strncpy(modp->modname, modname, MODLIB_NAMEMAX);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wqueue/kwork_thread.c: In function 'work_start_lowpri':
Error: wqueue/kwork_thread.c:212:22: error: '%lx' directive output may be truncated writing between 1 and 16 bytes into a region of size 14 [-Werror=format-truncation=]
  212 |   snprintf(args, 16, "0x%" PRIxPTR, (uintptr_t)wqueue);

local/local_sockif.c: In function 'local_getsockname':
Error: local/local_sockif.c:392:11: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  392 |           strncpy(unaddr->sun_path, conn->lc_path, namelen);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

chip/esp32_wifi_utils.c: In function 'esp_wifi_scan_event_parse':
Error: chip/esp32_wifi_utils.c:373:37: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
   memset(ap_list_buffer, 0x0, sizeof(ap_list_buffer));
                                     ^

stdio/lib_fputs.c: In function 'fputs':
Error: stdio/lib_fputs.c:99:9: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s == NULL || stream == NULL)
         ^
Error: stdio/lib_fputs.c:99:27: error: nonnull argument 'stream' compared to NULL [-Werror=nonnull-compare]
   if (s == NULL || stream == NULL)
                           ^

stdio/lib_vfprintf.c: In function 'vfprintf':
Error: stdio/lib_vfprintf.c:40:6: error: nonnull argument 'stream' compared to NULL [-Werror=nonnull-compare]
   if (stream)
      ^

string/lib_strdup.c: In function 'strdup':
Error: string/lib_strdup.c:39:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

string/lib_strndup.c: In function 'strndup':
Error: string/lib_strndup.c:56:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

string/lib_strpbrk.c: In function 'strpbrk':
Error: string/lib_strpbrk.c:39:7: error: nonnull argument 'str' compared to NULL [-Werror=nonnull-compare]
   if (!str || !charset)
       ^~~~
Error: string/lib_strpbrk.c:39:15: error: nonnull argument 'charset' compared to NULL [-Werror=nonnull-compare]
   if (!str || !charset)
               ^~~~~~~~

string/lib_strrchr.c: In function 'strrchr':
Error: string/lib_strrchr.c:40:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^

Error: time/lib_asctimer.c:73:50: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 12 [-Werror=format-truncation=]
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
                                                  ^~
time/lib_asctimer.c:73:21: note: directive argument in the range [-2147481748, 2147483647]
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
time/lib_asctimer.c:73:3: note: 'snprintf' output between 17 and 68 bytes into a destination of size 26
   snprintf(buf, 26, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            g_wday_name[tp->tm_wday], g_mon_name[tp->tm_mon],
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec,
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            1900 + tp->tm_year);
            ~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-02 15:55:38 +08:00
..
Kconfig docs and comments: Update stale references to COPYING 2021-04-01 21:10:56 -05:00
lib_explicit_bzero.c libs: libc: Haltian Ltd: update licenses to Apache 2021-11-15 06:49:32 -06:00
lib_ffs.c
lib_ffsl.c
lib_ffsll.c
lib_fls.c libs: libc: Haltian Ltd: update licenses to Apache 2021-11-15 06:49:32 -06:00
lib_flsl.c libs: libc: Haltian Ltd: update licenses to Apache 2021-11-15 06:49:32 -06:00
lib_flsll.c libs: libc: Haltian Ltd: update licenses to Apache 2021-11-15 06:49:32 -06:00
lib_index.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_isbasedigit.c
lib_memccpy.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_memchr.c Fix -Werror=nonnull-compare and -Werror=format-truncation= 2022-03-02 15:55:38 +08:00
lib_memcmp.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_memcpy.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_memmove.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_memrchr.c sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
lib_memset.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_popcount.c
lib_popcountl.c
lib_popcountll.c
lib_rindex.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_skipspace.c
lib_stpcpy.c sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
lib_stpncpy.c
lib_strcasecmp.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strcasestr.c
lib_strcat.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strchr.c Fix -Werror=nonnull-compare and -Werror=format-truncation= 2022-03-02 15:55:38 +08:00
lib_strchrnul.c libc/string: add lib_strchrnul. 2021-09-22 09:20:06 -03:00
lib_strcmp.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strcoll.c
lib_strcpy.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strcspn.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strdup.c Fix -Werror=nonnull-compare and -Werror=format-truncation= 2022-03-02 15:55:38 +08:00
lib_strerror.c
lib_strerrorr.c
lib_strlcat.c libc/str:add strlcat to libc 2021-11-26 15:24:35 -03:00
lib_strlcpy.c
lib_strlen.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strncasecmp.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strncat.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strncmp.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strncpy.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strndup.c Fix -Werror=nonnull-compare and -Werror=format-truncation= 2022-03-02 15:55:38 +08:00
lib_strnlen.c libs: libc: update licenses to Apache 2021-05-27 08:07:25 +09:00
lib_strpbrk.c Fix -Werror=nonnull-compare and -Werror=format-truncation= 2022-03-02 15:55:38 +08:00
lib_strrchr.c Fix -Werror=nonnull-compare and -Werror=format-truncation= 2022-03-02 15:55:38 +08:00
lib_strsep.c
lib_strsignal.c
lib_strspn.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strstr.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strtok.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_strtokr.c libs: Gregory Nutt: update licenses to Apache 2021-04-02 11:12:25 -05:00
lib_strxfrm.c
lib_vikmemcpy.c libs: libc: lib_vikmemcpy.c: Mixed case identifier fix 2021-04-02 11:12:25 -05:00
Make.defs libs/lbc: remove CHAR_BIT = 16 support 2021-12-13 11:08:28 -06:00