2 parents c5063e7 + e9123d2 commit ef312c7Copy full SHA for ef312c7
1 file changed
src/Fuzzer.cpp
@@ -157,12 +157,16 @@ std::vector<char> Fuzzer::GetFUZZ()
157
158
if (fgets(buf_file, BUFSIZE, this->fp_payloads) == NULL)
159
{
160
- fprintf(stdout, "EOF of payload file\n");
+ fprintf(stdout, "EOF of payload file, rewinding\n");
161
fflush(stdout);
162
+ rewind(this->fp_payloads);
163
+ if (fgets(buf_file, BUFSIZE, this->fp_payloads) == NULL)
164
+ buf_file[0] = '\0'; // payload file is empty, nothing to read
165
}
166
167
str = std::string(buf_file);
- str.erase(str.size() - 1); //remove \n
168
+ if (!str.empty() && str.back() == '\n') //remove trailing \n, if any
169
+ str.erase(str.size() - 1);
170
this->input_line = Utils::str2vector(str);
171
172
0 commit comments