memstream does not add '\0' to buffer using fseek and fflush

Bug #1960210 reported by Jan Strater-Büddefeld
6
This bug affects 1 person
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
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)

Revision history for this message
Jan Strater-Büddefeld (jst-mbs) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.