From nobody@FreeBSD.org  Fri Oct  7 14:34:40 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 B25A016A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  7 Oct 2005 14:34:40 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8248A43D46
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  7 Oct 2005 14:34:40 +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 j97EYegl085948
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 7 Oct 2005 14:34:40 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j97EYeXR085919;
	Fri, 7 Oct 2005 14:34:40 GMT
	(envelope-from nobody)
Message-Id: <200510071434.j97EYeXR085919@www.freebsd.org>
Date: Fri, 7 Oct 2005 14:34:40 GMT
From: "Olavi K." <olavi@ipunplugged.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Bug in crypto/openssh/openbsd-compat/bsd-misc.c::strdup()
X-Send-Pr-Version: www-2.3

>Number:         87067
>Category:       kern
>Synopsis:       Bug in crypto/openssh/openbsd-compat/bsd-misc.c::strdup()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 07 14:40:16 GMT 2005
>Closed-Date:    Sat Oct 08 12:59:43 GMT 2005
>Last-Modified:  Sat Oct 08 12:59:43 GMT 2005
>Originator:     Olavi K.
>Release:        FreeBSD 6.0-BETA5
>Organization:
Ipunplugged
>Environment:
>Description:
I accidently built libssh.so with an undefined HAVE_STRDUP thus causing libssh to use its built-in version of strdup.

The code looks as:
#ifndef HAVE_STRDUP
char *
strdup(const char *str)
{
        size_t len;
        char *cp;

        len = strlen(str) + 1;
        cp = malloc(len);
        if (cp != NULL)
                if (strlcpy(cp, str, len) != len) {
                        free(cp);
                        return NULL;
                }
        return cp;
}
#endif

The above is a longer version of 'return NULL'.
>How-To-Repeat:
#undef HAVE_STRDUP and build libssh.so
>Fix:
Change 'if (strlcpy(cp, str, len) != len)' ->
'if (strlcpy(cp, str, len) != (len-1))'.

>Release-Note:
>Audit-Trail:

From: Antoine Brodin <antoine.brodin@laposte.net>
To: bug-followup@FreeBSD.org, olavi@ipunplugged.com
Cc:  
Subject: Re: kern/87067: Bug in
 crypto/openssh/openbsd-compat/bsd-misc.c::strdup()
Date: Sat, 8 Oct 2005 13:19:58 +0200

 Hi Olavi,
 
 OpenSSH is contributed software and FreeBSD doesn't use this part of
 the code, so you probably want to report this problem to the OpenSSH
 team ( http://bugzilla.mindrot.org/ )
 
 
 Cheers,
 
 Antoine
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Sat Oct 8 12:58:32 GMT 2005 
State-Changed-Why:  
It sounds as though this needs to be taken up with the upstream authors. 

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