]> 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:34:57 +0000 (07:34 +0000)
committerMark Andrews <marka@isc.org>
Mon, 21 Feb 2011 07:34:57 +0000 (07:34 +0000)
CHANGES
bin/dig/dighost.c
bin/dig/host.c

diff --git a/CHANGES b/CHANGES
index d88230564829c364fe4da20a68c065a38f60cbde..ca8760acdcd1cc431d1ae972a2cde8827edc24ec 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..54b2c0a2098e48dccbf1290b4f357047d7c3cc63 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.337 2011/02/21 07:34:56 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..7ef0e817d9954d9858b0b17957db61a52cce6fda 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.125 2011/02/21 07:34:57 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]);