"get_string_from_pipe: Assertion len>0 failed; aborting." in log_from_pipe() for tor-fw-helper
The changes of #5557 (moved) introduced this assertion failure when reading the tor-fw-helper exit status in tor_check_port_forwarding()
.
I think the problem was introduced because the new format_helper_exit_status()
appends a newline and a NUL to the message. When fgets()
in get_string_from_pipe()
loops and reads that message, it first stops reading at the newline, and then on the second iteration it reads the NUL which is a zero-length string.
Maybe format_helper_exit_status()
should return the length of useful data it wrote, and then only write()
that many bytes to stdout in tor_spawn_background()
?
(You can reproduce this by using PortForwarding
with a wrong PortForwardingHelper
path.)