svn commit: r242489 - head/sys/kern
Alfred Perlstein
alfred at FreeBSD.org
Fri Nov 2 18:57:39 UTC 2012
Author: alfred
Date: Fri Nov 2 18:57:38 2012
New Revision: 242489
URL: http://svn.freebsd.org/changeset/base/242489
Log:
Merge 242488, better use of strlcpy.
Submitted by: Eric van Gyzen <eric at vangyzen.net>
Modified:
head/sys/kern/kern_shutdown.c
Directory Properties:
head/sys/ (props changed)
Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c Fri Nov 2 18:54:10 2012 (r242488)
+++ head/sys/kern/kern_shutdown.c Fri Nov 2 18:57:38 2012 (r242489)
@@ -720,6 +720,7 @@ SYSCTL_STRING(_kern_shutdown, OID_AUTO,
int
set_dumper(struct dumperinfo *di, const char *devname)
{
+ size_t wantcopy;
if (di == NULL) {
bzero(&dumper, sizeof dumper);
@@ -729,8 +730,8 @@ set_dumper(struct dumperinfo *di, const
if (dumper.dumper != NULL)
return (EBUSY);
dumper = *di;
- strlcpy(dumpdevname, devname, sizeof(dumpdevname));
- if (strlen(dumpdevname) != strlen(devname)) {
+ wantcopy = strlcpy(dumpdevname, devname, sizeof(dumpdevname));
+ if (wantcopy >= sizeof(dumpdevname)) {
printf("set_dumper: device name truncated from '%s' -> '%s'\n",
devname, dumpdevname);
}
More information about the svn-src-all
mailing list