diff -Naur avarice-2.10/src/jtag2usb.cc avarice-2.10-mod/src/jtag2usb.cc --- avarice-2.10/src/jtag2usb.cc 2007-02-18 00:41:46.000000000 +0200 +++ avarice-2.10-mod/src/jtag2usb.cc 2010-06-22 17:58:04.000000000 +0300 @@ -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",