summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-06 18:38:49 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-06 18:38:49 +0000
commitab6678d163ea6c72709947b2f9258dc0735672d4 (patch)
tree0896e7e2dd6a82941c137cdfa435edc5c958ddf4
parent92f4a9d4ad9063cbf9af2d3ae9b942a9664f40af (diff)
buf oflow
-rw-r--r--usr.bin/quota/quota.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c
index d538ea68d83..927100b901f 100644
--- a/usr.bin/quota/quota.c
+++ b/usr.bin/quota/quota.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: quota.c,v 1.5 1996/06/26 05:38:01 deraadt Exp $ */
+/* $OpenBSD: quota.c,v 1.6 1996/08/06 18:38:48 deraadt Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@@ -44,7 +44,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)quota.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: quota.c,v 1.5 1996/06/26 05:38:01 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: quota.c,v 1.6 1996/08/06 18:38:48 deraadt Exp $";
#endif /* not lint */
/*
@@ -499,11 +499,13 @@ ufshasquota(fs, type, qfnamep)
char *opt, *cp;
if (!initname) {
- sprintf(usrname, "%s%s", qfextension[USRQUOTA], qfname);
- sprintf(grpname, "%s%s", qfextension[GRPQUOTA], qfname);
+ snprintf(usrname, sizeof usrname, "%s%s",
+ qfextension[USRQUOTA], qfname);
+ snprintf(grpname, sizeof grpname, "%s%s",
+ qfextension[GRPQUOTA], qfname);
initname = 1;
}
- strcpy(buf, fs->fs_mntops);
+ strncpy(buf, sizeof buf, fs->fs_mntops);
for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) {
if (cp = index(opt, '='))
*cp++ = '\0';
@@ -518,7 +520,8 @@ ufshasquota(fs, type, qfnamep)
*qfnamep = cp;
return (1);
}
- (void) sprintf(buf, "%s/%s.%s", fs->fs_file, qfname, qfextension[type]);
+ (void) snprintf(buf, sizeof buf, "%s/%s.%s",
+ fs->fs_file, qfname, qfextension[type]);
*qfnamep = buf;
return (1);
}