summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcloder <cloder@openbsd.org>2005-04-14 02:15:23 +0000
committercloder <cloder@openbsd.org>2005-04-14 02:15:23 +0000
commitb52ee7129e1c419c6c54f05df71791132faaed16 (patch)
tree940d210fe10a2bcd1f9f3e2b5145049df9cc85a3
parentmake it crystal clear that errstr is NULL after success (diff)
downloadwireguard-openbsd-b52ee7129e1c419c6c54f05df71791132faaed16.tar.xz
wireguard-openbsd-b52ee7129e1c419c6c54f05df71791132faaed16.zip
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) {