>
> > first, you do a malloc() for your data struct, but you dont initialize
any of
> the pointers.  before you've set tdi/tms buffer to a malloc, you call
> vslink_free(), and their values could be uninitialized garbage.
You are right, memset should be called after the memory is successfully
allocated.

> data->usb_buffer[in_length] = '\0';
> data->usb_buffer_size = data->usb_buffer[0] + (data->usb_buffer[1] << 8);
Yes, it should be data->usb_buffer[result] = '\0';

The original vsllink_usb_message is like:
static int
vsllink_usb_message (urj_usbconn_libusb_param_t *params, int out_length,
                     int *in_length, int timeout);
It will return the actually received length in in_length, but in the final
version, the actually received length is returned as the return value
of the function if in_length is 0. This is why there is a in_length varible.

I haven't test it out because usb_buffer[0] is really 0, and there is a NULL
at
then end of the USB reply.
The attached patch can fix this 2 bugs.

-- 
Best Regards, SimonQian
http://www.SimonQian.com

Attachment: bugfix1.patch
Description: Binary data

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
UrJTAG-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to