]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3035. [cleanup] Simplify by using strlcpy. [RT #22521]
authorMark Andrews <marka@isc.org>
Mon, 21 Feb 2011 07:36:41 +0000 (07:36 +0000)
committerMark Andrews <marka@isc.org>
Mon, 21 Feb 2011 07:36:41 +0000 (07:36 +0000)
CHANGES
bin/dig/dighost.c
bin/dig/host.c

diff --git a/CHANGES b/CHANGES
index 0ebdf52e595856f929b743d7757076a221d7c204..db26196a7ba5930770d817b38be91ac153c1505e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+3035.  [cleanup]       Simplify by using strlcpy. [RT #22521] 
+
 3034.  [cleanup]       nslookup: use strlcpy instead of safecopy. [RT #22521]
 
 3033.  [cleanup]       Add two INSIST(bucket != DNS_ADB_INVALIDBUCKET).
index fc5e491ef5ba9e4f48ee457675510adbf0015c81..09fbca9edf7dd9a08ad7e4e69a3213c73529b91f 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dighost.c,v 1.336 2010/12/09 00:54:33 marka Exp $ */
+/* $Id: dighost.c,v 1.336.22.1 2011/02/21 07:36:41 marka Exp $ */
 
 /*! \file
  *  \note
@@ -566,10 +566,8 @@ make_server(const char *servname, const char *userarg) {
        if (srv == NULL)
                fatal("memory allocation failure in %s:%d",
                      __FILE__, __LINE__);
-       strncpy(srv->servername, servname, MXNAME);
-       strncpy(srv->userarg, userarg, MXNAME);
-       srv->servername[MXNAME-1] = 0;
-       srv->userarg[MXNAME-1] = 0;
+       strlcpy(srv->servername, servname, MXNAME);
+       strlcpy(srv->userarg, userarg, MXNAME);
        ISC_LINK_INIT(srv, link);
        return (srv);
 }
index d2ff52e08811bb5cd7ba8c24a61ecf312ef0379a..d39ea982420b63271496e3df970252de6eda86f2 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: host.c,v 1.124 2010/11/16 05:38:30 marka Exp $ */
+/* $Id: host.c,v 1.124.40.1 2011/02/21 07:36:41 marka Exp $ */
 
 /*! \file */
 
@@ -824,8 +824,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
        if (isc_commandline_index >= argc)
                show_usage();
 
-       strncpy(hostname, argv[isc_commandline_index], sizeof(hostname));
-       hostname[sizeof(hostname)-1]=0;
+       strlcpy(hostname, argv[isc_commandline_index], sizeof(hostname));
+
        if (argc > isc_commandline_index + 1) {
                set_nameserver(argv[isc_commandline_index+1]);
                debug("server is %s", argv[isc_commandline_index+1]);