+ /* Sanity checks on packet length / capture length */
+ if (h->caplen == 0) {
+ invalid_header = 1;
+ ND_PRINT("[Invalid header: caplen==0");
+ }
+ if (h->len == 0) {
+ if (!invalid_header) {
+ invalid_header = 1;
+ ND_PRINT("[Invalid header:");
+ } else
+ ND_PRINT(",");
+ ND_PRINT(" len==0");
+ } else if (h->len < h->caplen) {
+ if (!invalid_header) {
+ invalid_header = 1;
+ ND_PRINT("[Invalid header:");
+ } else
+ ND_PRINT(",");
+ ND_PRINT(" len(%u) < caplen(%u)", h->len, h->caplen);
+ }
+ if (h->caplen > MAXIMUM_SNAPLEN) {
+ if (!invalid_header) {
+ invalid_header = 1;
+ ND_PRINT("[Invalid header:");
+ } else
+ ND_PRINT(",");
+ ND_PRINT(" caplen(%u) > %u", h->caplen, MAXIMUM_SNAPLEN);
+ }
+ if (h->len > MAXIMUM_SNAPLEN) {
+ if (!invalid_header) {
+ invalid_header = 1;
+ ND_PRINT("[Invalid header:");
+ } else
+ ND_PRINT(",");
+ ND_PRINT(" len(%u) > %u", h->len, MAXIMUM_SNAPLEN);
+ }
+ if (invalid_header) {
+ ND_PRINT("]\n");
+ return;
+ }
+
+ /*
+ * At this point:
+ * capture length != 0,
+ * packet length != 0,
+ * capture length <= MAXIMUM_SNAPLEN,
+ * packet length <= MAXIMUM_SNAPLEN,
+ * packet length >= capture length.
+ *
+ * Currently, there is no D-Bus printer, thus no need for
+ * bigger lengths.
+ */
+