mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
change old lookup algorithm
This commit is contained in:
parent
8e9582bede
commit
37e8cba181
@ -343,41 +343,15 @@ int geo_lookup(modsec_rec *msr, geo_rec *georec, const char *target, char **erro
|
||||
/* NOTE: This is hard-coded for size 3 records */
|
||||
/* Left */
|
||||
if ((ipnum & (1 << level)) == 0) {
|
||||
//rec_val = buf[0] +
|
||||
// (buf[1] << 8) +
|
||||
// (buf[2] << 16);
|
||||
rec_val = (buf[3*0 + 0] << (0*8)) +
|
||||
(buf[3*0 + 1] << (1*8)) +
|
||||
(buf[3*0 + 2] << (2*8));
|
||||
/*j = 3;
|
||||
p = &buf[2*j];
|
||||
x = 0;
|
||||
do {
|
||||
x <<= 8;
|
||||
x += *(--p);
|
||||
} while ( --j );
|
||||
rec_val = x;
|
||||
*/
|
||||
}
|
||||
/* Right */
|
||||
else {
|
||||
//rec_val = buf[3] +
|
||||
// (buf[4] << 8) +
|
||||
// (buf[5] << 16);
|
||||
rec_val = (buf[3*1 + 0] << (0*8)) +
|
||||
(buf[3*1 + 1] << (1*8)) +
|
||||
(buf[3*1 + 2] << (2*8));
|
||||
|
||||
/*j = 3;
|
||||
p = &buf[1*j];
|
||||
x = 0;
|
||||
do {
|
||||
x <<= 8;
|
||||
x += *(--p);
|
||||
} while ( --j );
|
||||
|
||||
rec_val = x;
|
||||
*/
|
||||
}
|
||||
|
||||
/* If we are past the country offset, then we are done */
|
||||
|
Loading…
x
Reference in New Issue
Block a user