[wpkg-users] [Bug 192] Regular Expression Matching problem in Function getHostNode()

bugzilla-daemon at bugzilla.wpkg.org bugzilla-daemon at bugzilla.wpkg.org
Wed Oct 13 01:16:26 CEST 2010


http://bugzilla.wpkg.org/show_bug.cgi?id=192

--- Comment #1 from Erik Ringsmuth <erikr at grrl.lib.mn.us>  ---
I looked into this further and realized that the host name "GRRL-..[^Pp].+"
matches the format of an IP address.  Any name with exactly three periods is
assumed to be an IP address.  The code calls parseInt() on each octet of the IP
address (in this case "GRRL-", "", "[^Pp]", and "+") which returns null for all
these values.  Each octet of the computer's real IP address is compared against
the null values which will always return false.  Because these checks fail the
match is assumed to be true and all computers are assigned the profile-id
assigned to "GRRL-..[^Pp].+".  In fact any regular expression that has exactly
three periods in it will match any IP address.

To fix this you can add this check at line 1679 of wpkg.js right after the call
to parseInt() and right before the program checks "if (firstValue >
secondValue)" and "if ((ipOctet < firstValue || ipOctet > secondValue))"

code to insert at like 1679 of wpkg.js:

// make sure the matchOctets are numbers, not characters.
// if the matchOctet started with a character and not a number
// parseInt() will return null.  comparing a number to null
// always returns false and the next checks will be skipped
// making the match true even though it isn't an IP address.
if (firstValue == null || secondValue == null) {
    match = false;
    break;
}

-- 
Configure bugmail: http://bugzilla.wpkg.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the wpkg-users mailing list