[PATCH] android/tester: Fix possible NULL pointer passing to function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

Silence code analyzers and follow strict C standard where passing NULL
pointer results in undefined behaviour.
---
 android/tester-main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/tester-main.c b/android/tester-main.c
index 30e1c59..ee3444f 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -801,12 +801,12 @@ static bool match_data(struct step *step)
 			return false;
 		}
 
-	if (exp->store_srvc_handle)
+	if (exp->store_srvc_handle && step->callback_result.srvc_handle)
 		memcpy(exp->store_srvc_handle,
 					step->callback_result.srvc_handle,
 					sizeof(*exp->store_srvc_handle));
 
-	if (exp->store_char_handle)
+	if (exp->store_char_handle && step->callback_result.char_handle)
 		memcpy(exp->store_char_handle,
 					step->callback_result.char_handle,
 					sizeof(*exp->store_char_handle));
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux