mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +00:00
Fix a memory leak in nse_pcrelib.cc. A string was being copied with
strdup before being handed to lua_pushstring. That was excessive because lua_pushstring already makes its own internal copy of the string. This was found by Coverity.
This commit is contained in:
parent
f673eff211
commit
e801b1b341
1 changed files with 1 additions and 1 deletions
|
|
@ -183,7 +183,7 @@ static void Lpcre_push_substrings (lua_State *L, const char *text, pcre2 *ud)
|
|||
unsigned int n = (tabptr[0] << 8) | tabptr[1]; /* number of the capturing parenthesis */
|
||||
if (n > 0 && n <= (unsigned) ud->ncapt) { /* check range */
|
||||
unsigned int j = n * 2;
|
||||
lua_pushstring(L, strdup((char*)tabptr + 2)); /* name of the capture, zero terminated */
|
||||
lua_pushstring(L, (char*)tabptr + 2); /* name of the capture, zero terminated */
|
||||
if (match[j] >= 0)
|
||||
lua_pushlstring(L, text + match[j], match[j + 1] - match[j]);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue