libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v1.4-6-g5193cc2

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 27 Oct 2017 17:16:11 +0200 (CEST)
The branch, master has been updated
       via  5193cc2344f13828c0f280135718eb741ec85237 (commit)
      from  fd42de6914bde2916588bef3a08db3bd1302700f (commit)


- Log -----------------------------------------------------------------
commit 5193cc2344f13828c0f280135718eb741ec85237
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date:   Fri Oct 27 17:15:27 2017 +0200

    Access ftdi->max_packet_size after checking ftdi context != NULL
    
    Reported via email by Mr. Alex Tvema.

-----------------------------------------------------------------------

Summary of changes:
 src/ftdi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/ftdi.c b/src/ftdi.c
index 675f8ca..e7904b3 100644
--- 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)");
 


hooks/post-receive
-- 
A library to talk to FTDI chips

--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • A library to talk to FTDI chips branch, master, updated. v1.4-6-g5193cc2, libftdi-git <=