summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libexec/ftpd/ftpcmd.y18
-rw-r--r--libexec/ftpd/ftpd.c4
2 files changed, 5 insertions, 17 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index 90a0b38c254..e3020975cbc 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -808,7 +808,6 @@ struct tab sitetab[] = {
{ NULL, 0, 0, 0, 0 }
};
-static char *copy __P((char *));
static void help __P((struct tab *, char *));
static struct tab *
lookup __P((struct tab *, char *));
@@ -1031,7 +1030,9 @@ yylex()
*/
if (n > 1 && cbuf[cpos] == '\n') {
cbuf[cpos] = '\0';
- yylval.s = copy(cp);
+ yylval.s = strdup(cp);
+ if (yylval.s == NULL)
+ fatal("Ran out of memory.");
cbuf[cpos] = '\n';
state = ARGS;
return (STRING);
@@ -1151,19 +1152,6 @@ upper(s)
}
}
-static char *
-copy(s)
- char *s;
-{
- char *p;
-
- p = malloc((unsigned) strlen(s) + 1);
- if (p == NULL)
- fatal("Ran out of memory.");
- (void) strcpy(p, s);
- return (p);
-}
-
static void
help(ctab, s)
struct tab *ctab;
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index ea2e74a16ea..2d4bd93f949 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.10 1996/08/07 03:04:22 downsj Exp $ */
+/* $OpenBSD: ftpd.c,v 1.11 1996/08/07 03:17:58 downsj Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -1760,7 +1760,7 @@ gunique(local)
}
if (cp)
*cp = '/';
- (void) strcpy(new, local);
+ (void) strncpy(new, local, sizeof(new));
cp = new + strlen(new);
*cp++ = '.';
for (count = 1; count < 100; count++) {