summaryrefslogtreecommitdiff
path: root/usr.bin/indent
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-01 04:51:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-01 04:51:17 +0000
commit0b5cd158e7086da81f1fbd33b05f8f05b831ae76 (patch)
tree1f685fca4ee5222d117008d52f8d03948b2a766d /usr.bin/indent
parent4dee8196ccbef7d77b9fb8323bc8f632e4ed75ea (diff)
snprintf
Diffstat (limited to 'usr.bin/indent')
-rw-r--r--usr.bin/indent/args.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/indent/args.c b/usr.bin/indent/args.c
index 1937fdda858..7899a4d07f1 100644
--- a/usr.bin/indent/args.c
+++ b/usr.bin/indent/args.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: args.c,v 1.11 2002/10/07 13:57:10 mickey Exp $ */
+/* $OpenBSD: args.c,v 1.12 2003/04/01 04:51:16 deraadt Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#ifndef lint
/*static char sccsid[] = "@(#)args.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: args.c,v 1.11 2002/10/07 13:57:10 mickey Exp $";
+static char rcsid[] = "$OpenBSD: args.c,v 1.12 2003/04/01 04:51:16 deraadt Exp $";
#endif /* not lint */
/*
@@ -174,11 +174,10 @@ set_profile()
home = getenv("HOME");
if (home != NULL && *home != '\0') {
- if (strlen(home) + sizeof(prof) + 1 > sizeof(fname)) {
+ if (snprintf(fname, sizeof fname, "%s/%s", home, prof) >= sizeof fname) {
warnx("%s/%s: %s", home, prof, strerror(ENAMETOOLONG));
return;
}
- sprintf(fname, "%s/%s", home, prof);
if ((f = fopen(option_source = fname, "r")) != NULL) {
scan_profile(f);
(void) fclose(f);