2023-06-27 17:06:58

by fdanis-oss

[permalink] [raw]
Subject: [bluez/bluez] 6b9d16: android: Fix compiler warning from GCC

Branch: refs/heads/master
Home: https://github.com/bluez/bluez
Commit: 6b9d167034b741605c3186e78e9742dda8e28e08
https://github.com/bluez/bluez/commit/6b9d167034b741605c3186e78e9742dda8e28e08
Author: Marcel Holtmann <[email protected]>
Date: 2023-06-27 (Tue, 27 Jun 2023)

Changed paths:
M android/gatt.c

Log Message:
-----------
android: Fix compiler warning from GCC

This ignores the following two warnings from the compiler.

CC android/gatt.o
android/gatt.c: In function ‘handle_client_register_for_notification’:
android/gatt.c:3733:9: error: ‘memcpy’ offset [0, 16] is out of the bounds [0, 0] [-Werror=array-bounds=]
3733 | memcpy(&notification->ch, &cmd->char_id, sizeof(notification->ch));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CC android/gatt.o
android/gatt.c: In function ‘handle_client_register_for_notification’:
android/gatt.c:3735:9: error: ‘memcpy’ writing 17 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
3735 | memcpy(&notification->ch, &cmd->char_id, sizeof(notification->ch));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It could be possible that these warnings are valid or they might be a
false positive. However since this is Android based code based on
Android HAL headers, just set pragma to ignore them.