]> The Tcpdump Group git mirrors - tcpdump/commitdiff
RESP: Use GET_U_1() to replace direct dereferences
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 10 Aug 2020 15:03:59 +0000 (17:03 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 10 Aug 2020 15:18:42 +0000 (17:18 +0200)
Moreover:
Fix spaces

print-resp.c

index 0649c89fe556c4fd8633d9b6e572af9e6da73b35..244fec58301120fc93cc2d4046aa00c719f15707 100644 (file)
@@ -89,8 +89,9 @@ static int resp_get_length(netdissect_options *, const u_char *, int, const u_ch
 #define FIND_CRLF(_ptr, _len)                   \
     for (;;) {                                  \
         LCHECK2(_len, 2);                       \
-        ND_TCHECK_2(_ptr);                   \
-        if (*_ptr == '\r' && *(_ptr+1) == '\n') \
+        ND_TCHECK_2(_ptr);                      \
+        if (GET_U_1(_ptr) == '\r' &&            \
+            GET_U_1(_ptr+1) == '\n')            \
             break;                              \
         _ptr++;                                 \
         _len--;                                 \
@@ -116,7 +117,8 @@ static int resp_get_length(netdissect_options *, const u_char *, int, const u_ch
     for (;;) {                              \
         LCHECK(_len);                       \
         ND_TCHECK_1(_ptr);                  \
-        if (*_ptr == '\r' || *_ptr == '\n') \
+        if (GET_U_1(_ptr) == '\r' ||        \
+            GET_U_1(_ptr) == '\n')          \
             break;                          \
         _ptr++;                             \
         _len--;                             \
@@ -151,7 +153,8 @@ static int resp_get_length(netdissect_options *, const u_char *, int, const u_ch
                  */                              \
                 goto trunc;                      \
             }                                    \
-            if (*_ptr != '\r' && *_ptr != '\n')  \
+            if (GET_U_1(_ptr) != '\r' &&         \
+                GET_U_1(_ptr) != '\n')           \
                 break;                           \
             _found_cr_or_lf = 1;                 \
             _ptr++;                              \