]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3034. [cleanup] nslookup: use strlcpy instead of safecopy. [RT #22521]
authorMark Andrews <marka@isc.org>
Mon, 21 Feb 2011 07:25:51 +0000 (07:25 +0000)
committerMark Andrews <marka@isc.org>
Mon, 21 Feb 2011 07:25:51 +0000 (07:25 +0000)
CHANGES
bin/dig/nslookup.c

diff --git a/CHANGES b/CHANGES
index 38fac8dec9e7e85e8712438680969936a6cbc740..0ebdf52e595856f929b743d7757076a221d7c204 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+3034.  [cleanup]       nslookup: use strlcpy instead of safecopy. [RT #22521]
+
 3033.  [cleanup]       Add two INSIST(bucket != DNS_ADB_INVALIDBUCKET).
                        [RT #22521]
 
index 1591d8d96aa783bb57e8830eaec72fb14b3c6cb5..5340862c9905b54627cae7e99abb50f64ab68dae 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: nslookup.c,v 1.127 2010/11/17 23:47:08 tbox Exp $ */
+/* $Id: nslookup.c,v 1.127.38.1 2011/02/21 07:25:51 marka Exp $ */
 
 #include <config.h>
 
@@ -535,12 +535,6 @@ testclass(char *typetext) {
        }
 }
 
-static void
-safecpy(char *dest, char *src, int size) {
-       strncpy(dest, src, size);
-       dest[size-1] = 0;
-}
-
 static void
 set_port(const char *value) {
        isc_uint32_t n;
@@ -571,34 +565,34 @@ setoption(char *opt) {
                show_settings(ISC_TRUE, ISC_FALSE);
        } else if (strncasecmp(opt, "class=", 6) == 0) {
                if (testclass(&opt[6]))
-                       safecpy(defclass, &opt[6], sizeof(defclass));
+                       strlcpy(defclass, &opt[6], sizeof(defclass));
        } else if (strncasecmp(opt, "cl=", 3) == 0) {
                if (testclass(&opt[3]))
-                       safecpy(defclass, &opt[3], sizeof(defclass));
+                       strlcpy(defclass, &opt[3], sizeof(defclass));
        } else if (strncasecmp(opt, "type=", 5) == 0) {
                if (testtype(&opt[5]))
-                       safecpy(deftype, &opt[5], sizeof(deftype));
+                       strlcpy(deftype, &opt[5], sizeof(deftype));
        } else if (strncasecmp(opt, "ty=", 3) == 0) {
                if (testtype(&opt[3]))
-                       safecpy(deftype, &opt[3], sizeof(deftype));
+                       strlcpy(deftype, &opt[3], sizeof(deftype));
        } else if (strncasecmp(opt, "querytype=", 10) == 0) {
                if (testtype(&opt[10]))
-                       safecpy(deftype, &opt[10], sizeof(deftype));
+                       strlcpy(deftype, &opt[10], sizeof(deftype));
        } else if (strncasecmp(opt, "query=", 6) == 0) {
                if (testtype(&opt[6]))
-                       safecpy(deftype, &opt[6], sizeof(deftype));
+                       strlcpy(deftype, &opt[6], sizeof(deftype));
        } else if (strncasecmp(opt, "qu=", 3) == 0) {
                if (testtype(&opt[3]))
-                       safecpy(deftype, &opt[3], sizeof(deftype));
+                       strlcpy(deftype, &opt[3], sizeof(deftype));
        } else if (strncasecmp(opt, "q=", 2) == 0) {
                if (testtype(&opt[2]))
-                       safecpy(deftype, &opt[2], sizeof(deftype));
+                       strlcpy(deftype, &opt[2], sizeof(deftype));
        } else if (strncasecmp(opt, "domain=", 7) == 0) {
-               safecpy(domainopt, &opt[7], sizeof(domainopt));
+               strlcpy(domainopt, &opt[7], sizeof(domainopt));
                set_search_domain(domainopt);
                usesearch = ISC_TRUE;
        } else if (strncasecmp(opt, "do=", 3) == 0) {
-               safecpy(domainopt, &opt[3], sizeof(domainopt));
+               strlcpy(domainopt, &opt[3], sizeof(domainopt));
                set_search_domain(domainopt);
                usesearch = ISC_TRUE;
        } else if (strncasecmp(opt, "port=", 5) == 0) {
@@ -677,11 +671,11 @@ addlookup(char *opt) {
        lookup = make_empty_lookup();
        if (get_reverse(store, sizeof(store), opt, lookup->ip6_int, ISC_TRUE)
            == ISC_R_SUCCESS) {
-               safecpy(lookup->textname, store, sizeof(lookup->textname));
+               strlcpy(lookup->textname, store, sizeof(lookup->textname));
                lookup->rdtype = dns_rdatatype_ptr;
                lookup->rdtypeset = ISC_TRUE;
        } else {
-               safecpy(lookup->textname, opt, sizeof(lookup->textname));
+               strlcpy(lookup->textname, opt, sizeof(lookup->textname));
                lookup->rdtype = rdtype;
                lookup->rdtypeset = ISC_TRUE;
        }