From: Francois-Xavier Le Bail Date: Mon, 10 Aug 2020 15:03:59 +0000 (+0200) Subject: RESP: Use GET_U_1() to replace direct dereferences X-Git-Tag: tcpdump-4.99-bp~273 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/5807acd8ee7cba6ca38ca4052fd6972a7eeddb4f RESP: Use GET_U_1() to replace direct dereferences Moreover: Fix spaces --- diff --git a/print-resp.c b/print-resp.c index 0649c89f..244fec58 100644 --- a/print-resp.c +++ b/print-resp.c @@ -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++; \