Opened 15 years ago

Last modified 7 years ago

#140 closed defect (Fixed)

controller receives truncated INFOVALUE responses

Reported by: goodell Owned by:
Priority: Low Milestone:
Component: Core Tor/Tor Version:
Severity: Keywords:
Cc: goodell Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

The controller sometimes receives truncated INFOVALUE responses, as observed by requesting descriptors (i.e. desc/name/router). This happens because s.recv(length) apparently is not guaranteed to read the entire length. The result is what appears to the controller to be multiple messages, not in fragment form, such that the first one looks like an ordinary INFOVALUE message of incorrect length and the rest look like improperly formed messages with weird types.

[Automatically added by flyspray2trac: Operating System: All]

Child Tickets

Change History (3)

comment:1 Changed 15 years ago by goodell

This patch appears to do the trick.

<pre>
--- TorControl.py 2005-05-11 23:22:55.000000000 -0400
+++ TorControl.new.py 2005-05-11 23:22:45.000000000 -0400
@@ -209,7 +209,8 @@

header = s.recv(4)
length,type = struct.unpack("!HH",header)
if length:

  • body = s.recv(length)

+ while length > len(body):
+ body += s.recv(length)

return length,type,body


def receive_message(s):

</pre>

comment:2 Changed 15 years ago by nickm

flyspray2trac: bug closed.
patch applied

comment:3 Changed 7 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.