RDKB-64347: Fixing coverity issues#1218
Open
bharathivelp wants to merge 1 commit into
Open
Conversation
Reason for change: Fixing Low priority coverity issues. Test Procedure: Build should be successful and the regression test should also succeed. Risks: Low Priority: P1 Signed-off-by: Velpula_Bharathi@comcast.com
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses low-priority Coverity findings by hardening memory and string handling in utility and Wi-Fi control paths.
Changes:
- Add realloc failure handling when appending to the global
ovsh_where_exprlist. - Prevent
assoc_maclistbuffer overflows when concatenating MAC strings in kick/ACL flows. - Replace
strcpy()with bounded writes (snprintf) when building debug strings in 802.1x processing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| source/utils/ovsh.c | Adds realloc() failure handling when growing the ovsh_where_expr array. |
| source/core/wifi_ctrl_queue_handlers.c | Introduces a shared buffer-size constant and bounds-checks concatenation into assoc_maclist. |
| source/core/wifi_8021x.c | Replaces strcpy() calls with bounded string writes for debug fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1277
to
1279
| ovsh_where_expr = tmp; | ||
| ovsh_where_expr[ovsh_where_num-1] = strdup(_str); | ||
| } |
Comment on lines
+1433
to
+1442
| if (current_len + strlen(mac_str) + 2 <= MAX_MACLIST_BUFFER_SIZE) { | ||
| strncat(assoc_maclist, mac_str, MAX_MACLIST_BUFFER_SIZE - current_len - 1); | ||
| strncat(assoc_maclist, ",", MAX_MACLIST_BUFFER_SIZE - strlen(assoc_maclist) - 1); | ||
| has_successful_operations = true; | ||
| } else { | ||
| wifi_util_error_print(WIFI_CTRL, "%s:%d assoc_maclist buffer overflow avoided, undoing ACL operation for %s\n", __func__, __LINE__, mac_str); | ||
| if (handle_acl_operation(vap_index, mac_str, vap_info, rdk_vap_info, false) != RETURN_OK) { | ||
| wifi_util_error_print(WIFI_CTRL, "%s:%d Failed to undo ACL operation after assoc_maclist overflow for %s\n", __func__, __LINE__, mac_str); | ||
| } | ||
| } |
Comment on lines
+133
to
+137
| snprintf(msg, sizeof(msg), "%s", "response"); | ||
| } else if (eap->code == wifi_eap_code_success) { | ||
| strcpy(msg, "success"); | ||
| snprintf(msg, sizeof(msg), "%s", "success"); | ||
| } else if (eap->code == wifi_eap_code_failure) { | ||
| strcpy(msg, "failure"); | ||
| snprintf(msg, sizeof(msg), "%s", "failure"); |
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.
Reason for change: Fixing Low priority coverity issues.
Test Procedure: Build should be successful and the regression test should also succeed.
Risks: Low
Priority: P1
Signed-off-by: Velpula_Bharathi@comcast.com