From owner-freebsd-doc@FreeBSD.ORG Tue Jul 23 15:10:00 2013 Return-Path: Delivered-To: freebsd-doc@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A13B73E1 for ; Tue, 23 Jul 2013 15:10:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 844652342 for ; Tue, 23 Jul 2013 15:10:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r6NFA0HR020495 for ; Tue, 23 Jul 2013 15:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r6NFA0WK020494; Tue, 23 Jul 2013 15:10:00 GMT (envelope-from gnats) Resent-Date: Tue, 23 Jul 2013 15:10:00 GMT Resent-Message-Id: <201307231510.r6NFA0WK020494@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-doc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dmitry Marakasov Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 24B40310 for ; Tue, 23 Jul 2013 15:07:06 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [92.53.116.43]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D984F2314 for ; Tue, 23 Jul 2013 15:07:05 +0000 (UTC) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1V1dvZ-00012p-Ba for FreeBSD-gnats-submit@freebsd.org; Tue, 23 Jul 2013 18:51:01 +0400 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id 89B8E955 for ; Tue, 23 Jul 2013 18:51:00 +0400 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id 67AF354E; Tue, 23 Jul 2013 18:51:00 +0400 (MSK) Message-Id: <20130723145100.67AF354E@hades.panopticon> Date: Tue, 23 Jul 2013 18:51:00 +0400 (MSK) From: Dmitry Marakasov To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: docs/180767: [man][libc] printf.3: fix off-by-one in snprintf description X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Dmitry Marakasov List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jul 2013 15:10:00 -0000 >Number: 180767 >Category: docs >Synopsis: [man][libc] printf.3: fix off-by-one in snprintf description >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Tue Jul 23 15:10:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Dmitry Marakasov >Release: FreeBSD 9.1-RELEASE-p4 amd64 >Organization: >Environment: System: FreeBSD hades.panopticon 9.1-RELEASE-p4 FreeBSD 9.1-RELEASE-p4 #0 r251956: Tue Jun 18 21:41:37 MSK 2013 root@hades.panopticon:/usr/obj/usr/src/sys/HADES amd64 >Description: printf(3) says for snprintf: The snprintf() and vsnprintf() functions will write at most size-1 of the characters printed into the output string (the size'th character then gets the terminating `\0'); the part in parenteses is incorrect: size'th character is outside buffer of [size] characters. It should instead say "(size-1)'th character" (which is last in the buffer). >How-To-Repeat: >Fix: --- printf.3.patch begins here --- Index: lib/libc/stdio/printf.3 =================================================================== --- lib/libc/stdio/printf.3 (revision 253572) +++ lib/libc/stdio/printf.3 (working copy) @@ -143,7 +143,7 @@ .Fa size Ns \-1 of the characters printed into the output string (the -.Fa size Ns 'th +.Fa ( size Ns \-1)'th character then gets the terminating .Ql \e0 ) ; if the return value is greater than or equal to the --- printf.3.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: