summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-04-01 04:51:16 +0000
committerderaadt <deraadt@openbsd.org>2003-04-01 04:51:16 +0000
commita7044634ed202f9a1b25a73ace585018da7d8731 (patch)
tree69dbbf2391e87ef1c8b43c16b9b2dc1f95efe671
parentavoid memory leak on redirect header generation. from kame. (diff)
downloadwireguard-openbsd-a7044634ed202f9a1b25a73ace585018da7d8731.tar.xz
wireguard-openbsd-a7044634ed202f9a1b25a73ace585018da7d8731.zip
snprintf
-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);