[Bug stdio/28038] getdelim()/getline() does not add NUL terminator if first character is EOF.
collin.funk1 at gmail dot com
sourceware-bugzilla@sourceware.org
Fri Oct 10 02:11:09 GMT 2025
https://sourceware.org/bugzilla/show_bug.cgi?id=28038
Collin Funk <collin.funk1 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |2.43
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Collin Funk <collin.funk1 at gmail dot com> ---
Thanks for the report. Fixed for glibc 2.43 with the following commit:
commit 33eff78c8b28adc4963987880e10d96761f2a167
Author: Collin Funk <collin.funk1@gmail.com>
AuthorDate: Wed Oct 8 20:10:44 2025 -0700
Commit: Collin Funk <collin.funk1@gmail.com>
CommitDate: Thu Oct 9 17:38:01 2025 -0700
libio: Add terminating NUL when the first character is EOF in getdelim [BZ
#28038]
POSIX requires that the buffer used by getdelim/getline add a
terminating NUL whenever an EOF is read.
* libio/iogetdelim.c (__getdelim): Add a NUL byte when the first
__underflow is called.
* libio/tst-getdelim.c (do_test): Add a test case for the bug.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list