diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-12-19 08:11:41 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-12-19 08:11:41 +0000 |
commit | 047800a6183fa18f430652fd3005bcc08bc124e4 (patch) | |
tree | 308a84e35022e30b0391d1c3c0a7de34d4927bda | |
parent | e03c80d9dce383529268eb62cc43d173ded47bdc (diff) | |
parent | 5039b6099ea82f158f1318fd2be3a141dd0bd54e (diff) | |
download | android_hardware_interfaces-047800a6183fa18f430652fd3005bcc08bc124e4.tar.gz android_hardware_interfaces-047800a6183fa18f430652fd3005bcc08bc124e4.tar.bz2 android_hardware_interfaces-047800a6183fa18f430652fd3005bcc08bc124e4.zip |
Snap for 6085360 from 5039b6099ea82f158f1318fd2be3a141dd0bd54e to qt-qpr2-release
Change-Id: Iaff399ca47ba6810431f0bc0c4d5caaaec9b4305
-rw-r--r-- | wifi/1.3/default/hidl_struct_util.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/wifi/1.3/default/hidl_struct_util.cpp b/wifi/1.3/default/hidl_struct_util.cpp index 2e4db7048..d305c0997 100644 --- a/wifi/1.3/default/hidl_struct_util.cpp +++ b/wifi/1.3/default/hidl_struct_util.cpp @@ -1819,7 +1819,13 @@ bool convertHidlNanDataPathInitiatorRequestToLegacy( convertHidlNanDataPathChannelCfgToLegacy( hidl_request.channelRequestType); legacy_request->channel = hidl_request.channel; - strcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str()); + if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "ifaceName too long"; + return false; + } + strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), + IFNAMSIZ + 1); legacy_request->ndp_cfg.security_cfg = (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) @@ -1900,7 +1906,13 @@ bool convertHidlNanDataPathIndicationResponseToLegacy( ? legacy_hal::NAN_DP_REQUEST_ACCEPT : legacy_hal::NAN_DP_REQUEST_REJECT; legacy_request->ndp_instance_id = hidl_request.ndpInstanceId; - strcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str()); + if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " + "ifaceName too long"; + return false; + } + strncpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), + IFNAMSIZ + 1); legacy_request->ndp_cfg.security_cfg = (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) |