summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2011-05-19 01:50:45 +0200
committerGravatar Martin Szulecki2012-03-22 18:48:47 +0100
commitba92c353c07fa006ac744ce6280714650a25a6ad (patch)
treef036a7a84d512a0be07d829d1c196ca8d270f930
parente16fc4b4be279e1a7be7760191263e0bb40cdd28 (diff)
downloadlibimobiledevice-ba92c353c07fa006ac744ce6280714650a25a6ad.tar.gz
libimobiledevice-ba92c353c07fa006ac744ce6280714650a25a6ad.tar.bz2
ideviceinfo: fix possible segmentation fault when parsing empty data nodes
Thanks to Gordon Assaf for pointing this out.
-rw-r--r--tools/ideviceinfo.c12
1 files changed, 8 insertions, 4 deletions
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: