Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea107cc4 authored by Henri Chataing's avatar Henri Chataing
Browse files

message_loop_thread_unittest: Fix instance of stack smashing

getcap writes out 64-bit capabilities to an array of
two __user_cap_data_struct

Bug: 311772251
Test: atest --host bluetooth_test_common
Flag: EXEMPT, test change
Change-Id: I29b7e2936025abed58ca507a25f434f142b00863
parent 26253d1c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -68,8 +68,8 @@ class MessageLoopThreadTest : public ::testing::Test {
  static bool CanSetCurrentThreadPriority() {
    struct __user_cap_header_struct linux_user_header = {
        .version = _LINUX_CAPABILITY_VERSION_3};
    struct __user_cap_data_struct linux_user_data = {};
    if (capget(&linux_user_header, &linux_user_data) != 0) {
    struct __user_cap_data_struct linux_user_data[2] = {};
    if (capget(&linux_user_header, linux_user_data) != 0) {
      LOG(ERROR) << "Failed to get capability for current thread, error: "
                 << strerror(errno);
      // Log record in XML
@@ -77,7 +77,7 @@ class MessageLoopThreadTest : public ::testing::Test {
                     strerror(errno));
      return false;
    }
    return ((linux_user_data.permitted >> CAP_SYS_NICE) & 0x1) != 0;
    return ((linux_user_data[0].permitted >> CAP_SYS_NICE) & 0x1) != 0;
  }
};