NetBSD Problem Report #52779

From kre@munnari.OZ.AU  Sun Dec  3 08:59:58 2017
Return-Path: <kre@munnari.OZ.AU>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D0FBA7A1E5
	for <gnats-bugs@www.NetBSD.org>; Sun,  3 Dec 2017 08:59:58 +0000 (UTC)
Message-Id: <201712030859.vB38xXl6011022@magnolia.noi.kre.to>
Date: Sun, 3 Dec 2017 15:59:33 +0700 (ICT)
From: kre@munnari.OZ.AU
To: gnats-bugs@www.NetBSD.org
Subject: strlcpy(3) omits important information (and is poor anyway)
X-Send-Pr-Version: 3.95

>Number:         52779
>Category:       lib
>Synopsis:       strlcpy(3) omits important information (and is poor anyway)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 03 09:00:00 +0000 2017
>Originator:     Robert Elz
>Release:        NetBSD 8.99.3
>Organization:
>Environment:
System: NetBSD magnolia.noi.kre.to 8.99.3 NetBSD 8.99.3 (MAGNOLIA-1.13-20170926) #43: Tue Sep 26 23:11:07 ICT 2017 kre@magnolia.noi.kre.to:/usr/obj/current/kernels/amd64/MAGNOLIA amd64
Architecture: x86_64
Machine: amd64
>Description:
	The man page for strlcpy(3) (and strncat(3) since it is the same one)
	makes no mention of whether overlapping buffer copies are safe or not.
	It should.

	That is, can a program do

		strlcpy(buf, buf+1, ...)
	or
		strlcpy(buf+1, buf, ...)
	or even
		strlcpy(buf, buf, ...)

	(probably not as blatantly as that, but where the src happens to
	have been computed as a pointer into the dest string.)

	Same for strlcat() obviously - though perhaps it might provide
	a more likely use scenario.

	Beyond that, the man pages have way too much of the "why I was
	so great as to create this new function" which doesn't belong at
	all, it should just say what the functions do, what the args are,
	what restrictions are placed upon them, and what the results will
	be (and if it seems needed, an example - or even two).

>How-To-Repeat:
	RTFM.

>Fix:
	Rewrite the man page.   Almost completely.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.