git://developer.intra2net.com
/
libftdi
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(from parent 1:
fd42de6
)
Access ftdi->max_packet_size after checking ftdi context != NULL
author
Thomas Jarosch
<thomas.jarosch@intra2net.com>
Fri, 27 Oct 2017 15:15:27 +0000 (17:15 +0200)
committer
Thomas Jarosch
<thomas.jarosch@intra2net.com>
Fri, 27 Oct 2017 15:15:29 +0000 (17:15 +0200)
Reported via email by Mr. Alex Tvema.
src/ftdi.c
patch
|
blob
|
blame
|
history
diff --git
a/src/ftdi.c
b/src/ftdi.c
index
675f8ca
..
e7904b3
100644
(file)
--- a/
src/ftdi.c
+++ b/
src/ftdi.c
@@
-1909,13
+1909,14
@@
int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunk
int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size)
{
int offset = 0, ret, i, num_of_chunks, chunk_remains;
- int packet_size = ftdi->max_packet_size;
+ int packet_size;
int actual_length = 1;
if (ftdi == NULL || ftdi->usb_dev == NULL)
ftdi_error_return(-666, "USB device unavailable");
// Packet size sanity check (avoid division by zero)
+ packet_size = ftdi->max_packet_size;
if (packet_size == 0)
ftdi_error_return(-1, "max_packet_size is bogus (zero)");