nuttx/libs/libc/stdio
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 Simplify DEFAULT_SMALL usage in Kconfig 2022-03-01 03:15:01 +08:00
lib_asprintf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_clearerr.c stdio/lib_clearerr: Did not clear stream buffer flags in clearerr 2021-03-17 03:15:17 -07:00
lib_dprintf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_dtoa_data.c libs/libc/stdio: replace double_t to double 2020-09-15 14:42:36 +08:00
lib_dtoa_engine.c Remove the unnecessary math.h inclusion 2021-04-12 22:58:23 -04:00
lib_dtoa_engine.h Remove the unnecessary math.h inclusion 2021-04-12 22:58:23 -04:00
lib_fclose.c libc/misc: Add lib_ prefix to stream_semtake and tream_semgive 2021-11-02 09:00:11 +01:00
lib_feof.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_ferror.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_fflush.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_fgetc.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_fgetpos.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_fgets.c libc/gets: Remove the unnecessary cast 2021-11-27 16:07:39 -03:00
lib_fileno.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_fopen.c fs: Don't call _NX_SETERRNO in fopen and fdopen 2021-02-21 12:40:43 +00:00
lib_fprintf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_fputc.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_fputs.c Fix -Werror=nonnull-compare and -Werror=format-truncation= 2022-03-02 15:55:38 +08:00
lib_fread.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_freopen.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_fscanf.c NuttX: Johannes Schock: update licenses to Apache 2021-04-01 12:13:12 -05:00
lib_fseek.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_fseeko.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_fsetpos.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_ftell.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_ftello.c lib/stdio: Handle 64bits off_t correctly 2021-11-18 10:06:27 -05:00
lib_fwrite.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_getc.c libc: Refine the inline handling 2020-07-04 11:10:29 +09:00
lib_getchar.c libc: Make perror/putchar/getchar/puts work without CONFIG_FILE_STREAM 2021-11-18 06:29:09 -08:00
lib_getdelim.c fs/vfs: Add file descriptor based timers support 2021-12-20 04:00:20 -06:00
lib_gets_s.c libc/gets: Remove the unnecessary cast 2021-11-27 16:07:39 -03:00
lib_gets.c libc/gets: Remove the unnecessary cast 2021-11-27 16:07:39 -03:00
lib_libdtoa.c libs/libc/stdio: replace double_t to double 2020-09-15 14:42:36 +08:00
lib_libfflush.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_libfgets.c lib_fgets: don't check for printability, as it doesn't allow to work with extended ASCII 2021-04-07 08:29:46 -03:00
lib_libfilesem.c libc: Move lib_filesem.c and lib_stream.c to libc/stdio 2021-11-02 09:00:11 +01:00
lib_libflushall.c libc/misc: Add lib_ prefix to stream_semtake and tream_semgive 2021-11-02 09:00:11 +01:00
lib_libfread.c lib_fread: return the number of bytes actually read when error occurs. 2021-09-12 11:36:03 +08:00
lib_libfwrite.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_libsprintf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_libstream.c libc: Move lib_filesem.c and lib_stream.c to libc/stdio 2021-11-02 09:00:11 +01:00
lib_libvscanf.c Remove the unnecessary math.h inclusion 2021-04-12 22:58:23 -04:00
lib_libvsprintf.c libs/printf: add support for print symbol name 2021-12-13 08:31:13 -06:00
lib_perror.c libc: Make perror/putchar/getchar/puts work without CONFIG_FILE_STREAM 2021-11-18 06:29:09 -08:00
lib_printf.c libc/stdio: Allocate file_struct dynamically 2020-09-11 17:58:17 +08:00
lib_putc.c libc: Refine the inline handling 2020-07-04 11:10:29 +09:00
lib_putchar.c libc: Make perror/putchar/getchar/puts work without CONFIG_FILE_STREAM 2021-11-18 06:29:09 -08:00
lib_puts.c libc: Make perror/putchar/getchar/puts work without CONFIG_FILE_STREAM 2021-11-18 06:29:09 -08:00
lib_rdflush.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_remove.c libs: Author Sebastien Lorquet: update licenses to Apache 2021-03-20 19:22:58 -07:00
lib_rewind.c rewind: clear the error indicator 2020-06-24 16:56:44 +08:00
lib_scanf.c NuttX: Johannes Schock: update licenses to Apache 2021-04-01 12:13:12 -05:00
lib_setbuf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_setvbuf.c Fix typos in comments and Kconfig files 2021-12-21 03:26:16 -06:00
lib_snprintf.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_sprintf.c libc/stdio: Move source files to the right Makefile section 2021-11-19 08:21:27 -03:00
lib_sscanf.c NuttX: Johannes Schock: update licenses to Apache 2021-04-01 12:13:12 -05:00
lib_tempnam.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_tmpfile.c libc: tmpfile shouldn't hardcode the folder to /tmp 2020-06-03 07:46:02 -06:00
lib_tmpnam.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_ultoa_invert.c libs: fix nxstyle errors 2021-04-02 11:12:25 -05:00
lib_ultoa_invert.h libs/libc/stdio: Fix long long usage in all of the newer printf-related logic: The selection CONFIG_LIBC_LONG_LONG must be ignored if the architecture does not support long long types. 2019-06-03 08:45:57 -06:00
lib_ungetc.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_vasprintf.c lib/vasprintf: Shouldn't call va_end(ap) to avoid the double free 2021-10-11 16:39:44 -03:00
lib_vdprintf.c libs: fix nxstyle errors 2021-04-02 11:12:25 -05:00
lib_vfprintf.c Fix -Werror=nonnull-compare and -Werror=format-truncation= 2022-03-02 15:55:38 +08:00
lib_vfscanf.c libs: libc: update licenses to Apache 2021-05-27 08:07:25 +09:00
lib_vprintf.c libc/stdio: Allocate file_struct dynamically 2020-09-11 17:58:17 +08:00
lib_vscanf.c libc: Implement vscanf() function 2020-06-03 07:35:08 -06:00
lib_vsnprintf.c libs: Gregory Nutt: update licenses to Apache 2021-04-02 11:12:25 -05:00
lib_vsprintf.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_vsscanf.c sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
lib_wrflush.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
Make.defs libc: Move stream implementation from libs/libc/stdio to libs/libc/stream 2021-12-14 00:51:59 -06:00