Public bug reported: The man page OPEN_MEMSTREAM(3) says, the buffer and size are updated each time fflush and fclose are called and that a null byte is maintained at the end of the buffer. The attached c program shows an unexpected difference between fflush and fclose if you write to a memstream and seek to the begin of the stream using fseek. Fflush doesn't add a new null byte but fclose does.
ProblemType: Bug DistroRelease: Ubuntu 21.10 Package: libc6 2.34-0ubuntu3 ProcVersionSignature: Ubuntu 5.13.0-28.31-generic 5.13.19 Uname: Linux 5.13.0-28-generic x86_64 ApportVersion: 2.20.11-0ubuntu71 Architecture: amd64 CasperMD5CheckResult: unknown CurrentDesktop: ubuntu:GNOME Date: Mon Feb 7 10:47:19 2022 InstallationDate: Installed on 2021-03-27 (316 days ago) InstallationMedia: Ubuntu 20.04.2.0 LTS "Focal Fossa" - Release amd64 (20210209.1) ProcEnviron: TERM=xterm-256color PATH=(custom, no user) XDG_RUNTIME_DIR=<set> LANG=de_DE.UTF-8 SHELL=/bin/bash SourcePackage: glibc UpgradeStatus: Upgraded to impish on 2021-10-18 (111 days ago) ** Affects: glibc (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug impish ** Attachment added: "The bug can be reproduced using this program" https://bugs.launchpad.net/bugs/1960210/+attachment/5559520/+files/openMemstreamBug.c -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1960210 Title: memstream does not add '\0' to buffer using fseek and fflush To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1960210/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs