summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2011-05-19 01:50:45 +0200
committerGravatar Nikias Bassen2011-05-19 01:50:45 +0200
commit5c10f12e408b11afbd7c3cc93ddf7d85f1527417 (patch)
tree590a78f0532e8b473699d27312b1aec8fa17908a /tools
parent27d0da3bc196d28c1095e7c74054f5a6efb7ccf2 (diff)
downloadlibimobiledevice-5c10f12e408b11afbd7c3cc93ddf7d85f1527417.tar.gz
libimobiledevice-5c10f12e408b11afbd7c3cc93ddf7d85f1527417.tar.bz2
ideviceinfo: fix possible segmentation fault when parsing empty data nodes
Thanks to Gordon Assaf for pointing this out.
Diffstat (limited to 'tools')
-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: