[PATCH 09/15] stdio-common: Fix buffer overrun in scanf input specifier tests [BZ #32857]

Maciej W. Rozycki macro@redhat.com
Tue Apr 29 20:37:05 GMT 2025


On Sat, 19 Apr 2025, Maciej W. Rozycki wrote:

> Fix a memory allocation issue not taking the terminating null character 
> into account causing a buffer overrun in 'read_real' with NaN reference 
> input using 'n-char-sequence' of a length matching the amount allocated, 
> such as:
> 
> %a:nan():1:5:nan(01234567890123456789012345678901):
> 
> analogously to what 'scanf_under_test' does for 'sscanf' and 'vsscanf'.
> 
> No test case added as it's a test case issue in the first place.
> ---

 I'm going to drop this change (and update 10/15 and subsequent changes 
accordingly) from this patch series as I have realised it's made redundant 
by 10/15, because unlike with 'scanf_under_test' code referred there's no 
fall-through exit path from this loop here, and with 10/15 in place memory
allocation will have been extended at `)' time if not sufficient for the 
next character, including the terminating null character in particular.

 I won't post v2 of the patchset right now though as I think it's a minor 
update and I'd like to collect feedback on the other changes first.

  Maciej



More information about the Libc-alpha mailing list