[PATCH] resolv: Support an exactly sized buffer in ns_name_pack [BZ #21359]

Florian Weimer fweimer@redhat.com
Tue Apr 11 10:26:00 GMT 2017


On 04/07/2017 03:38 PM, Florian Weimer wrote:
> 2017-04-07  Florian Weimer  <fweimer@redhat.com>
>
> 	[BZ #21359]
> 	* resolv/ns_name.c (ns_name_pack): Do not require an additional
> 	byte in the destination buffer.  Avoid out-of-bounds pointer
> 	arithmetic.
> 	* resolv/Makefile (tests): Add tst-ns_name_compress.
> 	(tst-ns_name_compress): Link with -lresolv.
> 	* resolv/tst-ns_name_compress.c: New file.
> 	* resolv/tst-resolv-basic.c (LONG_NAME): Define.
> 	(response): Recognize LONG_NAME.
> 	(do_test): Add LONG_NAME tests.
> 	* resolv/tst-ns_name.c (run_test_case): Fix expected data check
> 	for ns_name_unpack.  Add tests for ns_name_pton and
> 	ns_name_compress.

Does anybody want to review this?  It's an off-by-one error in buffer 
management after all, but fortunately in the harmless direction: it's 
impossible to completely fill the buffer, but nothing is written after 
the end of the buffer.

Thanks,
Florian



More information about the Libc-alpha mailing list