nuttx/libs/libc/stdlib
Sunny 2a5f48c3fd libs/libc/stdlib: fix strtoul,strtoull bugs when value outside range
Prototype:
  unsigned long strtoul(FAR const char *nptr, FAR char **endptr, int base);
  unsigned long long strtoull(FAR const char *nptr,  FAR char **endptr, int base);

If endptr is not NULL, strtoul()/strtoull() should store the address of the first
invalid character in *endptr. And if the correct value is outside the range of
representable values, {ULONG_MAX} or {ULLONG_MAX} shall be returned and errno set
to [ERANGE].

With such code:
  strtoul("34592348345343453453455645765736575865767", &endptr, 10);

It indeed returns ULONG_MAX and sets errno to ERANGE. But after strtoul
return, endptr points to "3455645765736575865767", not NULL.

Signed-off-by: Sunny <zxcvbnm37425@gmail.com>
2023-07-10 19:07:27 +03:00
..
CMakeLists.txt build: add initial cmake build system 2023-07-08 13:50:48 +08:00
Kconfig libs\libc\stdlib\Kconfig: Fix indentation 2023-05-18 15:43:22 +03:00
lib_abort.c lib_abort.c: Change call to userspace exit() into syscall _exit() 2023-02-22 01:10:39 +08:00
lib_abs.c
lib_aligned_alloc.c
lib_atexit.c
lib_atof.c
lib_atoi.c
lib_atol.c
lib_atoll.c
lib_bsearch.c
lib_checkbase.c
lib_div.c
lib_exit.c sched/tls: remove PTHREAD_CLEANUP from Kconfig 2023-06-14 12:00:48 +08:00
lib_getprogname.c
lib_itoa.c
lib_labs.c
lib_ldiv.c
lib_llabs.c
lib_lldiv.c
lib_mblen.c
lib_mbstowcs.c
lib_mbtowc.c
lib_mkdtemp.c
lib_mkstemp.c
lib_mktemp.c
lib_openpty.c change strcpy to strlcpy 2023-02-24 12:15:40 +08:00
lib_posix_memalign.c
lib_ptsname.c
lib_ptsnamer.c
lib_qsort.c libc/qsort: fix invalid-pointer-pair if enable detect_invalid_pointer_pairs=2 2023-05-08 13:43:28 +02:00
lib_rand48.c
lib_rand.c
lib_realpath.c
lib_srand.c
lib_strtol.c
lib_strtold.c fix a bug of strtof 2023-02-22 01:20:21 +08:00
lib_strtoll.c
lib_strtoul.c libs/libc/stdlib: fix strtoul,strtoull bugs when value outside range 2023-07-10 19:07:27 +03:00
lib_strtoull.c libs/libc/stdlib: fix strtoul,strtoull bugs when value outside range 2023-07-10 19:07:27 +03:00
lib_unlockpt.c
lib_valloc.c
lib_wcstombs.c
lib_wctomb.c
Make.defs Remove the tail spaces from all files except Documentation 2023-02-26 13:24:24 -08:00