memstream does not add '\0' to buffer using fseek and fflush
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
glibc (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
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
ProcVersionSign
Uname: Linux 5.13.0-28-generic x86_64
ApportVersion: 2.20.11-0ubuntu71
Architecture: amd64
CasperMD5CheckR
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-
PATH=(custom, no user)
XDG_RUNTIME_
LANG=de_DE.UTF-8
SHELL=/bin/bash
SourcePackage: glibc
UpgradeStatus: Upgraded to impish on 2021-10-18 (111 days ago)