mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-04-23 23:50:42 +02:00
hidpp-device: avoid unaligned memory access
Fixes a -Wcast-align warning and a -fsanitize=undefined error. https://bugs.freedesktop.org/show_bug.cgi?id=71079
This commit is contained in:
parent
5eead9ecf6
commit
b3e5143f5a
1 changed files with 3 additions and 3 deletions
|
|
@ -818,7 +818,7 @@ hidpp_device_refresh (HidppDevice *device,
|
|||
|
||||
/* get serial number, this can be queried from the receiver */
|
||||
if ((refresh_flags & HIDPP_REFRESH_FLAGS_SERIAL) > 0) {
|
||||
guint32 *serialp;
|
||||
guint32 serial;
|
||||
|
||||
msg.type = HIDPP_MSG_TYPE_SHORT;
|
||||
msg.device_idx = HIDPP_RECEIVER_ADDRESS;
|
||||
|
|
@ -834,8 +834,8 @@ hidpp_device_refresh (HidppDevice *device,
|
|||
if (!ret)
|
||||
goto out;
|
||||
|
||||
serialp = (guint32 *) &msg.l.params[1];
|
||||
priv->serial = g_strdup_printf ("%08X", g_ntohl(*serialp));
|
||||
memcpy (&serial, msg.l.params + 1, sizeof(serial));
|
||||
priv->serial = g_strdup_printf ("%08X", g_ntohl(serial));
|
||||
}
|
||||
|
||||
/* get battery status */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue