[PATCH 09/11] android/unit: Add negative case for msg size verification

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

 



Case for checking message size declared inside the header against the
amount of data sent for variable sized message.
---
 android/test-ipc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/android/test-ipc.c b/android/test-ipc.c
index 6bb6cd6..e4463eb 100644
--- a/android/test-ipc.c
+++ b/android/test-ipc.c
@@ -499,6 +499,15 @@ static const struct test_data test_cmd_vardata_valid_2 = {
 	.handlers_size = 1,
 };
 
+static const struct test_data test_cmd_vardata_invalid_1 = {
+	.cmd = &test_cmd_vardata,
+	.cmd_size = sizeof(struct hal_hdr) + sizeof(VARDATA_EX1) - 1,
+	.service = 0,
+	.handlers = cmd_vardata_handlers,
+	.handlers_size = 1,
+	.expected_signal = SIGTERM
+};
+
 static const struct hal_hdr test_cmd_service_offrange_hdr = {
 	.service_id = HAL_SERVICE_ID_MAX + 1,
 	.opcode = 1,
@@ -541,6 +550,9 @@ int main(int argc, char *argv[])
 	g_test_add_data_func("/android_ipc/test_cmd_vardata_valid_2",
 					&test_cmd_vardata_valid_2,
 					test_cmd_reg);
+	g_test_add_data_func("/android_ipc/test_cmd_vardata_invalid_1",
+					&test_cmd_vardata_invalid_1,
+					test_cmd_reg);
 	g_test_add_data_func("/android_ipc/test_cmd_service_offrange",
 					&test_cmd_service_offrange,
 					test_cmd_reg);
-- 
1.8.5.2

--
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