]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Clean up format_hex_ex()
authorSteffan Karger <steffan.karger@fox-it.com>
Mon, 28 Nov 2016 14:26:40 +0000 (15:26 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 28 Nov 2016 16:02:17 +0000 (17:02 +0100)
commit294040102fbceb4be320a45ba3c340ace1804a49
tree9b6d86fef6752f0192f4aa508a946326c7226db2
parent718257811b42b2bf4a7ee325a38c3cb147c53cc2
Clean up format_hex_ex()

Fix a potential null-pointer dereference, and make the code a bit more
readable while doing so.

The NULL dereference could not be triggered, because the current code
never called format_hex_ex() with maxouput == 0 and separator == NULL.
But it's nicer to not depend on that.

Our use of int vs size_t for lengths needs some attention too, but I'm
not pulling that into this patch.  Instead I decided to just make the
(previously existing) assumption that INT_MAX <= SIZE_MAX explicit by
adding a static_assert().

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1480343200-25908-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13259.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/buffer.c