Author: asomers
Date: Tue May 30 21:58:53 2017
New Revision: 319256
URL: https://svnweb.freebsd.org/changeset/base/319256

Log:
  MFC r316500 (except the part to usr.bin/fortune)
  
  strcpy => strlcpy, strcat => strlcat
  
  Reported by:  Coverity
  CID:          1006703 978863 1006745 1347163
  Reviewed by:  cem
  Sponsored by: Spectra Logic Corp
  Differential Revision:        https://reviews.freebsd.org/D10192

Modified:
  stable/10/usr.bin/banner/banner.c
  stable/10/usr.bin/limits/limits.c
  stable/10/usr.bin/rpcinfo/rpcinfo.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/banner/banner.c
==============================================================================
--- stable/10/usr.bin/banner/banner.c   Tue May 30 21:57:25 2017        
(r319255)
+++ stable/10/usr.bin/banner/banner.c   Tue May 30 21:58:53 2017        
(r319256)
@@ -1064,8 +1064,8 @@ main(int argc, char *argv[])
                        err(1, "malloc");
                strcpy(message, *argv);
                while (*++argv) {
-                       strcat(message, " ");
-                       strcat(message, *argv);
+                       strlcat(message, " ", j);
+                       strlcat(message, *argv, j);
                }
                nchars = strlen(message);
        } else {

Modified: stable/10/usr.bin/limits/limits.c
==============================================================================
--- stable/10/usr.bin/limits/limits.c   Tue May 30 21:57:25 2017        
(r319255)
+++ stable/10/usr.bin/limits/limits.c   Tue May 30 21:58:53 2017        
(r319256)
@@ -549,7 +549,7 @@ print_limit(rlim_t limit, unsigned divisor, const char
     char numbr[64];
 
     if (limit == RLIM_INFINITY)
-       strcpy(numbr, inf);
+       strlcpy(numbr, inf, sizeof(numbr));
     else
        sprintf(numbr, "%jd", (intmax_t)((limit + divisor/2) / divisor));
     printf(pfx, which, numbr);

Modified: stable/10/usr.bin/rpcinfo/rpcinfo.c
==============================================================================
--- stable/10/usr.bin/rpcinfo/rpcinfo.c Tue May 30 21:57:25 2017        
(r319255)
+++ stable/10/usr.bin/rpcinfo/rpcinfo.c Tue May 30 21:58:53 2017        
(r319256)
@@ -854,9 +854,9 @@ failed:
                        printf("%-10s", buf);
                        buf[0] = '\0';
                        for (nl = rs->nlist; nl; nl = nl->next) {
-                               strcat(buf, nl->netid);
+                               strlcat(buf, nl->netid, sizeof(buf));
                                if (nl->next)
-                                       strcat(buf, ",");
+                                       strlcat(buf, ",", sizeof(buf));
                        }
                        printf("%-32s", buf);
                        rpc = getrpcbynumber(rs->prog);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to