This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Andrey Wagin, benjamin.peterson, berker.peksag, martin.panter
Date 2016-04-27.03:38:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1461728299.94.0.12703526832.issue24933@psf.upfronthosting.co.za>
In-reply-to
Content
As far as I know, passing MSG_TRUNC into recv() is Linux-specific. I guess the “right” portable way to get a message size is to know it in advance, or guess and expand the buffer if MSG_PEEK cannot return the whole message.

Andrey: I don’t think we are accessing _unallocated_ memory (which could crash Python). If you look at _PyBytes_Resize(), I think it correctly allocates the memory, and just leaves it uninitialized.

Some options:

* Document that arbitrary flags like Linux’s MSG_TRUNC not supported
* Limit the returned buffer to the original buffer size
* Raise an exception or warning if recv() returns more than the original buffer size
* Reject unsupported flags like MSG_TRUNC
* Initialize the expanded buffer with zeros
History
Date User Action Args
2016-04-27 03:38:19martin.pantersetrecipients: + martin.panter, benjamin.peterson, berker.peksag, Andrey Wagin
2016-04-27 03:38:19martin.pantersetmessageid: <1461728299.94.0.12703526832.issue24933@psf.upfronthosting.co.za>
2016-04-27 03:38:19martin.panterlinkissue24933 messages
2016-04-27 03:38:19martin.pantercreate