SWRDKV-5382: NTS cases fix.#204
Open
jianwang-brcm wants to merge 1 commit into
Open
Conversation
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 hardens DIAL POST payload handling to be length-aware (avoiding reliance on NUL-termination) and prevents a possible NULL dereference when comparing client DIAL versions.
Changes:
- Use
msg->request_body->length+g_strndup()for safe payload handling, and add a special-case for Netflix similar to YouTube. - Ensure temporary payload buffers are freed after URI encoding.
- Guard
compare_versions()againstclient_dial_version == NULL.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| server/gdial-rest.c | Makes POST payload handling length-based and adds Netflix handling; adjusts encoding path to copy bounded input. |
| server/gdial-app.c | Adds a NULL check before version comparison to avoid dereferencing a NULL client version string. |
💡 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); |
Comment on lines
+481
to
484
| if (g_str_has_prefix(app->name, "YouTube") || g_str_has_prefix(app->name, "Netflix")) { | ||
| /* temporary disabling encoding payload for YouTube till cloud side changed*/ | ||
| payload_safe = g_strdup(payload); | ||
| payload_safe = g_strndup(payload, msg->request_body->length); | ||
| } |
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.
No description provided.