From owner-freebsd-bugs@FreeBSD.ORG Fri Oct 7 14:40:18 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E45BF16A41F for ; Fri, 7 Oct 2005 14:40:18 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5F4743D55 for ; Fri, 7 Oct 2005 14:40:16 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j97EeGBC068569 for ; Fri, 7 Oct 2005 14:40:16 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j97EeGSS068566; Fri, 7 Oct 2005 14:40:16 GMT (envelope-from gnats) Resent-Date: Fri, 7 Oct 2005 14:40:16 GMT Resent-Message-Id: <200510071440.j97EeGSS068566@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Olavi K." Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B25A016A41F for ; 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 ; 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 ; 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." To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: misc/87067: Bug in crypto/openssh/openbsd-compat/bsd-misc.c::strdup() X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2005 14:40:19 -0000 >Number: 87067 >Category: misc >Synopsis: Bug in crypto/openssh/openbsd-compat/bsd-misc.c::strdup() >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Oct 07 14:40:16 GMT 2005 >Closed-Date: >Last-Modified: >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: >Unformatted: