New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows diverter unassigned local variable usage #109

Closed
strictlymike opened this Issue Feb 5, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@strictlymike
Copy link
Contributor

strictlymike commented Feb 5, 2019

FakeNet's PyDivert exception handling in windows.py mixes and matches local variable names for the user-friendly protocol description (protocol vs. proto) resulting in a UnboundLocalError being raised due to proto being referenced before assignment in error cases involving ICMP.

                    protocol = 'Unknown'

                    if pkt.proto:
                        protocol = pkt.proto
                    elif pkt.is_icmp:
                        proto = 'ICMP'

                    self.logger.error('ERROR: Failed to send %s %s %s packet',
                                      self.pktDirectionStr(pkt),
                                      self.pktInterfaceStr(pkt), proto)

The variable usage needs to be made consistent to prevent the exception.

strictlymike added a commit that referenced this issue Feb 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment