Replace instances of strncpy and sprintf in the wifi
vendor HAL with strlcpy and snprintf.
Bug: 218897284
Test: m
Change-Id: I0a62d1c5043cabcf6a513b8b082ad1d7a1ea451c
diff --git a/wifi/1.6/default/hidl_struct_util.cpp b/wifi/1.6/default/hidl_struct_util.cpp
index 45459e2..2112b26 100644
--- a/wifi/1.6/default/hidl_struct_util.cpp
+++ b/wifi/1.6/default/hidl_struct_util.cpp
@@ -1881,7 +1881,7 @@
"ifaceName too long";
return false;
}
- strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
+ strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
legacy_request->ndp_cfg.security_cfg =
(hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN)
? legacy_hal::NAN_DP_CONFIG_SECURITY
@@ -1958,7 +1958,7 @@
"ifaceName too long";
return false;
}
- strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
+ strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
legacy_request->ndp_cfg.security_cfg =
(hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN)
? legacy_hal::NAN_DP_CONFIG_SECURITY
@@ -2039,7 +2039,7 @@
"ifaceName too long";
return false;
}
- strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
+ strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
legacy_request->ndp_cfg.security_cfg =
(hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN)
? legacy_hal::NAN_DP_CONFIG_SECURITY
@@ -2114,7 +2114,7 @@
"ifaceName too long";
return false;
}
- strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
+ strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1);
legacy_request->ndp_cfg.security_cfg =
(hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN)
? legacy_hal::NAN_DP_CONFIG_SECURITY