Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/quota Don't strlcpy from a string buffer to itself; ...
details: https://anonhg.NetBSD.org/src/rev/a21d54811ba7
branches: trunk
changeset: 773264:a21d54811ba7
user: dholland <dholland%NetBSD.org@localhost>
date: Mon Jan 30 06:02:12 2012 +0000
description:
Don't strlcpy from a string buffer to itself; the behavior is not
defined.
diffstat:
usr.bin/quota/quotautil.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (37 lines):
diff -r 6d0c26b3e0fd -r a21d54811ba7 usr.bin/quota/quotautil.c
--- a/usr.bin/quota/quotautil.c Mon Jan 30 06:00:49 2012 +0000
+++ b/usr.bin/quota/quotautil.c Mon Jan 30 06:02:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: quotautil.c,v 1.4 2012/01/25 01:24:07 dholland Exp $ */
+/* $NetBSD: quotautil.c,v 1.5 2012/01/30 06:02:12 dholland Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)quota.c 8.4 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: quotautil.c,v 1.4 2012/01/25 01:24:07 dholland Exp $");
+__RCSID("$NetBSD: quotautil.c,v 1.5 2012/01/30 06:02:12 dholland Exp $");
#endif
#endif /* not lint */
@@ -76,6 +76,7 @@
char *opt;
char *cp = NULL;
static char initname, usrname[100], grpname[100];
+ char optbuf[256];
if (!initname) {
(void)snprintf(usrname, sizeof(usrname), "%s%s",
@@ -84,8 +85,8 @@
qfextension[GRPQUOTA], qfname);
initname = 1;
}
- strlcpy(buf, fs->fs_mntops, len);
- for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
+ strlcpy(optbuf, fs->fs_mntops, sizeof(optbuf));
+ for (opt = strtok(optbuf, ","); opt; opt = strtok(NULL, ",")) {
if ((cp = strchr(opt, '=')) != NULL)
*cp++ = '\0';
if (type == USRQUOTA && strcmp(opt, usrname) == 0)
Home |
Main Index |
Thread Index |
Old Index