Author: se Date: Sat Feb 9 14:07:04 2019 New Revision: 343936 URL: https://svnweb.freebsd.org/changeset/base/343936
Log: MFC r343303: 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. Modified: stable/12/usr.sbin/kbdmap/kbdmap.c Modified: stable/12/usr.sbin/kbdmap/kbdmap.c ============================================================================== --- stable/12/usr.sbin/kbdmap/kbdmap.c Sat Feb 9 12:01:10 2019 (r343935) +++ stable/12/usr.sbin/kbdmap/kbdmap.c Sat Feb 9 14:07:04 2019 (r343936) @@ -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"