-
Notifications
You must be signed in to change notification settings - Fork 367
isIpAddr to not Return True when Extra Characters Follow IP Address #2182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
|
||
| // Check if IPv6 address. | ||
| offset = 0; | ||
| if (sscanf(hostname, "%x:%x:%x:%x:%x:%x:%x:%x%n", &ip_1, &ip_2, &ip_3, &ip_4, &ip_5, &ip_6, &ip_7, &ip_8, &offset) == 8 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do checks here as similar to the <= 255 done for IPv4?
| return status; | ||
|
|
||
| // Check if IPv4 address. | ||
| if (sscanf(hostname, "%u.%u.%u.%u%n", &ip_1, &ip_2, &ip_3, &ip_4, &offset) == 4 && ip_1 <= 255 && ip_2 <= 255 && ip_3 <= 255 && ip_4 <= 255 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the IPV4/IPV6 template still used?
Also suggest to use the macro version SSCANF and STRLEN
|
Would like to see a new testcase added for the ?transport=udp mentioned |
Issue #, if available:
What was changed?
isIpAddrnow considers the length of the inputted string compared to the IP-format-matched string.Why was it changed?
isIpAddrfunction.How was it changed?
What testing was done for the changes?
isIpaddr), and resulted in a successful relayed WebRTC streaming session.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.