From a09a6e200731904b6535e1aca269f744a3c540e1 Mon Sep 17 00:00:00 2001 From: fyodor Date: Sat, 11 Aug 2007 04:42:31 +0000 Subject: [PATCH] merge soc07 r4994:5001 - Adding element for the open TCP port used when performing OS Detection. Only closed TCP and UDP were being printed; I guess it was just an oversight; Call endTask() in process_mainloop() in nse_main.cc so task ending information (like the element) are printed; old_locale is allocated on the STACK not the HEAP; NULL is NOT a valid PCRE pointer. --- nse_main.cc | 2 ++ nse_pcrelib.cc | 3 +-- output.cc | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nse_main.cc b/nse_main.cc index f2e0db1d8..eca4f4497 100644 --- a/nse_main.cc +++ b/nse_main.cc @@ -279,6 +279,8 @@ int process_mainloop(lua_State* l) { } } + progress.endTask(NULL, NULL); + return SCRIPT_ENGINE_SUCCESS; } diff --git a/nse_pcrelib.cc b/nse_pcrelib.cc index 95d402e96..f6b68d5e0 100644 --- a/nse_pcrelib.cc +++ b/nse_pcrelib.cc @@ -110,7 +110,6 @@ static const unsigned char *Lpcre_maketables(lua_State *L, int stackpos) tables = pcre_maketables(); /* make tables with new locale */ (void)setlocale(LC_CTYPE, old_locale); /* restore the old locale */ - free(old_locale); free(locale); return tables; } @@ -158,7 +157,7 @@ static void Lpcre_getargs(lua_State *L, pcre2 **pud, const char **text, size_t *text_len) { *pud = (pcre2 *)luaL_checkudata(L, 1, pcre_handle); - if(*pud != NULL) + if(*pud == NULL) (void)luaL_argerror(L, 1, ("compiled regexp expected")); *text = luaL_checklstring(L, 2, text_len); } diff --git a/output.cc b/output.cc index 0b159c052..03eccc840 100644 --- a/output.cc +++ b/output.cc @@ -1409,6 +1409,11 @@ void printosscanoutput(Target *currenths) { distance = currenths->distance; log_write(LOG_XML, ""); + if (FPR->osscan_opentcpport > 0) { + log_write(LOG_XML, + "\n", + FPR->osscan_opentcpport); + } if (FPR->osscan_closedtcpport > 0) { log_write(LOG_XML, "\n",