Message264343
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 |
|
Date |
User |
Action |
Args |
2016-04-27 03:38:19 | martin.panter | set | recipients:
+ martin.panter, benjamin.peterson, berker.peksag, Andrey Wagin |
2016-04-27 03:38:19 | martin.panter | set | messageid: <1461728299.94.0.12703526832.issue24933@psf.upfronthosting.co.za> |
2016-04-27 03:38:19 | martin.panter | link | issue24933 messages |
2016-04-27 03:38:19 | martin.panter | create | |
|