From 11d550cca7037c75ed7d45e5f16b08996ee4ccf9 Mon Sep 17 00:00:00 2001 From: jraylan Date: Sat, 8 Feb 2025 01:14:42 -0300 Subject: [PATCH] Prevent UnicodeDecodeError parsing iptables rule with comments If one or more iptables rule contains a comment with a non-unicode character, an UnicodeDecodeError would be raised. --- sshuttle/linux.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sshuttle/linux.py b/sshuttle/linux.py index 5055fc0..ea5f954 100644 --- a/sshuttle/linux.py +++ b/sshuttle/linux.py @@ -20,7 +20,7 @@ def ipt_chain_exists(family, table, name): argv = [cmd, '-w', '-t', table, '-nL'] try: output = ssubprocess.check_output(argv, env=get_env()) - for line in output.decode('ASCII').split('\n'): + for line in output.decode('ASCII', errors='replace').split('\n'): if line.startswith('Chain %s ' % name): return True except ssubprocess.CalledProcessError as e: