svn commit: r343303 - head/usr.sbin/kbdmap
Stefan Esser
se at FreeBSD.org
Tue Jan 22 13:11:16 UTC 2019
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);
}
}
}
More information about the svn-src-all
mailing list