commit ae8a6984abe2b88c761e4815d2b09a793e4724dd
Author: Christophe Fergeau <[email protected]>
Date: Sun Jul 17 08:34:28 2011 +0200
usb: return NULL when nothing could be read from USB
ipod-usb.c:get_sysinfo_extended may return an empty string if
the device accepts our vendor specific command but immediatly
tells us there's no data to read (ie if we read 0 bytes). This
happens on the Shuffle 4g. This case was then not handled in
generic-callout.c, itdb_sysinfo_extended_parse_from_xml returns
NULL when trying to parse an empty string, and
itdb_sysinfo_properties_free would subsequently crash trying to
dereference this NULL pointer.
This bug was fixed thanks to eshat's investigations on IRC.
tools/ipod-usb.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/tools/ipod-usb.c b/tools/ipod-usb.c
index 0c4ff80..fff0215 100644
--- a/tools/ipod-usb.c
+++ b/tools/ipod-usb.c
@@ -73,6 +73,13 @@ static gchar *get_sysinfo_extended (libusb_device_handle
*handle)
}
}
/*hexdump ((guchar *)sysinfo_extended->str, sysinfo_extended->len);*/
+
+ if (sysinfo_extended->len == 0) {
+ /* Nothing could be read from USB */
+ g_string_free(sysinfo_extended, TRUE);
+ return NULL;
+ }
+
return g_string_free (sysinfo_extended, FALSE);
}
------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide. Store less, Store more with what you own, Move data to
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2