{packet, 4}

Kenneth Lundin kenneth.lundin@REDACTED
Fri Apr 17 12:04:23 CEST 2020


*Yes look at the packet_size option*
*{packet_size, Integer}(TCP/IP sockets)*

Sets the maximum allowed length of the packet body. If the packet header
indicates that the length of the packet is longer than the maximum allowed
length, the packet is considered invalid. The same occurs if the packet
header is too large for the socket receive buffer.
/Kenneth
On Fri, Apr 17, 2020 at 11:55 AM Roberto Ostinelli <ostinelli@REDACTED>
wrote:

> Forgot to add: is packet_size the option that I can use to circumvent this?
>
> Thanks,
> r.
>
> On Fri, Apr 17, 2020 at 11:49 AM Roberto Ostinelli <ostinelli@REDACTED>
> wrote:
>
>> All,
>> Hope you are safe and well.
>>
>> This is probably a stupid question and I probably need more coffe, but...
>> if I use {packet, 4} as a transport option on a server that uses a binary
>> protocol, it means that it might wait for up to 256^4 so 4,294,967,296
>> bytes of data. If I'm not mistaken, then this could be an easy target for
>> DDoS attacks (client are not necessarily well-known).
>>
>> Unfortunately this server needs to be able to receive data messages up to
>> 250k of size in JSON format, so {packet, 2} is not an option.
>>
>> Is my only option to set {packet, raw} and run a streamed json parser, or
>> is there another way to limit the amount of data in some other way?
>>
>> Thank you,
>> r.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200417/023926f4/attachment.htm>


More information about the erlang-questions mailing list