]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[base16] Ensure base16_encode() always terminates its result string
authorMichael Brown <mcb30@ipxe.org>
Sun, 14 Jul 2013 22:06:45 +0000 (00:06 +0200)
committerMichael Brown <mcb30@ipxe.org>
Sun, 14 Jul 2013 22:06:45 +0000 (00:06 +0200)
commit49d14f0d8d9291e3a98c6bfd9005b3c6bb85e6c8
tree1b6fcb109dd488870b717e96ab701f3a787d7f5d
parent6ad05aa319f69c110ffe3bdd1bbb67b5f778cbe3
[base16] Ensure base16_encode() always terminates its result string

base16_encode() will fail to generate a terminating NUL if the length
of the raw data is zero, since the loop calling sprintf() will never
execute.

Fix by explicitly terminating the result with a NUL.

Reported-by: Marin Hannache <git@mareo.fr>
Debugged-by: Marin Hannache <git@mareo.fr>
Tested-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/base16.c