mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: musl 1.1.13 released
Date: Tue, 16 Feb 2016 22:16:23 -0500	[thread overview]
Message-ID: <20160217031623.GC9349@brightrain.aerifal.cx> (raw)
In-Reply-To: <20160216043528.GA27058@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 1537 bytes --]

On Mon, Feb 15, 2016 at 11:35:28PM -0500, Rich Felker wrote:
> This release adds support for out-of-tree builds, search domains in
> resolv.conf, VDSO-accelerated clock_gettime on MIPS, and building
> SMP-safe/ready SH binaries for the open-hardware J2. Performance of
> atomics and synchronization primitives has been greatly improved on
> most "ll/sc model" RISC archs. Regex BRE now supports the widely-used
> extensions \|, \+, and \? and larger regular expressions are now
> supported. A number of minor application and toolchain compatibility
> improvements have also been made, including changes which reduce the
> risk of assembler and linker bugs leading to malfunctioning binaries.
> 
> Two potentially dangerous bugs have been fixed: a single-byte heap
> overflow in getdelim and a pointer indexing error in dynamic TLS
> allocation. Other bugs fixed include various issues in parsing and
> error handling for resolv.conf and related files, incorrect error
> return values for some functions, and failures to accept null pointer
> arguments in some functions for which they have defined behavior. Some
> arch-specific bugs affecting ARM, MIPS, and SH/FDPIC have also been
> fixed.
> 
> http://www.musl-libc.org/releases/musl-1.1.13.tar.gz
> http://www.musl-libc.org/releases/musl-1.1.13.tar.gz.asc

It's been found that this release has a fairly significant regression
caused by fixing a bug in fwrite's return value. Users should apply
the attached patch to avoid problems with puts("") and fputs("",f)
malfunctioning.

Rich

[-- Attachment #2: 0001-fix-assumption-in-fputs-that-fwrite-returning-0-impl.patch --]
[-- Type: text/plain, Size: 1136 bytes --]

From 10a17dfbad2c267d885817abc9c7589fc7ff630b Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Tue, 16 Feb 2016 13:26:16 -0500
Subject: [PATCH] fix assumption in fputs that fwrite returning 0 implies an
 error

internally, the idiom of passing nmemb=1 to fwrite and interpreting
the return value of fwrite (which is necessarily 0 or 1) as
failure/success is fairly widely used. this is not correct, however,
when the size argument is unknown and may be zero, since C requires
fwrite to return 0 in that special case. previously fwrite always
returned nmemb on success, but this was changed for conformance with
ISO C by commit 500c6886c654fd45e4926990fee2c61d816be197.
---
 src/stdio/fputs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/stdio/fputs.c b/src/stdio/fputs.c
index 4737f44..1cf344f 100644
--- a/src/stdio/fputs.c
+++ b/src/stdio/fputs.c
@@ -3,7 +3,8 @@
 
 int fputs(const char *restrict s, FILE *restrict f)
 {
-	return (int)fwrite(s, strlen(s), 1, f) - 1;
+	size_t l = strlen(s);
+	return (fwrite(s, 1, l, f)==l) - 1;
 }
 
 weak_alias(fputs, fputs_unlocked);
-- 
1.8.1.rc1


  reply	other threads:[~2016-02-17  3:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16  4:35 Rich Felker
2016-02-17  3:16 ` Rich Felker [this message]
2016-02-19 10:22   ` Anthony G. Basile
2016-02-19 17:24     ` Shiz
2016-02-19 17:57       ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160217031623.GC9349@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).