From: DoHyun Pyun Date: Tue, 26 Nov 2019 04:37:47 +0000 (+0900) Subject: Fix the crash issue to parse the device name X-Git-Tag: submit/tizen_5.5/20191126.044856^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c88f4daa1a86134028551ec5f58eb296f35ff49;p=platform%2Fcore%2Fapi%2Fbluetooth.git Fix the crash issue to parse the device name Change-Id: I29976c3479eafb15085f5ebf6679e123b51774ea Signed-off-by: DoHyun Pyun --- diff --git a/src/bluetooth-adapter.c b/src/bluetooth-adapter.c index 27859c6..348a5ae 100644 --- a/src/bluetooth-adapter.c +++ b/src/bluetooth-adapter.c @@ -3087,6 +3087,12 @@ int bt_adapter_le_get_scan_result_device_name(const bt_adapter_le_device_scan_re field_len = adv_data[0]; if (adv_data[1] == BT_ADAPTER_LE_ADVERTISING_DATA_LOCAL_NAME || adv_data[1] == BT_ADAPTER_LE_ADVERTISING_DATA_SHORT_LOCAL_NAME) { + + if (field_len <= 0) { + BT_ERR("Wrong field len for name"); + return BT_ERROR_NO_DATA; + } + *name = g_malloc0(sizeof(char) *field_len); memcpy(*name, &adv_data[2], field_len - 1);