svn commit: r343936 - stable/12/usr.sbin/kbdmap

Stefan Esser se at FreeBSD.org
Sat Feb 9 14:07:06 UTC 2019


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);
 				}
 			}
 		}


More information about the svn-src-all mailing list