]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ascii.c
Use more the EXTRACT_U_1() macro (55/n)
[tcpdump] / print-ascii.c
index 92229a68670ee045907918043c630780d49e7564..2e5812e4c05eb49098c7b9de6d8730568ad07fee 100644 (file)
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/* \summary: ASCII packet dump printer */
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 #include <stdio.h>
 
 #include "netdissect.h"
+#include "extract.h"
 
 #define ASCII_LINELENGTH 300
 #define HEXDUMP_BYTES_PER_LINE 16
@@ -64,7 +67,8 @@ ascii_print(netdissect_options *ndo,
                length = caplength;
        ND_PRINT((ndo, "\n"));
        while (length > 0) {
-               s = *cp++;
+               s = EXTRACT_U_1(cp);
+               cp++;
                length--;
                if (s == '\r') {
                        /*
@@ -76,7 +80,7 @@ ascii_print(netdissect_options *ndo,
                         *
                         * In the middle of a line, just print a '.'.
                         */
-                       if (length > 1 && *cp != '\n')
+                       if (length > 1 && EXTRACT_U_1(cp) != '\n')
                                ND_PRINT((ndo, "."));
                } else {
                        if (!ND_ISGRAPH(s) &&