summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/common_source/common.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-04-07 22:55:50 +0000
committerderaadt <deraadt@openbsd.org>2003-04-07 22:55:50 +0000
commit12e23270e7fbff26817f1d5800ef4ca7afde8e4c (patch)
tree4068e4728cb1a6ab498a7f204e1bd213207e1578 /usr.sbin/lpr/common_source/common.c
parentStrlcpy improvements. ok deraadt@ (diff)
downloadwireguard-openbsd-12e23270e7fbff26817f1d5800ef4ca7afde8e4c.tar.xz
wireguard-openbsd-12e23270e7fbff26817f1d5800ef4ca7afde8e4c.zip
kill last strcpy; ok millert
Diffstat (limited to 'usr.sbin/lpr/common_source/common.c')
-rw-r--r--usr.sbin/lpr/common_source/common.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index a0723a429bf..6541b87a49d 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.23 2002/06/13 06:48:40 millert Exp $ */
+/* $OpenBSD: common.c,v 1.24 2003/04/07 22:55:50 deraadt Exp $ */
/* $NetBSD: common.c,v 1.21 2000/08/09 14:28:50 itojun Exp $ */
/*
@@ -43,7 +43,7 @@
#if 0
static const char sccsid[] = "@(#)common.c 8.5 (Berkeley) 4/28/95";
#else
-static const char rcsid[] = "$OpenBSD: common.c,v 1.23 2002/06/13 06:48:40 millert Exp $";
+static const char rcsid[] = "$OpenBSD: common.c,v 1.24 2003/04/07 22:55:50 deraadt Exp $";
#endif
#endif /* not lint */
@@ -274,11 +274,12 @@ getq(struct queue ***namelist)
continue; /* Doesn't exist */
}
PRIV_END;
- q = (struct queue *)malloc(sizeof(time_t)+strlen(d->d_name)+1);
+ q = (struct queue *)malloc(sizeof(struct queue));
if (q == NULL)
goto errdone;
q->q_time = stbuf.st_mtime;
- strcpy(q->q_name, d->d_name); /* safe */
+ strlcpy(q->q_name, d->d_name, sizeof(q->q_name));
+
/*
* Check to make sure the array has space left and
* realloc the maximum size.