]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use more the EXTRACT_U_1() macro (32/n)
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 28 Nov 2017 21:09:33 +0000 (22:09 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 28 Nov 2017 21:22:35 +0000 (22:22 +0100)
In: while (... *(p) ...) ...,
    while (... *(p + e) ...) ...

print-icmp6.c
print-snmp.c
print-syslog.c
print-telnet.c

index 10ec6bee42b03df8789d9f3309a49624160f3348..c65e07cf2e71869d591bf02a6662d9913a475f29 100644 (file)
@@ -1322,7 +1322,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
                        ND_PRINT((ndo," lifetime %us, domain(s):",
                                   EXTRACT_BE_U_4(&opds->nd_opt_dnssl_lifetime)));
                        domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */
-                       while (domp < cp + (op->nd_opt_len << 3) && *domp != '\0')
+                       while (domp < cp + (op->nd_opt_len << 3) && EXTRACT_U_1(domp) != '\0')
                        {
                                ND_PRINT((ndo, " "));
                                if ((domp = ns_nprint (ndo, domp, bp)) == NULL)
index b9490f288d6a1ce7bc059f692e075c5837efdd3e..7a0332780c634fc228ded444123320a40ec7f771 100644 (file)
@@ -465,7 +465,7 @@ asn1_parse(netdissect_options *ndo,
                 */
                id = 0;
                ND_TCHECK(*p);
-               while (*p & ASN_BIT8) {
+               while (EXTRACT_U_1(p) & ASN_BIT8) {
                        if (len < 1) {
                                ND_PRINT((ndo, "[Xtagfield?]"));
                                return -1;
index e69d58cd6533ae4040dc52f325e9e359dbed3e08..0bad348c0478b71b1caf6421664568f5d6597a85 100644 (file)
@@ -95,8 +95,8 @@ syslog_print(netdissect_options *ndo,
         msg_off++;
         ND_TCHECK_1(pptr + msg_off);
         while (msg_off <= SYSLOG_MAX_DIGITS &&
-               *(pptr+msg_off) >= '0' &&
-               *(pptr+msg_off) <= '9') {
+               EXTRACT_U_1(pptr + msg_off) >= '0' &&
+               EXTRACT_U_1(pptr + msg_off) <= '9') {
             pri = pri * 10 + (*(pptr+msg_off) - '0');
             msg_off++;
             ND_TCHECK_1(pptr + msg_off);
index fe461bafd6651c1a07672f0e66d2bc34fb7662b2..e3782177a9f4c0534bb3759030479cf37ec51e74 100644 (file)
@@ -516,7 +516,7 @@ telnet_print(netdissect_options *ndo, const u_char *sp, u_int length)
        osp = sp;
 
        ND_TCHECK(*sp);
-       while (length > 0 && *sp == IAC) {
+       while (length > 0 && EXTRACT_U_1(sp) == IAC) {
                /*
                 * Parse the Telnet command without printing it,
                 * to determine its length.