Skip to content

Commit

Permalink
Squelch warnings.
Browse files Browse the repository at this point in the history
Cast bytes read from getc(), and already known not to be EOF, to u_char
before treating them as unsigned 8-bit bytes.
  • Loading branch information
guyharris committed Mar 20, 2018
1 parent fb7711f commit 272b68f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions etherent.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ pcap_next_etherent(FILE *fp)

/* must be the start of an address */
for (i = 0; i < 6; i += 1) {
d = xdtoi(c);
d = xdtoi((u_char)c);
c = getc(fp);
if (c == EOF)
return (NULL);
if (isxdigit(c)) {
d <<= 4;
d |= xdtoi(c);
d |= xdtoi((u_char)c);
c = getc(fp);
if (c == EOF)
return (NULL);
Expand Down Expand Up @@ -152,7 +152,7 @@ pcap_next_etherent(FILE *fp)
/* Use 'namesize' to prevent buffer overflow. */
namesize = sizeof(e.name) - 1;
do {
*bp++ = c;
*bp++ = (u_char)c;
c = getc(fp);
if (c == EOF)
return (NULL);
Expand Down

0 comments on commit 272b68f

Please sign in to comment.