diff options
| author | 2003-06-27 19:08:22 +0000 | |
|---|---|---|
| committer | 2003-06-27 19:08:22 +0000 | |
| commit | 44c5f86991d56e224338eb71979bd544d0147a1c (patch) | |
| tree | 22fdcdd89735d8b7d3b44281e8beec96481ae936 /usr.sbin/bind/bin/dig/dig.c | |
| parent | protos for userland build (diff) | |
| download | wireguard-openbsd-44c5f86991d56e224338eb71979bd544d0147a1c.tar.xz wireguard-openbsd-44c5f86991d56e224338eb71979bd544d0147a1c.zip | |
string cleaning; "Put it in. If it breaks, tough" Theo.
work by me, useful feedback from krw, jakob, tedu, and tholo
Diffstat (limited to 'usr.sbin/bind/bin/dig/dig.c')
| -rw-r--r-- | usr.sbin/bind/bin/dig/dig.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/usr.sbin/bind/bin/dig/dig.c b/usr.sbin/bind/bin/dig/dig.c index bcbb3ac99cd..71045bbff95 100644 --- a/usr.sbin/bind/bin/dig/dig.c +++ b/usr.sbin/bind/bin/dig/dig.c @@ -619,7 +619,7 @@ plus_option(char *option, isc_boolean_t is_batchfile, char *cmd, *value, *ptr; isc_boolean_t state = ISC_TRUE; - strncpy(option_store, option, sizeof(option_store)); + strlcpy(option_store, option, sizeof(option_store)); option_store[sizeof(option_store)-1]=0; ptr = option_store; cmd=next_token(&ptr,"="); @@ -718,8 +718,7 @@ plus_option(char *option, isc_boolean_t is_batchfile, goto need_value; if (!state) goto invalid_option; - strncpy(domainopt, value, sizeof(domainopt)); - domainopt[sizeof(domainopt)-1] = '\0'; + strlcpy(domainopt, value, sizeof(domainopt)); break; default: goto invalid_option; @@ -960,8 +959,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, batchname = value; return (value_from_next); case 'k': - strncpy(keyfile, value, sizeof(keyfile)); - keyfile[sizeof(keyfile)-1]=0; + strlcpy(keyfile, value, sizeof(keyfile)); return (value_from_next); case 'p': port = (in_port_t) parse_uint(value, "port number", MAXPORT); @@ -1014,18 +1012,16 @@ dash_option(char *option, char *next, dig_lookup_t **lookup, if (ptr == NULL) { usage(); } - strncpy(keynametext, ptr, sizeof(keynametext)); - keynametext[sizeof(keynametext)-1]=0; + strlcpy(keynametext, ptr, sizeof(keynametext)); ptr = next_token(&value, ""); if (ptr == NULL) usage(); - strncpy(keysecret, ptr, sizeof(keysecret)); - keysecret[sizeof(keysecret)-1]=0; + strlcpy(keysecret, ptr, sizeof(keysecret)); return (value_from_next); case 'x': *lookup = clone_lookup(default_lookup, ISC_TRUE); if (get_reverse(textname, value, nibble) == ISC_R_SUCCESS) { - strncpy((*lookup)->textname, textname, + strlcpy((*lookup)->textname, textname, sizeof((*lookup)->textname)); debug("looking up %s", (*lookup)->textname); (*lookup)->trace_root = ISC_TF((*lookup)->trace || @@ -1254,9 +1250,8 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, printgreeting(argc, argv, lookup); firstarg = ISC_FALSE; } - strncpy(lookup->textname, rv[0], + strlcpy(lookup->textname, rv[0], sizeof(lookup->textname)); - lookup->textname[sizeof(lookup->textname)-1]=0; lookup->trace_root = ISC_TF(lookup->trace || lookup->ns_search_only); lookup->new_search = ISC_TRUE; |
