Skip to content

utils_net.cc: Redudant code #3034

Description

@stasos24

Describe the bug

nmap/nping/utils_net.cc

Lines 496 to 509 in fd80921

int getNetworkInterfaceName(struct sockaddr_storage *dst, char *dev){
struct route_nfo rnfo;
struct sockaddr_storage src;
bool result=false;
if(dev==NULL)
nping_fatal(QT_3, "getNetworkInterfaceName(): NULL value supplied.");
memset(&rnfo, 0, sizeof(struct route_nfo) );
memset(&src, 0, sizeof(struct sockaddr_in) );
result=route_dst(dst, &rnfo, NULL, NULL);
if( result == false )
return OP_FAILURE;
strncpy( dev, rnfo.ii.devname, 16 );
return OP_SUCCESS;
} /* End of getSourceAddress() */

What's the point of defining

struct sockaddr_storage src

then filling with 16 zeros

memset(&src, 0, sizeof(struct sockaddr_in) );

and not using as 4th parameter in:

result=route_dst(dst, &rnfo, NULL, NULL); 

Version info (please complete the following information):

  • master branch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions