summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Loder <cloder@cvs.openbsd.org>2005-04-14 02:15:24 +0000
committerChad Loder <cloder@cvs.openbsd.org>2005-04-14 02:15:24 +0000
commit856b55ba4fbaee97cd1926dbd568b469d2249332 (patch)
tree7307258e9abffa90bad5d1d4785bf56847af9e07
parent86f056093e4bd0009c6f251112e67a01218e5c5c (diff)
Check snprintf for truncation and failure. From Han Boetes (thanks).
-rw-r--r--usr.sbin/bind/bin/dig/dig.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/bind/bin/dig/dig.c b/usr.sbin/bind/bin/dig/dig.c
index f2277abcbc1..73c14fb91ab 100644
--- a/usr.sbin/bind/bin/dig/dig.c
+++ b/usr.sbin/bind/bin/dig/dig.c
@@ -1387,10 +1387,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
INSIST(batchfp == NULL);
homedir = getenv("HOME");
if (homedir != NULL) {
- unsigned int n;
+ int n;
n = snprintf(rcfile, sizeof(rcfile), "%s/.digrc",
homedir);
- if (n < sizeof(rcfile))
+ if (n < sizeof(rcfile) && n != 0)
batchfp = fopen(rcfile, "r");
}
if (batchfp != NULL) {