mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 06:35:57 +01:00
Fix potential memory corruption when reading bools
As per `man sd_bus_message_read`, boolean items should be read into an int rather than a bool as the latter can cause memory corruption.
This commit is contained in:
parent
e23e109e41
commit
668509e317
2 changed files with 6 additions and 6 deletions
|
@ -267,9 +267,9 @@ static int method_screencast_select_sources(sd_bus_message *msg, void *data,
|
|||
}
|
||||
|
||||
if (strcmp(key, "multiple") == 0) {
|
||||
bool multiple;
|
||||
int multiple;
|
||||
sd_bus_message_read(msg, "v", "b", &multiple);
|
||||
logprint(INFO, "dbus: option multiple: %x", multiple);
|
||||
logprint(INFO, "dbus: option multiple: %d", multiple);
|
||||
} else if (strcmp(key, "types") == 0) {
|
||||
uint32_t mask;
|
||||
sd_bus_message_read(msg, "v", "u", &mask);
|
||||
|
|
|
@ -83,14 +83,14 @@ static int method_screenshot(sd_bus_message *msg, void *data,
|
|||
}
|
||||
|
||||
if (strcmp(key, "interactive") == 0) {
|
||||
bool mode;
|
||||
int mode;
|
||||
sd_bus_message_read(msg, "v", "b", &mode);
|
||||
logprint(DEBUG, "dbus: option interactive: %x", mode);
|
||||
logprint(DEBUG, "dbus: option interactive: %d", mode);
|
||||
interactive = mode;
|
||||
} else if (strcmp(key, "modal") == 0) {
|
||||
bool modal;
|
||||
int modal;
|
||||
sd_bus_message_read(msg, "v", "b", &modal);
|
||||
logprint(DEBUG, "dbus: option modal: %x", modal);
|
||||
logprint(DEBUG, "dbus: option modal: %d", modal);
|
||||
} else {
|
||||
logprint(WARN, "dbus: unknown option %s", key);
|
||||
sd_bus_message_skip(msg, "v");
|
||||
|
|
Loading…
Reference in a new issue