PythonExtra/shared/libc
Jim Mussared 9be0623d4c shared/libc/string0: Don't deref args for n==0 case.
C99 says that strncmp has UB for either string being NULL, so the
current behavior is technically correct, but it's an easy fix to handle
this case correctly.

7.1.4: "unless explicitly stated otherwise in the detailed
description... if an argument to a function has ...null pointer.. the
behavior is undefined".

7.21.1: "Unless explicitly stated otherwise in the description of a
particular function in this subclause, pointer arguments on such a call
shall still have valid values, as described in 7.1.4".

Also make the same change for the minimal version in bare-arm/lib.c.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-11-07 16:01:50 +11:00
..
__errno.c shared: Introduce new top-level dir and move 1st party lib code there. 2021-07-12 17:07:36 +10:00
abort_.c shared: Introduce new top-level dir and move 1st party lib code there. 2021-07-12 17:07:36 +10:00
printf.c shared/libc/printf: Fix stdout destination for putchar and puts. 2023-05-31 16:08:44 +10:00
string0.c shared/libc/string0: Don't deref args for n==0 case. 2023-11-07 16:01:50 +11:00