Author: delphij
Date: Tue Jun 23 23:32:24 2009
New Revision: 194796
URL: http://svn.freebsd.org/changeset/base/194796

Log:
  Use strlcpy() instead of explicitly set \0 on the tail of the array.

Modified:
  head/usr.bin/hexdump/parse.c

Modified: head/usr.bin/hexdump/parse.c
==============================================================================
--- head/usr.bin/hexdump/parse.c        Tue Jun 23 23:30:56 2009        
(r194795)
+++ head/usr.bin/hexdump/parse.c        Tue Jun 23 23:32:24 2009        
(r194796)
@@ -142,8 +142,7 @@ add(const char *fmt)
                                badfmt(fmt);
                if (!(tfu->fmt = malloc(p - savep + 1)))
                        err(1, NULL);
-               (void) strncpy(tfu->fmt, savep, p - savep);
-               tfu->fmt[p - savep] = '\0';
+               (void) strlcpy(tfu->fmt, savep, p - savep + 1);
                escape(tfu->fmt);
                p++;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to