From 9acd31bf85b66670a752129ea51c03ab16ef625b Mon Sep 17 00:00:00 2001 From: Raizo62 Date: Sun, 30 Jul 2023 11:19:22 +0200 Subject: [PATCH 1/9] cppcheck : error in the required format of printf - command.c : static int show_ip(int argc, char **argv) - dump.c : int dmp_packet(const struct packet *m, const int flag) --- src/command.c | 2 +- src/dump.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command.c b/src/command.c index f01223a..4badb7b 100644 --- a/src/command.c +++ b/src/command.c @@ -1872,7 +1872,7 @@ static int show_ip(int argc, char **argv) printf("DHCP SERVER : %s\n", inet_ntoa(in)); k = time_tick - vpc[id].ip4.dhcp.timetick; k = vpc[id].ip4.dhcp.lease - k; - printf("DHCP LEASE : %u, %u/%u/%u\n", + printf("DHCP LEASE : %d, %u/%u/%u\n", k > 0 ? k : 0, vpc[id].ip4.dhcp.lease, vpc[id].ip4.dhcp.renew, diff --git a/src/dump.c b/src/dump.c index 4d7bc75..922f2dc 100644 --- a/src/dump.c +++ b/src/dump.c @@ -61,7 +61,7 @@ int dmp_packet(const struct packet *m, const int flag) gettimeofday(&tv, 0); usec = (tv.tv_sec - gtv.tv_sec) * 1000000 + tv.tv_usec - gtv.tv_usec; - printf("\n\033[32m%04d.%d\033[0m", usec / 1000000, usec % 1000000); + printf("\n\033[32m%04u.%u\033[0m", usec / 1000000, usec % 1000000); if (flag & DMP_MAC) { printf(" "); printf("\033[33m"); From 6f2fd3418d1940dc652a7e7f5aab8f8d856086ff Mon Sep 17 00:00:00 2001 From: Raizo62 Date: Sun, 30 Jul 2023 11:21:45 +0200 Subject: [PATCH 2/9] cppcheck : Consecutive return, break, continue, goto or throw statements are unnecessary. - command.c : int run_set(int argc, char **argv) --- src/command.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/command.c b/src/command.c index 4badb7b..a92b3a4 100644 --- a/src/command.c +++ b/src/command.c @@ -1364,7 +1364,6 @@ int run_set(int argc, char **argv) if (argc < 2 || (argc == 2 && strlen(argv[1]) == 1 && argv[1][0] == '?')) { return help_set(argc, argv); - return 0; } if (!strncmp("dump", argv[1], strlen(argv[1]))) { From 3dfc375ca8739df2cd9031839c2e82c7b01c0e4a Mon Sep 17 00:00:00 2001 From: Raizo62 Date: Sun, 30 Jul 2023 11:41:18 +0200 Subject: [PATCH 3/9] cppcheck : Local variable shadows outer variable - command.c : j : int run_tracert(int argc, char **argv) - command6 : p : int run_ping6(int argc, char **argv) - packets.c : p : int upv4(pcs *pc, struct packet **m0) - tcp.c : tv : int tcp_close(pcs *pc, int ipv) --- src/command.c | 8 +-- src/command6.c | 15 +++--- src/packets.c | 141 ++++++++++++++++++++++++------------------------- src/tcp.c | 1 - 4 files changed, 81 insertions(+), 84 deletions(-) diff --git a/src/command.c b/src/command.c index a92b3a4..cc6a985 100644 --- a/src/command.c +++ b/src/command.c @@ -1083,7 +1083,7 @@ int run_ipconfig(int argc, char **argv) int run_tracert(int argc, char **argv) { - int i, j; + int i; u_int gip, gwip; struct in_addr in; int count = 128; @@ -1130,7 +1130,7 @@ int run_tracert(int argc, char **argv) printf("Invalid protocol\n"); return 0; } - j = atoi(argv[i]); + int j = atoi(argv[i]); if (j == IPPROTO_ICMP) { pc->mscb.proto = IPPROTO_ICMP; } else if (j == IPPROTO_UDP) { @@ -1155,7 +1155,7 @@ int run_tracert(int argc, char **argv) return 0; } i++; - j = atoi(argv[i]); + int j = atoi(argv[i]); if (j > 0 && j <= 64) count = j; else { @@ -1167,7 +1167,7 @@ int run_tracert(int argc, char **argv) } if (digitstring(argv[i])) { if (count == 128) { - j = atoi(argv[i]); + int j = atoi(argv[i]); if (j > 0 && j <= 64) count = j; else { diff --git a/src/command6.c b/src/command6.c index 8525bc8..48d412e 100644 --- a/src/command6.c +++ b/src/command6.c @@ -62,7 +62,6 @@ int run_ping6(int argc, char **argv) struct in6_addr ipaddr; struct packet *m = NULL; int i; - char *p; char proto_seq[16]; int count = 5; @@ -100,7 +99,7 @@ int run_ping6(int argc, char **argv) } /* find destination */ - p = (char*)nbDiscovery(pc, &pc->mscb.dip6); + char *p = (char*)nbDiscovery(pc, &pc->mscb.dip6); if (p == NULL) { printf("host (%s) not reachable\n", argv[1]); return 0; @@ -206,7 +205,7 @@ int run_ping6(int argc, char **argv) } else { i = 1; while ((i <= count || count == -1) && !ctrl_c) { - struct packet *p; + struct packet *packet; struct timeval tv; int usec; int respok = 0; @@ -232,16 +231,16 @@ int run_ping6(int argc, char **argv) delay_ms(1); respok = 0; - while ((p = deq(&pc->iq)) != NULL && !respok && + while ((packet = deq(&pc->iq)) != NULL && !respok && !timeout(tv, pc->mscb.waittime) && !ctrl_c) { pc->mscb.icmptype = pc->mscb.icmpcode = 0; - respok = response6(p, &pc->mscb); - usec = (p->ts.tv_sec - tv.tv_sec) * 1000000 + - p->ts.tv_usec - tv.tv_usec; + respok = response6(packet, &pc->mscb); + usec = (packet->ts.tv_sec - tv.tv_sec) * 1000000 + + packet->ts.tv_usec - tv.tv_usec; if (usec < 0) usec = 0; - del_pkt(p); + del_pkt(packet); if (respok == 0) continue; diff --git a/src/packets.c b/src/packets.c index 46b573b..d994f8e 100644 --- a/src/packets.c +++ b/src/packets.c @@ -74,7 +74,6 @@ extern u_int time_tick; int upv4(pcs *pc, struct packet **m0) { struct packet *m = *m0; - struct packet *p = NULL; ethdr *eh = (ethdr *)(m->data); u_int *si, *di; @@ -92,87 +91,87 @@ int upv4(pcs *pc, struct packet **m0) if ( (memcmp(eh->dst, pc->ip4.mac, ETH_ALEN) == 0 || memcmp(eh->dst, broadcast, ETH_ALEN) == 0) && ((u_short*)m->data)[6] == htons(ETHERTYPE_IP)) { - iphdr *ip = (iphdr *)(eh + 1); - - if (ntohs(ip->len) > pc->mtu) { - p = icmpReply(m, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG); - if (p) { - fix_dmac(pc, p); - if (pc->ip4.flags & IPF_FRAG) { - p = ipfrag(p, pc->mtu); + struct packet *p; + iphdr *ip = (iphdr *)(eh + 1); + + if (ntohs(ip->len) > pc->mtu) { + p = icmpReply(m, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG); + if (p) { + fix_dmac(pc, p); + if (pc->ip4.flags & IPF_FRAG) { + p = ipfrag(p, pc->mtu); + } + enq(&pc->oq, p); } - enq(&pc->oq, p); + return PKT_ENQ; } - return PKT_ENQ; - } - if (ntohs(ip->frag) & (IP_MF | IP_OFFMASK)) { - m = ipreass(m); - if (m == NULL) - return PKT_ENQ; - else - *m0 = m; - ip = (iphdr *)(m->data + sizeof(ethdr)); - } + if (ntohs(ip->frag) & (IP_MF | IP_OFFMASK)) { + m = ipreass(m); + if (m == NULL) + return PKT_ENQ; + else + *m0 = m; + ip = (iphdr *)(m->data + sizeof(ethdr)); + } - /* ping me, reply */ - if (ip->proto == IPPROTO_ICMP) { - icmphdr *icmp = (icmphdr *)(ip + 1); + /* ping me, reply */ + if (ip->proto == IPPROTO_ICMP) { + icmphdr *icmp = (icmphdr *)(ip + 1); - if (ip->dip != pc->ip4.ip) - return PKT_DROP; + if (ip->dip != pc->ip4.ip) + return PKT_DROP; - /* other type will be sent to application */ - if (icmp->type != ICMP_ECHO) - return PKT_UP; + /* other type will be sent to application */ + if (icmp->type != ICMP_ECHO) + return PKT_UP; - p = icmpReply(m, ICMP_ECHOREPLY, 0); - if (p != NULL) { - enq(&pc->bgoq, p); - } - return PKT_ENQ; - } else if (ip->proto == IPPROTO_UDP) { - udpiphdr *ui; - char *data = NULL; - ui = (udpiphdr *)ip; - - if (IN_MULTICAST(ntohl(ip->dip))) - return PKT_DROP; - - /* dhcp packet */ - if (ui->ui_sport == htons(67) && ui->ui_dport == htons(68)) - return PKT_UP; - - if (ip->dip != pc->ip4.ip) - return PKT_DROP; - - /* dns response */ - if (ui->ui_sport == htons(53)) - return PKT_UP; - - data = ((char*)(ui + 1)); - - /* udp echo reply */ - if (memcmp(data, eh->dst, ETH_ALEN) == 0) - return PKT_UP; - else { - struct packet *p; - if (ip->ttl == 1) - p = icmpReply(m, ICMP_UNREACH, ICMP_UNREACH_PORT); - else - p = udpReply(m); - + p = icmpReply(m, ICMP_ECHOREPLY, 0); if (p != NULL) { enq(&pc->bgoq, p); } - } - /* anyway tell caller to drop this packet */ - return PKT_DROP; - } else if (ip->proto == IPPROTO_TCP) { - if (ip->dip != pc->ip4.ip) + return PKT_ENQ; + } else if (ip->proto == IPPROTO_UDP) { + udpiphdr *ui; + char *data = NULL; + ui = (udpiphdr *)ip; + + if (IN_MULTICAST(ntohl(ip->dip))) + return PKT_DROP; + + /* dhcp packet */ + if (ui->ui_sport == htons(67) && ui->ui_dport == htons(68)) + return PKT_UP; + + if (ip->dip != pc->ip4.ip) + return PKT_DROP; + + /* dns response */ + if (ui->ui_sport == htons(53)) + return PKT_UP; + + data = ((char*)(ui + 1)); + + /* udp echo reply */ + if (memcmp(data, eh->dst, ETH_ALEN) == 0) + return PKT_UP; + else { + if (ip->ttl == 1) + p = icmpReply(m, ICMP_UNREACH, ICMP_UNREACH_PORT); + else + p = udpReply(m); + + if (p != NULL) { + enq(&pc->bgoq, p); + } + } + /* anyway tell caller to drop this packet */ return PKT_DROP; - return tcp(pc, m); - } + } else if (ip->proto == IPPROTO_TCP) { + if (ip->dip != pc->ip4.ip) + return PKT_DROP; + return tcp(pc, m); + } } else if (eh->type == htons(ETHERTYPE_ARP)) { vpcs_arphdr *ah = (vpcs_arphdr *)(eh + 1); diff --git a/src/tcp.c b/src/tcp.c index d166140..3b2c591 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -395,7 +395,6 @@ int tcp_close(pcs *pc, int ipv) /* local send FIN/ACK first */ if (state == 2) { - struct timeval tv; /* expect FIN */ state = 0; //k = 0; From bc46e668a085478a9704af6059ce7a5b5a8de407 Mon Sep 17 00:00:00 2001 From: Raizo62 Date: Sun, 30 Jul 2023 13:45:38 +0200 Subject: [PATCH 4/9] cppcheck : Condition is always true : dhcp.c : i : int dhcp_rebind(pcs *pc) dhcp.c : ok : int dhcp_rebind(pcs *pc) packets6.c : j : u_char *nbDiscovery(pcs *pc, ip6 *dst) readline : start : int findhistory(struct rls *rls, int start) --- src/dhcp.c | 16 +++++++--------- src/packets6.c | 5 ++--- src/readline.c | 8 ++++---- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/dhcp.c b/src/dhcp.c index 3c2558a..5bfb839 100644 --- a/src/dhcp.c +++ b/src/dhcp.c @@ -724,7 +724,7 @@ int dhcp_rebind(pcs *pc) /* request */ i = 0; ok = 0; - while (i < 3 && !ok) { + while (!ok) { m = dhcp4_request(pc); if (m == NULL) { sleep(1); @@ -739,14 +739,12 @@ int dhcp_rebind(pcs *pc) free(p); } } - if (ok) { - if (pc->ip4.dhcp.renew == 0) - pc->ip4.dhcp.renew = pc->ip4.dhcp.lease / 2; - if (pc->ip4.dhcp.rebind == 0) - pc->ip4.dhcp.rebind = pc->ip4.dhcp.lease * 7 / 8; - return 1; - } - return 0; + + if (pc->ip4.dhcp.renew == 0) + pc->ip4.dhcp.renew = pc->ip4.dhcp.lease / 2; + if (pc->ip4.dhcp.rebind == 0) + pc->ip4.dhcp.rebind = pc->ip4.dhcp.lease * 7 / 8; + return 1; } int dhcp_enq(pcs *pc, const struct packet *m) diff --git a/src/packets6.c b/src/packets6.c index de66f02..031672a 100644 --- a/src/packets6.c +++ b/src/packets6.c @@ -729,7 +729,7 @@ struct packet *udp6Reply(struct packet *m0) */ u_char *nbDiscovery(pcs *pc, ip6 *dst) { - int i, j; + int i; static u_char mac[ETH_ALEN] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; int waittime = 1000; struct timeval tv; @@ -777,8 +777,7 @@ u_char *nbDiscovery(pcs *pc, ip6 *dst) /* find neighbor */ i = 0; - j = -1; - while ((i++ < 3) && (j == -1)){ + while ( i++ < 3 ){ struct packet *m; m = nb_sol(pc, dst); diff --git a/src/readline.c b/src/readline.c index 1bb22be..5e87496 100644 --- a/src/readline.c +++ b/src/readline.c @@ -472,10 +472,10 @@ int findhistory(struct rls *rls, int start) if (start >= 0) { start++; return (start < rls->hist_total) ? start : -1; - } else { - start = 0 - start; - start --; - return (start > - 1) ? start : -1; + } else { // [-1 , -inf [ + start = 0 - start; // [1 , inf [ + start --; // [0 , inf [ + return start; } } else { if (start >= 0) { From 0c68680225f0fc55e84c0f2563c06362c2cf0af6 Mon Sep 17 00:00:00 2001 From: Raizo62 Date: Sun, 30 Jul 2023 13:53:29 +0200 Subject: [PATCH 5/9] cppcheck : Array index is used before limits check. - packetlife : i and data : int response(struct packet *m, sesscb *sesscb) - packetlife6 : i and data : int response6(struct packet *m, sesscb *sesscb) - remote.c : i and outbuf : int open_remote(int fdio, const char *destip, const u_short destport) --- src/packets.c | 2 +- src/packets6.c | 2 +- src/remote.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/packets.c b/src/packets.c index d994f8e..24defe1 100644 --- a/src/packets.c +++ b/src/packets.c @@ -314,7 +314,7 @@ int response(struct packet *m, sesscb *sesscb) n > 0) { int i = 0; - while (data[i] == 0x1 && i < sesscb->rdsize) i++; + while ( i < sesscb->rdsize && data[i] == 0x1 ) i++; for (;i < n;) { if (data[i] == TCPOPT_MAXSEG && diff --git a/src/packets6.c b/src/packets6.c index 031672a..8bc7784 100644 --- a/src/packets6.c +++ b/src/packets6.c @@ -444,7 +444,7 @@ int response6(struct packet *m, sesscb *sesscb) sesscb->rflags == (TH_SYN | TH_ACK)) { int i = 0; - while (data[i] == 0x1 && i < sesscb->rdsize) i++; + while ( i < sesscb->rdsize && data[i] == 0x1 ) i++; for (;i < sesscb->rdsize;) { if (data[i] == TCPOPT_MAXSEG && diff --git a/src/remote.c b/src/remote.c index ba971fb..e1daff8 100644 --- a/src/remote.c +++ b/src/remote.c @@ -140,7 +140,7 @@ int open_remote(int fdio, const char *destip, const u_short destport) if (rc > 0) { i = 0; /* discard IAC */ - while (outbuf[i] == 0xff && i < rc) + while ( i < rc && outbuf[i] == 0xff ) i += 3; if (i < rc) { rc = write(fdio, outbuf + i, rc - i); From d9329aae481e5927bddc21f8ab6b3cb780833703 Mon Sep 17 00:00:00 2001 From: Raizo62 Date: Sun, 30 Jul 2023 13:58:06 +0200 Subject: [PATCH 6/9] cppcheck : Redundant condition - vpcs.c : void parse_cmd(char *cmdstr) --- src/vpcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vpcs.c b/src/vpcs.c index 773fdbf..a45841f 100644 --- a/src/vpcs.c +++ b/src/vpcs.c @@ -390,7 +390,7 @@ void parse_cmd(char *cmdstr) if (echoctl.enable && runLoad) { if (!strcmp(cmd->name, "sleep") && - (argc != 2 || (argc == 2 && !digitstring(argv[1])))) { + (argc != 2 || !digitstring(argv[1]))) { ; } else if (at == 0) printf("%s[%d] %s\n", vpc[pcid].xname, pcid + 1, cmdstr); From e5cf6bb197416da717dbd29b6d4635cbbd4e8861 Mon Sep 17 00:00:00 2001 From: Raizo62 Date: Sun, 30 Jul 2023 14:14:11 +0200 Subject: [PATCH 7/9] cppcheck : condition 'p!=NULL' is redundant ? readline : int main(int argc, char **argv) --- src/readline.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/readline.c b/src/readline.c index 5e87496..10b6c75 100644 --- a/src/readline.c +++ b/src/readline.c @@ -588,16 +588,17 @@ int main(int argc, char **argv) readline_tab(my_complete, rls); while (rls) { p = readline("CLI> ", rls); - if (p != NULL) + if (p != NULL) { printf("\nget %s\n", p); - if (!strcmp(p, "h")) { - printf("\n"); - for (i = 0; i < rls->hist_total; i++) - printf("%d: %s\n", i + 1, rls->history[i]); - } - if (strcmp(p, "quit")) - continue; - break; + if (!strcmp(p, "h")) { + printf("\n"); + for (i = 0; i < rls->hist_total; i++) + printf("%d: %s\n", i + 1, rls->history[i]); + } + else if (strcmp(p, "quit")) + continue; + break; + } } return 1; } From d6f42b9eca98716b040140b08709d103430244f7 Mon Sep 17 00:00:00 2001 From: Raizo62 Date: Sun, 30 Jul 2023 14:21:57 +0200 Subject: [PATCH 8/9] cppcheck : The function is never used. - command.c : int run_dhcp(int argc, char **argv) - utils.c : char *getkv(char *str) - help.c : -- int help_echo(int argc, char **argv) -- int help_hist(int argc, char **argv) -- int help_neighbor(int argc, char **argv) -- int help_version(int argc, char **argv) -- int help_shut(int argc, char **argv) - getopt.c : int arg_to_int(const char* arg, int min, int max, int defalt) --- src/command.c | 50 -------------------------------------------------- src/getopt.c | 18 ------------------ src/help.c | 27 --------------------------- src/utils.c | 15 --------------- 4 files changed, 110 deletions(-) diff --git a/src/command.c b/src/command.c index cc6a985..6d5d891 100644 --- a/src/command.c +++ b/src/command.c @@ -636,56 +636,6 @@ int run_ping(int argc, char **argv) return 1; } -int run_dhcp(int argc, char **argv) -{ - int dump = 0; - int flag = 0; - int i; - - i = 0; - while (++i < argc) { - if (!strcmp(argv[i], "-d")) { - dump = 1; - continue; - } - - if (!strcmp(argv[i], "-r")) { - flag = (flag << 4) + 0x5; - continue; - } - - if (!strcmp(argv[i], "-x")) { - flag = (flag << 4) + 0xa; - continue; - } - flag = -1; - break; - } - if (flag == -1) - return help_ip(argc, argv); - - switch (flag) { - case 0: - run_dhcp_new(0, dump); - break; - case 0x5: - run_dhcp_new(1, dump); - break; - case 0xa: - run_dhcp_release(dump); - break; - case 0x5a: - run_dhcp_new(1, dump); - run_dhcp_release(dump); - break; - case 0xa5: - run_dhcp_release(dump); - run_dhcp_new(1, dump); - break; - } - return 1; -} - static int run_dhcp_new(int renew, int dump) { int i; diff --git a/src/getopt.c b/src/getopt.c index 9f26bcb..2c0f34f 100644 --- a/src/getopt.c +++ b/src/getopt.c @@ -55,24 +55,6 @@ static int opt_offset = 0; /* Index into compounded "-option" */ static int dashdash = 0; /* True if "--" option reached */ static int nonopt = 0; /* How many nonopts we've found */ -int arg_to_int(const char* arg, int min, int max, int defalt) -{ - int i = defalt; - int rv; - - /* no argument means we use the default value */ - if (arg) { - /* make sure we got an integer argument */ - rv = sscanf(arg, "%d", &i); - if(rv == 1) { - if(i < min || max < i) - i = defalt; - } else - i = defalt; - } - return i; -} - static void increment_index() { /* Move onto the next option */ diff --git a/src/help.c b/src/help.c index bf6a48b..1897227 100644 --- a/src/help.c +++ b/src/help.c @@ -40,16 +40,6 @@ int help_clear(int argc, char **argv) } -int help_echo(int argc, char **argv) -{ - return 1; -} - -int help_hist(int argc, char **argv) -{ - return 1; -} - int help_relay(int argc, char **argv) { char *s[2] = { @@ -160,11 +150,6 @@ int help_load(int argc, char **argv) return 1; } -int help_neighbor(int argc, char **argv) -{ - return 1; -} - int help_ping(int argc, char **argv) { @@ -415,11 +400,6 @@ int help_show(int argc, char **argv) return 0; } -int help_version(int argc, char **argv) -{ - return 1; -} - int help_sleep(int argc, char **argv) { esc_prn("\n{Hsleep} [{Useconds}] [{Utext}]\n" @@ -439,13 +419,6 @@ int help_help(int argc, char **argv) return 1; } -int help_shut(int argc, char **argv) -{ - esc_prn("\n{H%s}, shutdown the process (only in daemon mode)\n", argv[0]); - - return 1; -} - int run_help(int argc, char **argv) { esc_prn("\n" diff --git a/src/utils.c b/src/utils.c index 626864b..c0a740d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -35,21 +35,6 @@ static int search_pairs(const char *s, char **lf, char **rt); -char *getkv(char *str) -{ - static char buf[MAX_LEN]; - static char *p; - - if (str != NULL) { - memset(buf, 0, sizeof(buf)); - memcpy(buf, str, strlen(str)); - p = strtok(buf, " \t"); - } else - p = strtok(NULL, " \t"); - - return p; -} - int mkargv(char *str, char **argv, int max) { int n = 0; From 0999ed50616c3c93c1247e884f4e8f4336bf29c4 Mon Sep 17 00:00:00 2001 From: Raizo62 Date: Tue, 29 Aug 2023 17:59:11 +0200 Subject: [PATCH 9/9] command.c : show_arp : increase the size of the array "buf" (18 to 19). - On MAC OS, the line "sprintf(buf + j * 3, "%2.2x:", pc->ipmac4[i].mac[j]);" crashs. - Perhaps that the snprintf of MACOS adds the '\0' after the last '01:' (the last byte of the mac address) and is out the array --- src/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command.c b/src/command.c index 6d5d891..ea71afe 100644 --- a/src/command.c +++ b/src/command.c @@ -1610,7 +1610,7 @@ int show_arp(int argc, char **argv) pcs *pc; int i, j; struct in_addr in; - char buf[18]; + char buf[19]; u_char zero[ETH_ALEN] = {0}; int empty = 1; int si;