OSDN Git Service

DO NOT MERGE: HH: Check parameter length in bta_hh_ctrl_dat_act
authorMyles Watson <mylesgw@google.com>
Thu, 25 Oct 2018 21:33:33 +0000 (14:33 -0700)
committerRohit Yengisetty <rngy@google.com>
Mon, 5 Nov 2018 21:52:57 +0000 (13:52 -0800)
Bug: 116108738
Test: send a malformed GET_IDLE command with no parameters
Change-Id: Ic57e748a06ea6d4fc16868310d3423ee71a7ac8c
(cherry picked from commit a4a11e198164027f86e74e10aa68b9327df5b589)

bta/hh/bta_hh_act.c

index f799e67..7d0e5bd 100644 (file)
@@ -26,6 +26,7 @@
 
 #if defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
 
+#include <log/log.h>
 #include <string.h>
 
 #include "bta_sys.h"
@@ -764,6 +765,12 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data)
     APPL_TRACE_DEBUG("Ctrl DATA received w4: event[%s]",
                         bta_hh_get_w4_event(p_cb->w4_evt));
 #endif
+    if (pdata->len == 0) {
+        android_errorWriteLog(0x534e4554, "116108738");
+        p_cb->w4_evt = 0;
+        osi_free_and_reset((void**)&pdata);
+        return;
+    }
     hs_data.status  = BTA_HH_OK;
     hs_data.handle  = p_cb->hid_handle;