In: if (... *(p) ...) ...
goto invalid;
/* Magic */
ND_TCHECK_1(cp);
- if (*cp != AHCP_MAGIC_NUMBER)
+ if (EXTRACT_U_1(cp) != AHCP_MAGIC_NUMBER)
goto invalid;
cp += 1;
/* Version */
isnonzero(const u_char *a, size_t len)
{
while (len > 0) {
- if (*a != 0)
+ if (EXTRACT_U_1(a) != 0)
return (1);
a++;
len--;
#include <stdio.h>
#include "netdissect.h"
+#include "extract.h"
#define ASCII_LINELENGTH 300
#define HEXDUMP_BYTES_PER_LINE 16
*
* 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) &&
}
/* Cisco Style NLPID ? */
- if (*p == LLC_UI) {
+ if (EXTRACT_U_1(p) == LLC_UI) {
if (ndo->ndo_eflag)
ND_PRINT((ndo, "CNLPID "));
isoclns_print(ndo, p + 1, length - 1);
ND_DEFAULTPRINT((const u_char *)p, caplen);
return (hdrlen);
}
- if (*p == LLC_XID_FI) {
+ if (EXTRACT_U_1(p) == LLC_XID_FI) {
if (caplen < 3 || length < 3) {
ND_PRINT((ndo, "[|llc]"));
if (caplen > 0)
ND_PRINT((ndo, " SA-Response"));
ND_TCHECK_1(sp);
ND_PRINT((ndo, " %u entries", EXTRACT_U_1(sp)));
- if ((u_int)((*sp * 12) + 8) < len) {
+ if ((u_int)((EXTRACT_U_1(sp) * 12) + 8) < len) {
ND_PRINT((ndo, " [w/data]"));
if (ndo->ndo_vflag > 1) {
ND_PRINT((ndo, " "));
case TUNNEL_ASSIGN_ID:
case TUNNEL_CLIENT_AUTH:
case TUNNEL_SERVER_AUTH:
- if (*data <= 0x1F)
+ if (EXTRACT_U_1(data) <= 0x1F)
{
if (length < 1)
goto trunc;
ND_TCHECK_1(bp);
too_large = 0;
neg = 0;
- if (*bp == '-') {
+ if (EXTRACT_U_1(bp) == '-') {
neg = 1;
bp++;
len--;
* OK, we found a non-digit character. It should be a \r, followed
* by a \n.
*/
- if (*bp != '\r') {
+ if (EXTRACT_U_1(bp) != '\r') {
bp++;
goto invalid;
}
if (len == 0)
goto trunc;
ND_TCHECK_1(bp);
- if (*bp != '\n') {
+ if (EXTRACT_U_1(bp) != '\n') {
bp++;
goto invalid;
}
/* Protocol Version */
ND_TCHECK_1(tptr);
- if (*tptr != 0) {
+ if (EXTRACT_U_1(tptr) != 0) {
/* Skip the rest of the input buffer because even if this is
* a well-formed PDU of a future RPKI-Router protocol version
* followed by a well-formed PDU of RPKI-Router protocol
{
register u_int i;
- if ((i = *cp++) == 0) {
+ if ((i = EXTRACT_U_1(cp)) == 0) {
+ cp++;
i = EXTRACT_BE_U_2(cp);
cp += 2;
}
{
register short i;
- if ((i = *cp++) == 0) {
+ if ((i = EXTRACT_U_1(cp)) == 0) {
+ cp++;
i = EXTRACT_BE_U_2(cp);
cp += 2;
}
ND_PRINT((ndo, "[asnlen=0]"));
return -1;
}
- if (*p & ASN_BIT8) /* negative */
+ if (EXTRACT_U_1(p) & ASN_BIT8) /* negative */
data = -1;
for (i = elem->asnlen; i-- > 0; p++)
data = (data << ASN_SHIFT8) | EXTRACT_U_1(p);
for (; i-- > 0; p++) {
ND_TCHECK_1(p);
o = (o << ASN_SHIFT7) + (*p & ~ASN_BIT8);
- if (*p & ASN_LONGLEN)
+ if (EXTRACT_U_1(p) & ASN_LONGLEN)
continue;
/*
for (*oidlen = 0; i-- > 0; p++) {
ND_TCHECK_1(p);
o = (o << ASN_SHIFT7) + (*p & ~ASN_BIT8);
- if (*p & ASN_LONGLEN)
+ if (EXTRACT_U_1(p) & ASN_LONGLEN)
continue;
/*
p++;
}
ND_TCHECK_1(p);
- if (*p != IAC)
+ if (EXTRACT_U_1(p) != IAC)
goto pktend;
switch (x) {
/* Print options, if any */
while (length != 0) {
ND_TCHECK_1(bp);
- if (*bp != '\0')
+ if (EXTRACT_U_1(bp) != '\0')
ND_PRINT((ndo, " "));
ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend);
if (ui == 0)
/* Print options */
while (length != 0) {
ND_TCHECK_1(bp);
- if (*bp != '\0')
+ if (EXTRACT_U_1(bp) != '\0')
ND_PRINT((ndo, " "));
ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend);
if (ui == 0)
uint32_t len;
ND_TCHECK_1(buf);
- if (*buf != 4 && *buf != 2) {
+ if (EXTRACT_U_1(buf) != 4 && EXTRACT_U_1(buf) != 2) {
ND_PRINT((ndo, "Error! ASCIIZ buffer of type %u", EXTRACT_U_1(buf)));
return maxbuf; /* give up */
}