Commit Graph

13 Commits (80dbb6da15ab5eb348f5d76049dabd03be5bdd67)

Author SHA1 Message Date
Daniele Lacamera d4cf395dc2 F-14269: print %u as unsigned in the 32-bit printf path
The u/i/d conversions shared one branch that read the argument as int
and ran it through the signed decimal path of uart_writenum, so %u
values >= 2^31 printed as negative numbers (0xFFFFFFFF became -1).
Read %u as unsigned int and add an is_signed parameter to
uart_writenum so the sign handling applies only to d/i, matching the
is_negative design of the 64-bit helper.
2026-09-29 08:47:18 +02:00
Daniele Lacamera 0702a6123c F-11048: clamp negative '*' field widths in uart_vprintf
A negative '*' width passed the upper-bound-only clamp and reached
the zero-pad memset as a huge size_t (stack overflow). Clamp to zero
at the parser, the single source of dynamic widths; the existing
zero-to-8 default then applies.

New test test_uart_printf_negative_star_width covers %0*x and
%0*llu; SIGSEGV pre-fix, green post-fix. Full unit suite green.
2026-09-24 09:06:32 +02:00
Daniele Lacamera d6926a7c1f F-11030: consume long/size_t/pointer args at full width in uart_vprintf
The UART formatter recognized 'l' and 'z' length modifiers and %p,
but still consumed the argument as int, truncating long, size_t and
pointers on 64-bit targets (undefined behavior). Track the 'z'
modifier and, where PRINTF_LONG_LONG is enabled, consume long /
unsigned long / void * and format through the 64-bit
uart_writenum_ll() path; the 32-bit path is unchanged (long == int
width there).

New test test_uart_printf_64bit_args covers %ld, %lu, %zu, %p, %lx
with values past 32 bits plus %lld and %d regressions; fails
pre-fix (truncated output), green post-fix. 32-bit compile of
string.c verified with -m32 -Wall -Wextra.
2026-09-24 09:04:29 +02:00
Daniele Lacamera 776378ca78 Preparing release v2.8.0 + update copyright 2026-04-16 13:11:56 +02:00
Daniele Lacamera eca76efcc5 string: fix unaligned backward word copies 2026-04-09 17:44:26 +02:00
Daniele Lacamera 040bcdb00d unit-tests: skip large memmove under coverage 2026-04-09 06:23:40 +02:00
Daniele Lacamera 62f6eca694 unit-tests: avoid gcov memmove timeout 2026-04-08 22:22:19 +02:00
Daniele Lacamera e22eade623 fix memmove large-length backward copy
F/1897
2026-04-08 19:53:50 +02:00
Daniele Lacamera 0a8e95f787 strings.c: enforce null-termination on strncpy, optimize strcat
F/439
F/440
2026-03-12 09:28:51 +01:00
Paul Adelsbach 260a78e5e3 Fix string compare functions 2026-03-06 19:25:07 +01:00
Daniele Lacamera 2244688d70 Renamed function as suggested by copilot 2026-02-23 21:03:52 +01:00
Daniele Lacamera 6a5762d241 Addressed copilot review comments
- Converted 'strncat' to the standard POSIX behavior. Fixed fdt-parser
  to use the right len argument.
2026-02-23 21:03:52 +01:00
Daniele Lacamera 25ae592093 Fix strncasecmp bounds and alpha-only case folding
+ Added unit tests for string.c
2026-02-23 21:03:35 +01:00