summaryrefslogtreecommitdiffstats
path: root/openbsd-compat/bsd-misc.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2005-11-01 23:07:31 +0100
committerDarren Tucker <dtucker@zip.com.au>2005-11-01 23:07:31 +0100
commitd32e293c045025b80892e8b05285ca9617d83ef6 (patch)
treec03e1af255887254147d635f14b45f42d3446a90 /openbsd-compat/bsd-misc.c
parent - (dtucker) [session.c] Bug #1045do not check /etc/nologin when PAM is (diff)
downloadopenssh-d32e293c045025b80892e8b05285ca9617d83ef6.tar.xz
openssh-d32e293c045025b80892e8b05285ca9617d83ef6.zip
- (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.
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r--openbsd-compat/bsd-misc.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 6ba9bd986..d32b054d7 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.28 2005/11/01 22:07:31 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