]> The Tcpdump Group git mirrors - libpcap/commitdiff
Squelch warnings.
authorGuy Harris <[email protected]>
Tue, 20 Mar 2018 20:01:28 +0000 (13:01 -0700)
committerGuy Harris <[email protected]>
Tue, 20 Mar 2018 20:01:28 +0000 (13:01 -0700)
Cast bytes read from getc(), and already known not to be EOF, to u_char
before treating them as unsigned 8-bit bytes.

etherent.c

index 5930eae28e4a3618d1db5fd51638f36f8ca0a4c4..5f499613e088e72993a854545473ae53d0363c5a 100644 (file)
@@ -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);
@@ -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);