File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -122,8 +122,15 @@ using namespace modsecurity;
122122#include < signal.h>
123123#include < string.h>
124124
125+ #ifndef __AFL_LOOP
126+ #define __AFL_LOOP (x ) (1 )
127+ #endif
128+
125129inline void op_test (const std::string &opName, const std::string &s) {
126130 Operator *op = Operator::instantiate (opName, " " );
131+ if (op == nullptr ) {
132+ return ;
133+ }
127134 op->init (" " , nullptr );
128135 op->evaluate (nullptr , nullptr , s, nullptr );
129136 delete op;
@@ -142,7 +149,12 @@ int main(int argc, char** argv) {
142149 memset (buf, 0 , 128 );
143150 read_bytes = read (STDIN_FILENO , buf, 128 );
144151
145- std::string currentString = std::string (read_bytes, 128 );
152+ if (read_bytes <= 0 ) {
153+ continue ;
154+ }
155+
156+ std::string currentString =
157+ std::string (reinterpret_cast <const char *>(buf), read_bytes);
146158 const std::string& s = currentString;
147159#if 0
148160 std::string z = lastString;
You can’t perform that action at this time.
0 commit comments