Make more room for textual representation of MAC addresses.
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/othptab.c | 4 ++--
src/tcptable.c | 8 ++++----
src/tcptable.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/othptab.c b/src/othptab.c
index c73eb39..d12cdfd 100644
--- a/src/othptab.c
+++ b/src/othptab.c
@@ -368,7 +368,7 @@ void printothpentry(struct othptable *table, struct othptabent
*entry,
struct in_addr uninitialized_var(saddr);
- char rarp_mac_addr[15];
+ char rarp_mac_addr[18];
unsigned int unknown = 0;
@@ -416,7 +416,7 @@ void printothpentry(struct othptable *table, struct othptabent
*entry,
break;
case ETH_P_RARP:
sprintf(msgstring, "RARP ");
- memset(rarp_mac_addr, 0, 15);
+ memset(rarp_mac_addr, 0, sizeof(rarp_mac_addr));
switch (ntohs(entry->un.rarp.opcode)) {
case ARPOP_RREQUEST:
strcat(msgstring, "request for ");
diff --git a/src/tcptable.c b/src/tcptable.c
index e6df461..56c4780 100644
--- a/src/tcptable.c
+++ b/src/tcptable.c
@@ -336,8 +336,8 @@ struct tcptableent *addentry(struct tcptable *table, unsigned long int
saddr,
* Zero out MAC address fields
*/
- memset(new_entry->smacaddr, 0, 15);
- memset(new_entry->oth_connection->smacaddr, 0, 15);
+ memset(new_entry->smacaddr, 0, sizeof(new_entry->smacaddr));
+ memset(new_entry->oth_connection->smacaddr, 0,
sizeof(new_entry->oth_connection->smacaddr));
/*
* Set raw port numbers
@@ -590,7 +590,7 @@ void updateentry(struct tcptable *table, struct tcptableent
*tableentry,
struct OPTIONS *opts, FILE * logfile)
{
char msgstring[MSGSTRING_MAX];
- char newmacaddr[15];
+ char newmacaddr[18];
if (tableentry->s_fstat != RESOLVED) {
tableentry->s_fstat =
@@ -612,7 +612,7 @@ void updateentry(struct tcptable *table, struct tcptableent
*tableentry,
tableentry->spanbr += bcount;
if (opts->mac) {
- memset(newmacaddr, 0, 15);
+ memset(newmacaddr, 0, sizeof(newmacaddr));
if (linkproto == ARPHRD_ETHER) {
convmacaddr((char *) (((struct ethhdr *) packet)->
diff --git a/src/tcptable.h b/src/tcptable.h
index ee01417..7b2a83d 100644
--- a/src/tcptable.h
+++ b/src/tcptable.h
@@ -30,7 +30,7 @@ struct tcptableent {
int d_fstat;
unsigned int sport;
unsigned int dport;
- char smacaddr[15];
+ char smacaddr[18];
char s_sname[11]; /* Service names, maxlen=10 */
char d_sname[11];
unsigned int protocol;
--
1.7.8.4