From 177602e4d27aad4868b55b48689ebc68e8e2457a Mon Sep 17 00:00:00 2001 From: Jens Wiklander Date: Thu, 8 Dec 2016 19:12:30 +0100 Subject: [PATCH] Format UUID strings correctly Prior to this patch although GlobalPlatform specifies that TAs and such are identified with UUIDs, we don't format them quite right when turning them into strings. Per https://www.ietf.org/rfc/rfc4122.txt, there should be another hyphen after the first two bytes of clockSeqAndNode. Unfortunately, fixing this breaks compatibility between how TAs are built, and when the OS loads them. With this patch UUID string are formated with the additional hyphen as for instance: f81d4fae-7dec-11d0-a765-00a0c91e6bf6 Fixes: https://github.com/OP-TEE/optee_os/issues/857 Tested-by: Jens Wiklander (QEMU) Signed-off-by: Jens Wiklander --- lib/libutils/ext/snprintk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libutils/ext/snprintk.c b/lib/libutils/ext/snprintk.c index eea38a26083..a9e93daec04 100644 --- a/lib/libutils/ext/snprintk.c +++ b/lib/libutils/ext/snprintk.c @@ -80,7 +80,7 @@ #define NOLOCK 0x1000 /* don't acquire a tty lock */ /* max size buffer kprintf needs to print a UUID */ -#define KPRINTF_BUFSIZE 36 +#define KPRINTF_BUFSIZE 37 /* * The following macro is used to remove const cast-away warnings @@ -220,7 +220,7 @@ static int uuid2str(char *dst, size_t size, void *ptr) } *uuid = ptr; return snprintk(dst, size, - "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x", + "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", uuid->lo, uuid->mid, uuid->hi_ver, uuid->seq_n[0], uuid->seq_n[1], uuid->seq_n[2], uuid->seq_n[3],