git: 45d75e3ac3fb - main - netgraph/ng_base: Allow larger BINARY2ASCII conversions

Lutz Donnerhacke lutz at donnerhacke.de
Mon Feb 8 16:08:23 UTC 2021


On Mon, Feb 08, 2021 at 10:18:06AM -0500, Mark Johnston wrote:
> On Mon, Feb 08, 2021 at 01:35:11PM +0000, Lutz Donnerhacke wrote:
> > The branch main has been updated by donner:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=45d75e3ac3fb5bf8230ca28dc09b48c6e5ed7a4f
> > 
> > commit 45d75e3ac3fb5bf8230ca28dc09b48c6e5ed7a4f
> > Author:     Lutz Donnerhacke <donner at FreeBSD.org>
> > AuthorDate: 2021-02-07 21:07:34 +0000
> > Commit:     Lutz Donnerhacke <donner at FreeBSD.org>
> > CommitDate: 2021-02-08 13:31:58 +0000
> > 
> >     netgraph/ng_base: Allow larger BINARY2ASCII conversions
> >     
> >     Allocate the necessary memory for the conversion dynamically starting
> >     with a value which is sufficient for almost all normal cases.
> 
> Is there some upper bound on the length of the input message?

Yes. Quote from D23840:

: Of course, to transmit the data via the ng_socket, the buffer sizes needs
: to be adjusted manually.

: net.graph.recvspace: 204800
: net.graph.maxdgram: 204800

: To transmit arbitary large data, it's better to change the ng_socket
: interface (incl. libnetgraph), but that is out of scope of this issue
: here.

> If not, a sufficiently large input looks like it could cause an infinite
> loop by triggering overflow in the bufSize *= 2 calculation.

That's a valid point. Thank you.

> I also wonder why the same change was not made for ASCII2BINARY.

Because it's usually a compression. If you are able to send the ASCII
message, the binary message is shorter and will match anyway.  But to answer
your question: It was not part of the PR, it's an nonissue.



More information about the dev-commits-src-all mailing list