Skip to content

Commit

Permalink
#2207 properly escape signal app and title properties
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Apr 3, 2024
1 parent 4132a4d commit 7d04856
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Config *global setting* `auto_balance` is now categorized as a *space setting* instead [#2200](https:/koekeishiya/yabai/issues/2200)
- Rule property space should have higher precedence than display [#2206](https:/koekeishiya/yabai/issues/2206)
- Properly escape app and title regex when listing rules [#2205](https:/koekeishiya/yabai/issues/2205)
- Properly escape app and title regex when listing signals [#2207](https:/koekeishiya/yabai/issues/2207)

## [7.0.4] - 2024-03-30
### Changed
Expand Down
14 changes: 10 additions & 4 deletions src/event_signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,13 @@ static void event_signal_serialize(FILE *rsp, struct signal *signal, enum signal
{
TIME_FUNCTION;

char *escaped_action = ts_string_escape(signal->command);
char *app = signal->app;
char *title = signal->title;
char *cmd = signal->command;

char *escaped_app = app ? ts_string_escape(app) : NULL;
char *escaped_title = title ? ts_string_escape(title) : NULL;
char *escaped_cmd = cmd ? ts_string_escape(cmd) : NULL;

fprintf(rsp,
"{\n"
Expand All @@ -415,11 +421,11 @@ static void event_signal_serialize(FILE *rsp, struct signal *signal, enum signal
"}",
index,
signal->label ? signal->label : "",
signal->app ? signal->app : "",
signal->title ? signal->title : "",
escaped_app ? escaped_app : app ? app : "",
escaped_title ? escaped_title : title ? title : "",
json_optional_bool(signal->active),
signal_type_str[type],
escaped_action ? escaped_action : signal->command ? signal->command : "");
escaped_cmd ? escaped_cmd : cmd ? cmd : "");
}

void event_signal_list(FILE *rsp)
Expand Down

0 comments on commit 7d04856

Please sign in to comment.