Re: Why does libxml2 limit port numbers to 999,999,999?

Nick Wellnhofer via xml <[email protected]> Sat, 17 Oct 2020 18:32:18 +0200
Newsgroups gmane.comp.gnome.lib.xml.general,gmane.comp.emulators.guestfs
Message-ID <[email protected]>
On Oct 17, 2020, at 12:24 , Richard W.M. Jones via xml <[email protected]> wrote:
> It seems like libxml2 chose to do this for convenience rather than
> correctness.

Yes, this is an arbitrary limit introduced to avoid integer overflow.
 
> I think it should accept port numbers at least up to
> signed int (the type used to store port numbers), and give an error if
> the port number overflows.

This is fixed now: https://gitlab.gnome.org/GNOME/libxml2/-/commit/b46016b8705b041c0678dd45e445dc73674b75d0

> Also could the uri->port field be changed to unsigned int without
> breaking ABI?

It’s a public struct member, so strictly speaking, no. But the risk to break stuff seems low.

Nick

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
https://mail.gnome.org/mailman/listinfo/xml