Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2014 22:22:55 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272142 - head/contrib/hyperv/tools
Message-ID:  <201409252222.s8PMMtUi036347@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Sep 25 22:22:54 2014
New Revision: 272142
URL: http://svnweb.freebsd.org/changeset/base/272142

Log:
  Use strlcpy(). I don't believe these are real problems but it's better
  to use a safe idiom.
  
  Reported by:	Coverity
  CID:		1238914
  MFC after:	1 week

Modified:
  head/contrib/hyperv/tools/hv_kvp_daemon.c

Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c
==============================================================================
--- head/contrib/hyperv/tools/hv_kvp_daemon.c	Thu Sep 25 22:22:51 2014	(r272141)
+++ head/contrib/hyperv/tools/hv_kvp_daemon.c	Thu Sep 25 22:22:54 2014	(r272142)
@@ -1249,7 +1249,7 @@ kvp_op_enumerate(struct hv_kvp_msg *op_m
 
 	case IntegrationServicesVersion:
 		strcpy(key_name, "IntegrationServicesVersion");
-		strcpy(key_value, lic_version);
+		strlcpy(key_value, lic_version, HV_KVP_EXCHANGE_MAX_VALUE_SIZE);
 		break;
 
 	case NetworkAddressIPv4:
@@ -1265,32 +1265,32 @@ kvp_op_enumerate(struct hv_kvp_msg *op_m
 		break;
 
 	case OSBuildNumber:
-		strcpy(key_value, os_build);
+		strlcpy(key_value, os_build, HV_KVP_EXCHANGE_MAX_VALUE_SIZE);
 		strcpy(key_name, "OSBuildNumber");
 		break;
 
 	case OSName:
-		strcpy(key_value, os_name);
+		strlcpy(key_value, os_name, HV_KVP_EXCHANGE_MAX_VALUE_SIZE);
 		strcpy(key_name, "OSName");
 		break;
 
 	case OSMajorVersion:
-		strcpy(key_value, os_major);
+		strlcpy(key_value, os_major, HV_KVP_EXCHANGE_MAX_VALUE_SIZE);
 		strcpy(key_name, "OSMajorVersion");
 		break;
 
 	case OSMinorVersion:
-		strcpy(key_value, os_minor);
+		strlcpy(key_value, os_minor, HV_KVP_EXCHANGE_MAX_VALUE_SIZE);
 		strcpy(key_name, "OSMinorVersion");
 		break;
 
 	case OSVersion:
-		strcpy(key_value, os_build);
+		strlcpy(key_value, os_build, HV_KVP_EXCHANGE_MAX_VALUE_SIZE);
 		strcpy(key_name, "OSVersion");
 		break;
 
 	case ProcessorArchitecture:
-		strcpy(key_value, processor_arch);
+		strlcpy(key_value, processor_arch, HV_KVP_EXCHANGE_MAX_VALUE_SIZE);
 		strcpy(key_name, "ProcessorArchitecture");
 		break;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409252222.s8PMMtUi036347>