mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +00:00
MACtoa: make return pointer const, use Snprintf vs sprintf
This commit is contained in:
parent
16a39eaf76
commit
c0f20bb211
2 changed files with 3 additions and 7 deletions
|
|
@ -795,18 +795,14 @@ int parseMAC(const char *txt, u8 *targetbuff){
|
|||
} /* End of parseMAC() */
|
||||
|
||||
|
||||
|
||||
char *MACtoa(u8 *mac){
|
||||
const char *MACtoa(u8 *mac){
|
||||
static char macinfo[24];
|
||||
memset(macinfo, 0, 24);
|
||||
sprintf(macinfo,"%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
Snprintf(macinfo, sizeof(macinfo), "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
|
||||
return macinfo;
|
||||
} /* End of MACtoa() */
|
||||
|
||||
|
||||
|
||||
|
||||
/* Returns a buffer of ASCII information about an ARP/RARP packet that may look
|
||||
like "ARP who has 192.168.10.1? Tell 192.168.10.98"
|
||||
Since this is a static buffer, don't use threads or call twice
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ struct hostent *gethostbynameCached(char *host);
|
|||
struct hostent *hostentcpy(struct hostent *src);
|
||||
int hostentfree(struct hostent *src);
|
||||
int parseMAC(const char *txt, u8 *targetbuff);
|
||||
char *MACtoa(u8 *mac);
|
||||
const char *MACtoa(u8 *mac);
|
||||
const char *getRandomTextPayload();
|
||||
int send_packet(NpingTarget *target, int rawfd, u8 *pkt, size_t pktLen);
|
||||
int print_dnet_interface(const struct intf_entry *entry, void *arg) ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue