Skip to content

Commit

Permalink
fixes nanomsg#954 large message fails with no error message
Browse files Browse the repository at this point in the history
This removes the default 1MB limit on maximum receive sizes.
Applications intended for deployment in insecure or hostile
environments should choose a sensible default for NNG_OPT_RECVMAXSZ.
  • Loading branch information
gdamore committed Jul 18, 2019
1 parent 8545c41 commit 4dcfdd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/man/nng_options.5.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ large message, without sending any data.
This option can be set for the socket, but may be overridden for on a
per-dialer or per-listener basis.
+
IMPORTANT: Applications on hostile networks should set this to a non-zero
value to prevent denial-of-service attacks.
+
NOTE: Some transports may have further message size restrictions.

[[NNG_OPT_RECVTIMEO]]
Expand Down
2 changes: 1 addition & 1 deletion src/core/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ nni_sock_create(nni_sock **sp, const nni_proto *proto)
s->s_rcvtimeo = -1;
s->s_reconn = NNI_SECOND;
s->s_reconnmax = 0;
s->s_rcvmaxsz = 1024 * 1024; // 1 MB by default
s->s_rcvmaxsz = 0; // unlimited by default
s->s_id = 0;
s->s_refcnt = 0;
s->s_self_id = proto->proto_self;
Expand Down

0 comments on commit 4dcfdd6

Please sign in to comment.