mirror of
https://github.com/swaywm/sway.git
synced 2025-10-08 13:16:05 +00:00
Fix NULL ptr deref in ipc_describe_workspace
When hot-plugging monitor(s) `ipc_json_describe_workspace` can end up dereferencing a NULL ptr in `wlr_output->name`. Here we simply check that it is set. While this is probably a race and just checking that it is not NULL before accessing it won't fully solve the race, it should make it substantially more rare. Mostly addresses #8747
This commit is contained in:
parent
c5456be750
commit
6f5587b02a
1 changed files with 3 additions and 2 deletions
|
@ -516,8 +516,9 @@ static void ipc_json_describe_workspace(struct sway_workspace *workspace,
|
|||
}
|
||||
json_object_object_add(object, "num", json_object_new_int(num));
|
||||
json_object_object_add(object, "fullscreen_mode", json_object_new_int(1));
|
||||
json_object_object_add(object, "output", workspace->output ?
|
||||
json_object_new_string(workspace->output->wlr_output->name) : NULL);
|
||||
json_object_object_add(object, "output",
|
||||
workspace->output && workspace->output->wlr_output->name ?
|
||||
json_object_new_string(workspace->output->wlr_output->name) : NULL);
|
||||
json_object_object_add(object, "urgent",
|
||||
json_object_new_boolean(workspace->urgent));
|
||||
json_object_object_add(object, "representation", workspace->representation ?
|
||||
|
|
Loading…
Add table
Reference in a new issue