From 9aa8090d069eb0b36769f33544faf0e7e429e844 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 24 Apr 2015 14:34:32 +0100 Subject: [base16] Add buffer size parameter to base16_encode() and base16_decode() The current API for Base16 (and Base64) encoding requires the caller to always provide sufficient buffer space. This prevents the use of the generic encoding/decoding functionality in some situations, such as in formatting the hex setting types. Implement a generic hex_encode() (based on the existing format_hex_setting()), implement base16_encode() and base16_decode() in terms of the more generic hex_encode() and hex_decode(), and update all callers to provide the additional buffer length parameter. Signed-off-by: Michael Brown --- src/interface/efi/efi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/interface') diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c index e426c795e..473803951 100644 --- a/src/interface/efi/efi_debug.c +++ b/src/interface/efi/efi_debug.c @@ -330,7 +330,7 @@ const char * efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path ) { max_len = ( ( sizeof ( text ) - 1 /* NUL */ ) / 2 /* "xx" */ ); if ( len > max_len ) len = max_len; - base16_encode ( start, len, text ); + base16_encode ( start, len, text, sizeof ( text ) ); return text; } -- cgit v1.2.3-55-g7522