mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] tools/nolibc: fix standard conformance of a few string functions
@ 2026-11-25 18:14 Arav Verma
  2026-11-25 18:14 ` [PATCH 1/3] tools/nolibc: fix strchr() and strrchr() for the NUL terminator Arav Verma
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arav Verma @ 2026-11-25 18:14 UTC (permalink / raw)
  To: w, linux; +Cc: shuah, linux-kernel, linux-kselftest

A few nolibc functions deviate from the C standard in corner cases:
strchr()/strrchr() do not find the terminating NUL, strstr() returns
NULL for an empty needle, and atoi()/atol() do not skip leading
whitespace or accept a '+' sign.

Fix them and add test cases. The new tests fail without the fixes. The
results were also compared against glibc.

Arav Verma (3):
  tools/nolibc: fix strchr() and strrchr() for the NUL terminator
  tools/nolibc: fix strstr() with an empty needle
  tools/nolibc: make atoi() and atol() skip whitespace and accept '+'

 tools/include/nolibc/stdlib.h                |  5 +++++
 tools/include/nolibc/string.h                | 12 +++++-------
 tools/testing/selftests/nolibc/nolibc-test.c |  9 +++++++++
 3 files changed, 19 insertions(+), 7 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-25 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 18:14 [PATCH 0/3] tools/nolibc: fix standard conformance of a few string functions Arav Verma
2026-11-25 18:14 ` [PATCH 1/3] tools/nolibc: fix strchr() and strrchr() for the NUL terminator Arav Verma
2026-11-25 18:14 ` [PATCH 2/3] tools/nolibc: fix strstr() with an empty needle Arav Verma
2026-11-25 18:14 ` [PATCH 3/3] tools/nolibc: make atoi() and atol() skip whitespace and accept '+' Arav Verma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®