ports/154057: [patch] graphics/libgphoto2: Fix segfault
Lucius Windschuh
lwindschuh at gmail.com
Sun Jan 16 14:40:12 UTC 2011
>Number: 154057
>Category: ports
>Synopsis: [patch] graphics/libgphoto2: Fix segfault
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Jan 16 14:40:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Lucius Windschuh
>Release: 9-CURRENT r217289
>Organization:
>Environment:
FreeBSD t400 9.0-CURRENT FreeBSD 9.0-CURRENT #27 r217289MP: Tue Jan 11 23:12:48 CET 2011 root at t400:/usr/obj/usr/src/sys/CURRENT i386
>Description:
libgphoto2 segfaults with some USB devices, at leat on 9-CURRENT, because it missed a check on libusb's returned structures. This problem is fixed in the libgphoto2 SVN (r12693), but not in the current release.
So please put the attached patch in files/ so that libghoto2 becomes more robust.
>How-To-Repeat:
gphoto2 -l -> Segfault (at least with my USB devices)
>Fix:
Put the attached patch into files/
Patch attached with submission follows:
--- libgphoto2_port/usb/libusb.c.old 2011-01-16 15:22:21.000000000 +0100
+++ libgphoto2_port/usb/libusb.c 2011-01-16 15:21:57.000000000 +0100
@@ -824,23 +824,25 @@
* MTP interface descriptions, that's how they can be detected, before
* we try the more esoteric "OS descriptors" (below).
*/
- for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
- unsigned int j;
- for (j = 0; j < dev->config[i].bNumInterfaces; j++) {
- int k;
- for (k = 0; k < dev->config[i].interface[j].num_altsetting; k++) {
- buf[0] = '\0';
- ret = usb_get_string_simple(devh,
- dev->config[i].interface[j].altsetting[k].iInterface,
- (char *) buf,
- 1024);
- if (ret < 3)
- continue;
- if (strcmp((char *) buf, "MTP") == 0) {
- gp_log (GP_LOG_DEBUG, "mtp matcher", "Configuration %d, interface %d, altsetting %d:\n", i, j, k);
- gp_log (GP_LOG_DEBUG, "mtp matcher", " Interface description contains the string \"MTP\"\n");
- gp_log (GP_LOG_DEBUG, "mtp matcher", " Device recognized as MTP, no further probing.\n");
- goto found;
+ if(dev->config) {
+ for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
+ unsigned int j;
+ for (j = 0; j < dev->config[i].bNumInterfaces; j++) {
+ int k;
+ for (k = 0; k < dev->config[i].interface[j].num_altsetting; k++) {
+ buf[0] = '\0';
+ ret = usb_get_string_simple(devh,
+ dev->config[i].interface[j].altsetting[k].iInterface,
+ (char *) buf,
+ 1024);
+ if (ret < 3)
+ continue;
+ if (strcmp((char *) buf, "MTP") == 0) {
+ gp_log (GP_LOG_DEBUG, "mtp matcher", "Configuration %d, interface %d, altsetting %d:\n", i, j, k);
+ gp_log (GP_LOG_DEBUG, "mtp matcher", " Interface description contains the string \"MTP\"\n");
+ gp_log (GP_LOG_DEBUG, "mtp matcher", " Device recognized as MTP, no further probing.\n");
+ goto found;
+ }
}
}
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list