]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ascii.c
Use more the EXTRACT_U_1() macro (55/n)
[tcpdump] / print-ascii.c
index 3cefef33aeb4f8578138e81e49e857b623aa3a9f..2e5812e4c05eb49098c7b9de6d8730568ad07fee 100644 (file)
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define NETDISSECT_REWORKED
+/* \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 "interface.h"
+#include "netdissect.h"
+#include "extract.h"
 
 #define ASCII_LINELENGTH 300
 #define HEXDUMP_BYTES_PER_LINE 16
@@ -65,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') {
                        /*
@@ -77,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) &&