Since the .Next field is a pointer, it needs to be dereferenced. Given the structure of the while loop, the correct code is:
ip_addr_string = ip_addr_string.Next.contents if ip_addr_string.Next else None
The bug probably hasn't been noticed if the code was tested on a machine with only one DNS nameserver IP address. If your machine has 2 or more DNS nameserver IP addresses, the code crashes on the 2nd time through the loop.
This code is wrong:
https://github.com/fireeye/flare-fakenet-ng/blob/596bb139b59eb15323510ed41e33661a40c8d80c/fakenet/diverters/winutil.py#L1102
Since the
.Next
field is a pointer, it needs to be dereferenced. Given the structure of thewhile
loop, the correct code is:The bug probably hasn't been noticed if the code was tested on a machine with only one DNS nameserver IP address. If your machine has 2 or more DNS nameserver IP addresses, the code crashes on the 2nd time through the loop.