diff options
author | Srinu Jella <sjella@codeaurora.org> | 2014-06-18 21:15:55 +0530 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2015-06-23 14:22:55 -0700 |
commit | a3dbe938e519dfbdbfd121b8d7a8473cccfd3e70 (patch) | |
tree | f93856970f6d7416cff4c479f36ca912644965a9 | |
parent | 0bcf0c6e6b5b09b9bc7f856f739e57321120f67b (diff) | |
download | android_system_bt-a3dbe938e519dfbdbfd121b8d7a8473cccfd3e70.tar.gz android_system_bt-a3dbe938e519dfbdbfd121b8d7a8473cccfd3e70.tar.bz2 android_system_bt-a3dbe938e519dfbdbfd121b8d7a8473cccfd3e70.zip |
NULL pointer check in sdpu_build_attrib_entry
Use case: NULL pointer check in sdpu_build_attrib_entry
Crash observed during BT stability test
Failure: Crash observed while accessing p_attr->value_ptr
Root cause: There is no null check for p_attr->value_ptr while
accessing it in sdpu_build_attrib_entry
Fix: Fixing this issue by adding null check for p_attr->value_ptr
while accessing it in sdpu_build_attrib_entry
Bug: 21896912
Change-Id: I1dd352a33ff6f86add7d1b1bfdf240d1b7992b83
-rw-r--r-- | stack/sdp/sdp_utils.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/stack/sdp/sdp_utils.c b/stack/sdp/sdp_utils.c index 6e5c06404..238896f05 100644 --- a/stack/sdp/sdp_utils.c +++ b/stack/sdp/sdp_utils.c @@ -266,7 +266,9 @@ UINT8 *sdpu_build_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr) UINT8_TO_BE_STREAM (p_out, p_attr->len); } - ARRAY_TO_BE_STREAM (p_out, p_attr->value_ptr, (int)p_attr->len); + if (p_attr->value_ptr != NULL) { + ARRAY_TO_BE_STREAM (p_out, p_attr->value_ptr, (int)p_attr->len); + } return (p_out); } @@ -295,7 +297,9 @@ UINT8 *sdpu_build_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr) break; } - ARRAY_TO_BE_STREAM (p_out, p_attr->value_ptr, (int)p_attr->len); + if (p_attr->value_ptr != NULL) { + ARRAY_TO_BE_STREAM (p_out, p_attr->value_ptr, (int)p_attr->len); + } return (p_out); } |