From nobody@FreeBSD.org  Mon Apr 18 11:44:16 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5C0C416A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Apr 2005 11:44:16 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 41E2543D55
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Apr 2005 11:44:16 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j3IBiFAd022504
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Apr 2005 11:44:15 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j3IBiFnM022503;
	Mon, 18 Apr 2005 11:44:15 GMT
	(envelope-from nobody)
Message-Id: <200504181144.j3IBiFnM022503@www.freebsd.org>
Date: Mon, 18 Apr 2005 11:44:15 GMT
From: Elmar Bartel <elmar@devsoft.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Incorrect use of strlcat
X-Send-Pr-Version: www-2.3

>Number:         80064
>Category:       bin
>Synopsis:       Incorrect use of strlcat
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    imp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 18 11:50:22 GMT 2005
>Closed-Date:    Mon Apr 18 09:09:40 MDT 2005
>Last-Modified:  Mon Apr 18 09:09:40 MDT 2005
>Originator:     Elmar Bartel
>Release:        5.2
>Organization:
leo.org
>Environment:
FreeBSD pegasus.devsoft.com 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Sat Oct  2 14:17:47 CEST 2004     elmar@pegasus.devsoft.com:/usr/src/sys/i386/compile/PEGASUS  i386
>Description:
      Version 1.34 of /usr/src/sbin/dump/main.c changed the call of strncat to strlcat, but it didn't change the size parameter: Version 1.33 used (line 602)
      (void)strncat(rawbuf, "/r", MAXPATHLEN - 1 - strlen(rawbuf));
      (void)strncat(rawbuf, dp + 1, MAXPATHLEN - 1 - strlen(rawbuf));
Now it reads:
      (void)strlcat(rawbuf, "/r", MAXPATHLEN - 1 - strlen(rawbuf));
      (void)strlcat(rawbuf, dp + 1, MAXPATHLEN - 1 - strlen(rawbuf));
>How-To-Repeat:
      Nothing to repeat
>Fix:
      Change the lines in question to:

      (void)strlcat(rawbuf, "/r", MAXPATHLEN);
      (void)strlcat(rawbuf, dp + 1, MAXPATHLEN);

And also the line with strlcpy (3 line previously) could be changed:

      (void)strlcpy(rawbuf, cp, MAXPATHLEN);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->imp 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Mon Apr 18 12:01:14 GMT 2005 
Responsible-Changed-Why:  
Looks reasonble. Pass to author of 1.34. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80064 
State-Changed-From-To: open->closed 
State-Changed-By: imp 
State-Changed-When: Mon Apr 18 09:08:56 MDT 2005 
State-Changed-Why:  
OBE: The function that used the incorrectly had bigger problems: 
namely it was trying to access devices that cannot exist on FreeBSD. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=80064 
>Unformatted:
