Make whitelist parser more robust against comments. I assumed perfectly arranged white lists until now

dynamic-accesslists
erdgeist 15 years ago
parent d42bf5a031
commit 3636be6cc7

@ -59,20 +59,23 @@ static void accesslist_readfile( void ) {
read_offs = map;
/* We do ignore anything that is not of the form "^[:xdigit:]{40}[^:xdigit:].*" */
while( read_offs < map_end ) {
while( read_offs + 40 <= map_end ) {
int i;
for( i=0; i<(int)sizeof(ot_hash); ++i ) {
int eger = 16 * scan_fromhex( read_offs[ 2*i ] ) + scan_fromhex( read_offs[ 1 + 2*i ] );
if( eger < 0 )
continue;
(*info_hash)[i] = eger;
int eger1 = scan_fromhex( read_offs[ 2*i ] );
int eger2 = scan_fromhex( read_offs[ 1 + 2*i ] );
if( eger1 < 0 || eger2 < 0 )
break;
(*info_hash)[i] = eger1 * 16 + eger2;
}
if( i == sizeof(ot_hash) ) {
read_offs += 40;
/* Append accesslist to accesslist vector */
if( scan_fromhex( *read_offs ) < 0 )
if( read_offs == map_end || scan_fromhex( *read_offs ) < 0 )
++info_hash;
}
/* Find start of next line */
while( read_offs < map_end && *(read_offs++) != '\n' );

Loading…
Cancel
Save