Fixes DIAL server crashing or rejecting valid DIAL POST payloads, and prevents null-pointer crashes. - #205
Open
yulian5 wants to merge 1 commit into
Open
Fixes DIAL server crashing or rejecting valid DIAL POST payloads, and prevents null-pointer crashes.#205yulian5 wants to merge 1 commit into
yulian5 wants to merge 1 commit into
Conversation
and prevents null-pointer crashes. These changes fix Netflix NTS tests: DIAL-002-TC2, DIAL-002-TC4
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR improves robustness when handling POST request payloads and DIAL client version comparisons by avoiding unsafe string assumptions and preventing null dereferences.
Changes:
- Treat request bodies as length-delimited buffers (use
msg->request_body->lengthwithg_strndup) and expand the “no-encoding” exception to include Netflix. - Add a null check before calling
compare_versions()ingdial_app_state_response_new.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| server/gdial-rest.c | Switch payload handling to length-aware copies and adjust app-specific encoding behavior. |
| server/gdial-app.c | Prevent null dereference by guarding compare_versions() against NULL input. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+486
to
+491
| gchar *tmp_payload = g_strndup(payload, msg->request_body->length); | ||
| char *tmp = soup_uri_encode(tmp_payload, "=&"); | ||
| // note that we later g_free(payload_safe) which doesn't necessarily work with malloc'ed memory (seems to depend on glib version) | ||
| payload_safe = g_strdup(tmp); | ||
| free(tmp); | ||
| g_free(tmp_payload); |
| char *tmp = soup_uri_encode(payload, "=&"); | ||
| gchar *tmp_payload = g_strndup(payload, msg->request_body->length); | ||
| char *tmp = soup_uri_encode(tmp_payload, "=&"); | ||
| // note that we later g_free(payload_safe) which doesn't necessarily work with malloc'ed memory (seems to depend on glib version) |
Comment on lines
+512
to
515
| if(client_dial_version != NULL && compare_versions(client_dial_version, "2.1") < 0) { | ||
| GDIAL_LOGINFO("gdial_app_state_response_new client: %s less than 2.1", (client_dial_version != NULL) ? client_dial_version : "-- none --"); | ||
| state = (state == GDIAL_APP_STATE_HIDE) ? GDIAL_APP_STATE_STOPPED : state; | ||
| } |
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes fix Netflix NTS tests: DIAL-002-TC2, DIAL-002-TC4