Hi, I found a false positive regarding the rule buffer/read.
Flawfinder reports FF1029 on C++ member functions and namespace-qualified functions named read, even when they are user-defined functions and not calls to the POSIX read API.
Program
struct Stream {
int read(void *, unsigned) { return 0; }
};
namespace safe_ops {
int read(int, void *, unsigned) { return 0; }
} // namespace safe_ops
int main() {
int x = 0;
Stream stream;
stream.read(&x, sizeof(x));
safe_ops::read(0, &x, sizeof(x));
return 0;
}
The program compiles and runs normally. Neither Stream::read nor safe_ops::read is the POSIX read function.
Actual Result
Flawfinder reports buffer/read warnings at the user-defined member function, the namespace function, and the namespace-qualified call.
FINAL RESULTS:
read_identifier_false_positive.cpp:2: [1] (buffer) read:
Check buffer boundaries if used in a loop including recursive loops
(CWE-120, CWE-20).
read_identifier_false_positive.cpp:6: [1] (buffer) read:
Check buffer boundaries if used in a loop including recursive loops
(CWE-120, CWE-20).
read_identifier_false_positive.cpp:13: [1] (buffer) read:
Check buffer boundaries if used in a loop including recursive loops
(CWE-120, CWE-20).
Expected Result
Flawfinder should not report buffer/read for C++ member functions or namespace-qualified functions merely because their identifier is named read.
Verification
flawfinder read_identifier_false_positive.cpp
Version: 2.0.20
Hi, I found a false positive regarding the rule
buffer/read.Flawfinder reports
FF1029on C++ member functions and namespace-qualified functions namedread, even when they are user-defined functions and not calls to the POSIXreadAPI.Program
The program compiles and runs normally. Neither
Stream::readnorsafe_ops::readis the POSIXreadfunction.Actual Result
Flawfinder reports
buffer/readwarnings at the user-defined member function, the namespace function, and the namespace-qualified call.Expected Result
Flawfinder should not report
buffer/readfor C++ member functions or namespace-qualified functions merely because their identifier is namedread.Verification
Version: 2.0.20