git://developer.intra2net.com
/
libftdi
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
2e48e9f
)
fixed NULL-pointer dereference in the ftdi_error_return(code, str) macro that occures...
author
Peter Schneider
<pitpompej@arcor.de>
Wed, 25 Jul 2012 13:26:23 +0000 (15:26 +0200)
committer
Thomas Jarosch
<thomas.jarosch@intra2net.com>
Sat, 28 Jul 2012 16:00:42 +0000 (18:00 +0200)
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:
src/ftdi.c
patch
|
blob
|
blame
|
history
diff --git
a/src/ftdi.c
b/src/ftdi.c
index
07687e8
..
5a3d44e
100644
(file)
--- 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);