$NetBSD: patch-aa,v 1.1.2.4 2006/08/24 11:51:06 salo Exp $

--- epan/dissectors/packet-radiotap.c.orig	2006-08-23 23:26:24.000000000 +0100
+++ epan/dissectors/packet-radiotap.c	2006-08-24 10:19:28.000000000 +0100
@@ -397,7 +397,12 @@
     guint8 db, rflags;
     guint32 present, next_present;
     int bit;
-	gboolean has_fcs = FALSE;
+    gboolean has_fcs = FALSE;
+    gint8 align;
+#define RTALIGN(size) \
+      align = ((offset + ((size) - 1)) & ~((size) - 1)) - offset; \
+      offset += align; \
+      length_remaining -= align
 
     if(check_col(pinfo->cinfo, COL_PROTOCOL))
 	col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");
@@ -569,6 +574,7 @@
 	    length_remaining--;
 	    break;
 	case IEEE80211_RADIOTAP_CHANNEL:
+	    RTALIGN(2);
 	    if (length_remaining < 4)
 		break;
 	    if (tree) {
@@ -586,6 +592,7 @@
 	case IEEE80211_RADIOTAP_FHSS:
 	case IEEE80211_RADIOTAP_TX_ATTENUATION:
 	case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
+	    RTALIGN(2);
 	    if (length_remaining < 2)
 		break;
 #if 0
@@ -595,6 +602,9 @@
 	    length_remaining-=2;
 	    break;
 	case IEEE80211_RADIOTAP_TSFT:
+#if 0 /* can't happen because always first */
+	    RTALIGN(8);
+#endif
 	    if (length_remaining < 8)
 		break;
 	    if (tree) {
@@ -605,6 +615,7 @@
 	    length_remaining-=8;
 	    break;
 	case IEEE80211_RADIOTAP_LOCK_QUALITY:
+	    RTALIGN(2);
 	    if (length_remaining < 2)
 		break;
 	    if (tree) {
