From owner-freebsd-doc@FreeBSD.ORG Tue Jul 23 21:10:03 2013 Return-Path: Delivered-To: freebsd-doc@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 26164FDC for ; Tue, 23 Jul 2013 21:10:03 +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 17F792568 for ; Tue, 23 Jul 2013 21:10:03 +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 r6NLA2oB093329 for ; Tue, 23 Jul 2013 21:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r6NLA2Xv093328; Tue, 23 Jul 2013 21:10:02 GMT (envelope-from gnats) Date: Tue, 23 Jul 2013 21:10:02 GMT Message-Id: <201307232110.r6NLA2Xv093328@freefall.freebsd.org> To: freebsd-doc@FreeBSD.org Cc: From: Benjamin Kaduk Subject: Re: 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: Benjamin Kaduk List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jul 2013 21:10:03 -0000 The following reply was made to PR docs/180767; it has been noted by GNATS. From: Benjamin Kaduk To: bug-followup@freebsd.org Cc: Subject: Re: docs/180767: [man][libc] printf.3: fix off-by-one in snprintf description Date: Tue, 23 Jul 2013 17:07:02 -0400 (EDT) On Tue, 23 Jul 2013, Dmitry Marakasov wrote: > > >> 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). I think one could argue either way. The character with index (size-1) gets the NUL byte, but if one says that the first character is the one with index 0, then it is in fact the size'th character which receives the NUL. -Ben Kaduk