mirror of
https://github.com/nmap/nmap.git
synced 2026-06-13 19:49:43 +00:00
Removed an unnecessary intermediary buffer for string copying.
This commit is contained in:
parent
f71b98ecd1
commit
4ec75b15b7
1 changed files with 4 additions and 5 deletions
|
|
@ -140,16 +140,15 @@ void set_portinfo(lua_State *L, Port* port) {
|
|||
* */
|
||||
void set_hostinfo(lua_State *L, Target *currenths) {
|
||||
unsigned int i;
|
||||
char hostname[1024];
|
||||
|
||||
lua_pushstring(L, strncpy(hostname, currenths->targetipstr(), 1024));
|
||||
lua_pushstring(L, currenths->targetipstr());
|
||||
lua_setfield(L, -2, "ip");
|
||||
|
||||
lua_pushstring(L, strncpy(hostname, currenths->HostName(), 1024));
|
||||
lua_pushstring(L, currenths->HostName());
|
||||
lua_setfield(L, -2, "name");
|
||||
|
||||
if ( currenths->TargetName() ) { // else nil
|
||||
lua_pushstring(L, strncpy(hostname, currenths->TargetName(), 1024));
|
||||
lua_pushstring(L, currenths->TargetName());
|
||||
lua_setfield(L, -2, "targetname");
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +166,7 @@ void set_hostinfo(lua_State *L, Target *currenths) {
|
|||
lua_setfield(L, -2, "mac_addr_src");
|
||||
}
|
||||
if(currenths->deviceName()){
|
||||
lua_pushstring(L, strncpy(hostname, currenths->deviceName(), 1024));
|
||||
lua_pushstring(L, currenths->deviceName());
|
||||
lua_setfield(L, -2, "interface");
|
||||
}
|
||||
if( (u32)(currenths->v4host().s_addr) ){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue