[PATCH 0/3] tools/nolibc: fix standard conformance of a few string functions

From: Arav Verma

Date: Wed Nov 25 2026 - 13:15:05 EST


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