* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89 2004-03-23 19:03:03 fenner Exp $ (LBL)";
+#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "addrtoname.h"
#include "extract.h" /* must come after interface.h */
-#ifndef lint
-static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.87 2003-11-15 00:39:19 guy Exp $ (LBL)";
-#endif
static const char *ns_ops[] = {
"", " inv_q", " stat", " op3", " notify", " update", " op6", " op7",
" op8", " updataA", " updateD", " updateDA",
blabel_print(const u_char *cp)
{
int bitlen, slen, b;
- int truncated = 0;
const u_char *bitp, *lim;
char tc;
if ((bitlen = *cp) == 0)
bitlen = 256;
slen = (bitlen + 3) / 4;
- if ((lim = cp + 1 + slen) > snapend) {
- truncated = 1;
- lim = snapend;
- }
+ lim = cp + 1 + slen;
/* print the bit string as a hex string */
printf("\\[x");
- for (bitp = cp + 1, b = bitlen; bitp < lim && b > 7; b -= 8, bitp++)
+ for (bitp = cp + 1, b = bitlen; bitp < lim && b > 7; b -= 8, bitp++) {
+ TCHECK(*bitp);
printf("%02x", *bitp);
- if (bitp == lim)
- printf("...");
- else if (b > 4) {
+ }
+ if (b > 4) {
+ TCHECK(*bitp);
tc = *bitp++;
printf("%02x", tc & (0xff << (8 - b)));
} else if (b > 0) {
+ TCHECK(*bitp);
tc = *bitp++;
printf("%1x", ((tc >> 4) & 0x0f) & (0x0f << (4 - b)));
}
printf("/%d]", bitlen);
-
- return(truncated ? NULL : lim);
+ return lim;
+trunc:
+ printf(".../%d]", bitlen);
+ return NULL;
}
static int