summaryrefslogtreecommitdiff
path: root/net/wireshark/patches/patch-aa
blob: 554bd378890dfe548b444dc5ca969d2419c75918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$NetBSD: patch-aa,v 1.2 2006/07/23 17:31:08 drochner Exp $

--- epan/dissectors/packet-radiotap.c.orig	2006-07-17 21:59:28.000000000 +0200
+++ epan/dissectors/packet-radiotap.c
@@ -388,6 +388,11 @@ dissect_radiotap(tvbuff_t *tvb, packet_i
     guint8 db, rflags;
     guint32 present, next_present;
     int bit;
+    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");
@@ -559,6 +564,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i
 	    length_remaining--;
 	    break;
 	case IEEE80211_RADIOTAP_CHANNEL:
+	    RTALIGN(2);
 	    if (length_remaining < 4)
 		break;
 	    if (tree) {
@@ -577,6 +583,7 @@ dissect_radiotap(tvbuff_t *tvb, packet_i
 	case IEEE80211_RADIOTAP_LOCK_QUALITY:
 	case IEEE80211_RADIOTAP_TX_ATTENUATION:
 	case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
+	    RTALIGN(2);
 	    if (length_remaining < 2)
 		break;
 #if 0
@@ -586,6 +593,9 @@ dissect_radiotap(tvbuff_t *tvb, packet_i
 	    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) {