walnux/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 libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_aligned_alloc.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_atexit.c libc: Move on_exit and __cxa_atexit in lib_atexit.c 2023-01-25 14:31:37 +02:00
lib_atof.c libc: Refine the inline handling 2020-07-04 11:10:29 +09:00
lib_atoi.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_atol.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_atoll.c libc: Refine the inline handling 2020-07-04 11:10:29 +09:00
lib_bsearch.c
lib_checkbase.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_div.c Fix various typos in comments and documentation 2021-07-04 11:23:26 -05:00
lib_exit.c sched/tls: remove PTHREAD_CLEANUP from Kconfig 2023-06-14 12:00:48 +08:00
lib_getprogname.c libc: Add getprogname function 2021-12-15 10:47:56 -06:00
lib_itoa.c libs: fix nxstyle errors 2021-04-02 11:12:25 -05:00
lib_labs.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_ldiv.c Fix various typos in comments and documentation 2021-07-04 11:23:26 -05:00
lib_llabs.c libs: nxstyle fixes 2021-03-03 18:52:53 -08:00
lib_lldiv.c Fix various typos in comments and documentation 2021-07-04 11:23:26 -05:00
lib_mblen.c libc/wchar: remove unnecessary config 2022-07-27 00:36:49 +08:00
lib_mbstowcs.c libc/wchar: remove unnecessary config 2022-07-27 00:36:49 +08:00
lib_mbtowc.c libc/wchar: support wchar 2022-07-27 00:36:49 +08:00
lib_mkdtemp.c libs/libc/stdlib: Implement mkdtemp(3) syscall 2020-09-19 04:16:14 -07:00
lib_mkstemp.c libs/libc/stdio: correct the prototype of mktemp(3) 2020-09-19 04:16:14 -07:00
lib_mktemp.c Replace nxsem API when used as a lock with nxmutex API 2022-10-17 15:59:46 +09:00
lib_openpty.c change strcpy to strlcpy 2023-02-24 12:15:40 +08:00
lib_posix_memalign.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_ptsname.c libc/pty: Make ptsname[_r] support PSEUDOTERM_BSD config too 2021-05-07 16:35:20 -03:00
lib_ptsnamer.c libc/pty: Make ptsname[_r] support PSEUDOTERM_BSD config too 2021-05-07 16:35:20 -03:00
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_rand.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_rand48.c stdlib: generate uniformly distributed pseudo-random numbers 2023-01-04 20:53:05 +08:00
lib_realpath.c libc: Don't duplicate string in chdir and lib_restoredir 2022-04-18 10:36:36 +03:00
lib_srand.c Rename LIB_ to LIBC_ for all libc Kconfig 2021-08-05 19:45:24 +02:00
lib_strtol.c libs: Gregory Nutt: update licenses to Apache 2021-04-02 11:12:25 -05:00
lib_strtold.c fix a bug of strtof 2023-02-22 01:20:21 +08:00
lib_strtoll.c libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
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 libs: Author Gregory Nutt: update licenses to Apache 2021-03-03 18:52:53 -08:00
lib_valloc.c add #undef for some libc function 2021-07-14 15:09:58 -03:00
lib_wcstombs.c libc/wchar: remove unnecessary config 2022-07-27 00:36:49 +08:00
lib_wctomb.c libc/wchar: support wchar 2022-07-27 00:36:49 +08:00
Make.defs Remove the tail spaces from all files except Documentation 2023-02-26 13:24:24 -08:00