Opened 9 years ago

Closed 2 years ago

Last modified 2 years ago

#2045 closed defect (fixed)

Make tor_check_port_forwarding handle incomplete lines

Reported by: sjmurdoch Owned by: sjmurdoch
Priority: Medium Milestone: Tor: 0.3.1.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-relay
Cc: ahf Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

The code for parsing the output of tor-fw-helper uses fgets() on a non-blocking file descriptor to fetch each line of output. This appears to not handle incomplete lines properly. Rather than buffering data until a complete line is returned, fgets will return an incomplete line and set errno to be EAGAIN. fgets() should be replaced with something which can handle incomplete lines.

Issue was originally raised by nickm in bug #1903 and there is some further discussion in that ticket.

Child Tickets

Change History (20)

comment:1 Changed 9 years ago by nickm

Milestone: Tor: 0.2.3.x-final

comment:2 Changed 8 years ago by sjmurdoch

There is a corresponding problem in Windows, with log_from_handle(). A fix to this bug should also be applied to fix the Windows case too.

comment:3 Changed 7 years ago by sjmurdoch

Status: newaccepted

comment:4 Changed 7 years ago by sjmurdoch

Status: acceptedassigned

comment:5 Changed 7 years ago by sjmurdoch

My progress on this can be found in https://trac.torproject.org/projects/tor/ticket/2045

Currently it doesn't compile (and is incomplete), so needs squashing before being merged.

comment:6 Changed 7 years ago by Sebastian

Wait, the link you provided here points back to this page. Where did you really want to link to?

comment:7 in reply to:  6 Changed 7 years ago by sjmurdoch

Replying to Sebastian:

Wait, the link you provided here points back to this page. Where did you really want to link to?

Oops, I meant https://gitweb.torproject.org/sjm217/tor.git/shortlog/refs/heads/bug2045

comment:8 Changed 7 years ago by nickm

Milestone: Tor: 0.2.3.x-finalTor: 0.2.4.x-final
Parent ID: #1775

comment:9 Changed 7 years ago by nickm

Keywords: tor-relay added

comment:10 Changed 7 years ago by nickm

Component: Tor RelayTor

comment:11 Changed 6 years ago by nickm

Milestone: Tor: 0.2.4.x-finalTor: 0.2.5.x-final

comment:12 Changed 5 years ago by nickm

Milestone: Tor: 0.2.5.x-finalTor: 0.2.???

comment:13 Changed 4 years ago by sjmurdoch

Status: assignednew

I'm unlikely to have time in the near future to do this. Sorry.

comment:14 Changed 3 years ago by pingl

Severity: Normal
Last edited 3 years ago by pingl (previous) (diff)

comment:15 Changed 3 years ago by teor

Milestone: Tor: 0.2.???Tor: 0.3.???

Milestone renamed

comment:16 Changed 2 years ago by nickm

Keywords: tor-03-unspecified-201612 added
Milestone: Tor: 0.3.???Tor: unspecified

Finally admitting that 0.3.??? was a euphemism for Tor: unspecified all along.

comment:17 Changed 2 years ago by nickm

Keywords: tor-03-unspecified-201612 removed

Remove an old triaging keyword.

comment:18 Changed 2 years ago by nickm

Cc: ahf added
Milestone: Tor: unspecifiedTor: 0.3.1.x-final
Resolution: fixed
Status: newclosed

I think we fixed this when we fixed #21654

comment:19 in reply to:  2 Changed 2 years ago by arma

Replying to sjmurdoch:

There is a corresponding problem in Windows, with log_from_handle(). A fix to this bug should also be applied to fix the Windows case too.

Did the #21654 fix resolve the Windows log_from_handle() case too?

comment:20 Changed 2 years ago by nickm

Opened #22380 to handle that case.

(edited to fix bug number)

Last edited 2 years ago by nickm (previous) (diff)
Note: See TracTickets for help on using tickets.