Author: se
Date: Tue Jan 22 13:11:15 2019
New Revision: 343303
URL: https://svnweb.freebsd.org/changeset/base/343303

Log:
  Silence a CI warning regarding the use of strcpy().
  
  While this is a false positive (a sufficiently large buffer has been
  allocated in the line above), the use of strdup() simplifies and clarifies
  the code.
  
  MFC after:    2 weeks

Modified:
  head/usr.sbin/kbdmap/kbdmap.c

Modified: head/usr.sbin/kbdmap/kbdmap.c
==============================================================================
--- head/usr.sbin/kbdmap/kbdmap.c       Tue Jan 22 12:56:49 2019        
(r343302)
+++ head/usr.sbin/kbdmap/kbdmap.c       Tue Jan 22 13:11:15 2019        
(r343303)
@@ -241,8 +241,7 @@ get_font(void)
                                if (strcmp(buf, "NO")) {
                                        if (fnt)
                                                free(fnt);
-                                       fnt = (char *) malloc(strlen(buf) + 1);
-                                       strcpy(fnt, buf);
+                                       fnt = strdup(buf);
                                }
                        }
                }
_______________________________________________
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