Skip to content

fix: guard NULL dereference in parse_window_size on invalid JSON - #1545

Open
Cherrling wants to merge 1 commit into
tsl0922:mainfrom
Cherrling:fix/null-deref-parse-window-size
Open

fix: guard NULL dereference in parse_window_size on invalid JSON#1545
Cherrling wants to merge 1 commit into
tsl0922:mainfrom
Cherrling:fix/null-deref-parse-window-size

Conversation

@Cherrling

Copy link
Copy Markdown

When json_tokener_parse_ex fails (invalid JSON), it returns NULL. The old code passed this NULL directly to json_object_object_get_ex, causing undefined behavior / crash on older json-c versions.

Also guard the JSON_DATA call site where obj is used for AuthToken lookup without a NULL check.

Fixes: NULL pointer dereference via RESIZE_TERMINAL or JSON_DATA with malformed JSON payload (no auth required for RESIZE_TERMINAL).

When json_tokener_parse_ex fails (invalid JSON), it returns NULL.
The old code passed this NULL directly to json_object_object_get_ex,
causing undefined behavior / crash on older json-c versions.

Also guard the JSON_DATA call site where obj is used for AuthToken
lookup without a NULL check.

Fixes: NULL pointer dereference via RESIZE_TERMINAL or JSON_DATA
with malformed JSON payload (no auth required for RESIZE_TERMINAL).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant