From e8121e2215550798df063462c792e31628ab7f59 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 2 Nov 2005 09:06:50 +1100 Subject: - (dtucker) [openbsd-compat/bsd-misc.c] Bug #1108: fix broken strdup(). Reported by olavi at ipunplugged.com and antoine.brodin at laposte.net via FreeBSD. --- openbsd-compat/bsd-misc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'openbsd-compat/bsd-misc.c') diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 6ba9bd98..3d788518 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -18,7 +18,7 @@ #include "includes.h" #include "xmalloc.h" -RCSID("$Id: bsd-misc.c,v 1.27 2005/05/27 11:13:41 dtucker Exp $"); +RCSID("$Id: bsd-misc.c,v 1.27.2.1 2005/11/01 22:06:50 dtucker Exp $"); #ifndef HAVE___PROGNAME char *__progname; @@ -223,10 +223,7 @@ strdup(const char *str) len = strlen(str) + 1; cp = malloc(len); if (cp != NULL) - if (strlcpy(cp, str, len) != len) { - free(cp); - return NULL; - } - return cp; + return(memcpy(cp, str, len)); + return NULL; } #endif -- cgit v1.2.1