From 0e6890e02481a8ffc27373fa2eb4eb96d8731edd Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 19 Jun 2012 13:37:38 +0100 Subject: [PATCH] NUL-terminate blobs from Andoird keystore Signed-off-by: David Woodhouse --- ssl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ssl.c b/ssl.c index d6fe6930..4c7e30b9 100644 --- a/ssl.c +++ b/ssl.c @@ -389,7 +389,7 @@ int keystore_fetch(const char *key, unsigned char **result) goto out_fd; } - data = malloc(st.st_size); + data = malloc(st.st_size + 1); if (!data) { ret = -ENOMEM; goto out_fd; @@ -400,6 +400,8 @@ int keystore_fetch(const char *key, unsigned char **result) free(data); goto out_fd; } + + data[st.st_size] = 0; *result = data; ret = st.st_size; out_fd: -- 2.50.1