libftdi-git Archives

Subject: A library to talk to FTDI chips branch, renames-for-release, updated. v0.17-334-gc1cf60a

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sat, 28 Jul 2012 18:01:46 +0200 (CEST)
The branch, renames-for-release has been updated
       via  c1cf60a76010148ecba05f5a55ee19d5b71891c7 (commit)
      from  7aec58fb6798b5cde3971da38cbf956351093f48 (commit)


- Log -----------------------------------------------------------------
commit c1cf60a76010148ecba05f5a55ee19d5b71891c7
Author: Peter Schneider <pitpompej@xxxxxxxx>
Date:   Wed Jul 25 15:26:23 2012 +0200

    fixed NULL-pointer dereference in the ftdi_error_return(code, str) macro 
that occures when it is called because of a ftdi == NULL check
    
    Hi,
    
    as we just performed a Cppcheck run upon our project including the libftdi 
sources it found a possible null-pointer dereference when calling the 
ftdi_error_return(code, str) macro after the ftdi==NULL check.
    
    Fix for this bug:

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

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

diff --git a/src/ftdi.c b/src/ftdi.c
index 07687e8..5a3d44e 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -39,7 +39,10 @@
 #include "ftdi_version_i.h"
 
 #define ftdi_error_return(code, str) do {  \
-        ftdi->error_str = str;             \
+        if ( ftdi )                        \
+            ftdi->error_str = str;         \
+        else                               \
+            fprintf(stderr, str);          \
         return code;                       \
    } while(0);
 


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, renames-for-release, updated. v0.17-334-gc1cf60a, libftdi-git <=