diff --git a/nse_main.cc b/nse_main.cc index 422ff15a8..f2e0db1d8 100644 --- a/nse_main.cc +++ b/nse_main.cc @@ -466,6 +466,8 @@ int process_preparerunlevels(std::list torun_threads) { if(runlevel_idx < (*runlevel_iter).runlevel) { runlevel_idx = (*runlevel_iter).runlevel; current_runlevel.clear(); + //push_back an empty in which we store all scripts of the current + //runlevel... torun_scripts.push_back(current_runlevel); } diff --git a/output.cc b/output.cc index 0c68c0250..3feb27c27 100644 --- a/output.cc +++ b/output.cc @@ -779,8 +779,9 @@ char* formatScriptOutput(struct script_scan_result ssr) { // delete the unwanted trailing newline pos = result.rfind(sep); - result.erase(pos, strlen(sep)); - + if(pos!=std::string::npos){ + result.erase(pos, strlen(sep)); + } c_result = strdup(result.c_str()); return c_result;