File avarice-2.10-bug2812023.patch of Package wrightflyer

--- src/jtag2usb.cc	17 Feb 2007 22:41:46 -0000	1.9
+++ src/jtag2usb.cc	25 Jun 2009 09:29:21 -0000	1.10
@@ -18,7 +18,7 @@
  * This file implements the libusb-based USB connection to a JTAG ICE
  * mkII.
  *
- * $Id: jtag2usb.cc,v 1.9 2007/02/17 22:41:46 joerg_wunsch Exp $
+ * $Id: jtag2usb.cc,v 1.10 2009/06/25 09:29:21 joerg_wunsch Exp $
  */
 
 
@@ -70,7 +70,7 @@
   struct usb_bus *bus;
   struct usb_device *dev;
   usb_dev_handle *udev;
-  char *serno, *cp2;
+  char *devnamecopy, *serno, *cp2;
   u_int16_t pid;
   size_t x;
 
@@ -85,6 +85,9 @@
       break;
     }
 
+  devnamecopy = new char[x = strlen(jtagDeviceName) + 1];
+  memcpy(devnamecopy, jtagDeviceName, x);
+
   /*
    * The syntax for usb devices is defined as:
    *
@@ -95,7 +98,7 @@
    * right-to-left, so only the least significant nibbles need to be
    * specified.
    */
-  if ((serno = strchr(jtagDeviceName, ':')) != NULL)
+  if ((serno = strchr(devnamecopy, ':')) != NULL)
     {
       /* first, drop all colons there if any */
       cp2 = ++serno;
@@ -159,6 +162,8 @@
 	    }
 	}
     }
+
+  delete devnamecopy;
   if (!found)
   {
     printf("did not find any%s USB device \"%s\"\n",

openSUSE Build Service is sponsored by