From owner-svn-src-all@freebsd.org Tue Feb 16 00:15:34 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C6ECAAADEC for ; Tue, 16 Feb 2016 00:15:34 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm19-vm0.bullet.mail.bf1.yahoo.com (nm19-vm0.bullet.mail.bf1.yahoo.com [98.139.213.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5794917B1 for ; Tue, 16 Feb 2016 00:15:34 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1455581726; bh=ZWQEMoQ7aflgyYxFneoihjaw6b2V/Zsb4ErV2XIiWas=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=euTi7fVKMda/jupfYNoWR5lYk9YBeDk7xjJaUqjmg7WjD7+i/ex9+hiVK4vEfM3PT0O7JSBs8i7LDh4i5NGU/yM7Dfk/M3o+q4GD5fkzaSNtachkkUY9Vcl+HV8QLgK0Jw699qg4DXIRk1c+C2AkiWT/cULO+nXHaAWqNMYbLRYLKrc4GTkzy1c4PZVl8tpSM4PVoQ7yo/P8RcVeTSK7ujLiw6x8PnIsOlTQHwf12voib4TprmBcK3ny2CkZ0RbP5To/5R542aUMqsg0VSry4tothKp69KWQVXyMf7kw+57KYe8wWZ7s9whrtf7TSk+q944CevfpcmaB5GrLvgDE3g== Received: from [66.196.81.174] by nm19.bullet.mail.bf1.yahoo.com with NNFMP; 16 Feb 2016 00:15:26 -0000 Received: from [98.139.213.10] by tm20.bullet.mail.bf1.yahoo.com with NNFMP; 16 Feb 2016 00:15:26 -0000 Received: from [127.0.0.1] by smtp110.mail.bf1.yahoo.com with NNFMP; 16 Feb 2016 00:15:26 -0000 X-Yahoo-Newman-Id: 256945.67497.bm@smtp110.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: hycdT.AVM1mYn6usmXFfRlcG6Zq5O_gQendZCK2xEqVyzpW __Dekd4dqO_1osFglJ2QL9Luqjpnmjdvm8FNKathyX.tt5loLGgFfThdFcNn xWZj9_S97yYFuZLONK.1sdTZTLUQuiMNehY_.NonqQbj5xMEj2hO7SqPHMoi aXyLZH99cbJjGzle8vjCXEprMLPHYuV1wSP631wBNwzGIHwIFbRXhb0PMKhw 2VNlLWzZaFqqOOy3NQ_Nf6dC.68Ly70zxwZiqASS.uPo6OlF3eyoyqrkoP1. 5T5dhz8Amxco50c.a34MV6wK4gjjgo9ip0HGpzzx2DSr1mASIL2ZPq.Qu7rD 5vj9h6t47uU7TAc9g5puf2x.xRMlymkeDIJZKZ.sS9Y5dNBVxhSbRYCMkXze zrPIIjtfg8uIKntqGQwSWPsmsJKIO2LFTIqBjlhLtA2PerxZNMCHx6xbXx8b ctG0QDn7Mlw9I98pG8UHZIzbooj.jStP0Lrq3UQCJY.9o0hJXP81p0Lf.c7x 6KTaGl4TwXGSgiftHsjfGt.qGIdfo8Z4i X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r295631 - head/lib/libc/stdio To: cem@FreeBSD.org References: <201602151813.u1FIDXAt067326@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <56C26A34.1000300@FreeBSD.org> Date: Mon, 15 Feb 2016 19:15:48 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2016 00:15:34 -0000 On 02/15/16 13:32, Conrad Meyer wrote: > On Mon, Feb 15, 2016 at 10:13 AM, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Mon Feb 15 18:13:33 2016 >> New Revision: 295631 >> URL: https://svnweb.freebsd.org/changeset/base/295631 >> ... >> Note that this implementation convention cannot be adhered to for strings >> longer than {INT_MAX} bytes as the value would not be representable in the >> return type of the function. For backwards-compatibility, implementations >> can return the number of bytes for strings of up to {INT_MAX} bytes, and >> return {INT_MAX} for all longer strings. >> ... >> --- head/lib/libc/stdio/fputs.c Mon Feb 15 17:14:10 2016 (r295630) >> +++ head/lib/libc/stdio/fputs.c Mon Feb 15 18:13:33 2016 (r295631) >> ... >> @@ -62,5 +63,7 @@ fputs(const char * __restrict s, FILE * >> ORIENT(fp, -1); >> retval = __sfvwrite(fp, &uio); >> FUNLOCKFILE(fp); >> + if (retval == 0) >> + return (iov.iov_len > INT_MAX ? INT_MAX : uio.uio_resid); > > ^^^^^^^^^^^ why not uio.uio_resid here as well? > Because uio.ui_resid is an int and it's likely to overflow before it keeps a useful value for that comparison, Of course, as Bruce noted, __sfwrite modifies uio so uio.uio_resid doesn't belong there at all. Hmm... we need some fputs() tests in the testsuite. Pedro.