mirror of
https://github.com/nmap/nmap.git
synced 2026-10-20 19:01:56 +00:00
Change the test for the failure of strtol in the OS scan point-matching code.
Previously the code checked for a zero (or negative) return value, but I want to assign some tests a value of 0 during OS scan refinement. Now it checks errno, makes sure the entire value was consumed, and errors on negative numbers. In addition to allowing values of 0, this change catches bogus values where garbage follows the number.
This commit is contained in:
parent
d16e94534f
commit
3517f3965e
1 changed files with 2 additions and 1 deletions
|
|
@ -264,8 +264,9 @@ static int AVal_match(struct AVal *reference, struct AVal *fprint, struct AVal *
|
|||
if (points) {
|
||||
current_points = getattrbyname(points, current_ref->attribute);
|
||||
if (!current_points) fatal("%s: Failed to find point amount for test %s.%s", __func__, testGroupName? testGroupName : "", current_ref->attribute);
|
||||
errno = 0;
|
||||
pointsThisTest = strtol(current_points->value, &endptr, 10);
|
||||
if (pointsThisTest < 1)
|
||||
if (errno != 0 || *endptr != '\0' || pointsThisTest < 0)
|
||||
fatal("%s: Got bogus point amount (%s) for test %s.%s", __func__, current_points->value, testGroupName? testGroupName : "", current_ref->attribute);
|
||||
}
|
||||
subtests += pointsThisTest;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue