Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/firewall/firewall.c
Original file line number Diff line number Diff line change
Expand Up @@ -8980,7 +8980,7 @@ memset(buf, 0, sizeof(buf));
{
errno = 0;
numDev = strtol(buf, &endptr, 10);
if (endptr == buf || *endptr != '\0' || errno == ERANGE)
if (endptr == buf || (*endptr != '\0' && *endptr != '\n') || errno == ERANGE)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this fix correctly solves the immediate issue, it deviates from the established pattern in this codebase for handling newlines after fgets. At line 8474, the codebase explicitly strips the newline character after reading with fgets by checking the length and replacing the newline with a null terminator. Consider refactoring to follow this same pattern for consistency: after line 8982, check if the string ends with a newline and replace it with a null terminator before validation. This would make the validation check simpler and more consistent with the rest of the codebase.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

{
FIREWALL_DEBUG("invalid data\n");
break;
Expand Down
Loading