From 5c10f12e408b11afbd7c3cc93ddf7d85f1527417 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 19 May 2011 01:50:45 +0200 Subject: ideviceinfo: fix possible segmentation fault when parsing empty data nodes Thanks to Gordon Assaf for pointing this out. --- tools/ideviceinfo.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c index e05165b..c5c060e 100644 --- a/tools/ideviceinfo.c +++ b/tools/ideviceinfo.c @@ -160,10 +160,14 @@ static void plist_node_to_string(plist_t node) case PLIST_DATA: plist_get_data_val(node, &data, &u); - s = g_base64_encode((guchar *)data, u); - free(data); - printf("%s\n", s); - g_free(s); + if (u > 0) { + s = g_base64_encode((guchar *)data, u); + free(data); + printf("%s\n", s); + g_free(s); + } else { + printf("\n"); + } break; case PLIST_DATE: -- cgit v1.1-32-gdbae