From d672e0fa1d4502603a064e390fba21691735a6d3 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Tue, 8 Oct 2019 12:06:11 +0200 Subject: [HICN-303] Fixed reading size of authentication header which might have caused a bufferoverflow Change-Id: I46ae0539a51c9a2a11d8acfe4146470f2d4fa21d Signed-off-by: Alberto Compagno --- lib/src/compat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/compat.c b/lib/src/compat.c index 633037a0f..38c78d99a 100644 --- a/lib/src/compat.c +++ b/lib/src/compat.c @@ -182,8 +182,10 @@ hicn_packet_get_header_length (hicn_format_t format, const hicn_header_t * h, int is_ipv4 = _is_ipv4 (format); int is_ipv6 = _is_ipv6 (format); // The signature payload is expressed as number of 32 bits words - *header_length += (is_ah * is_ipv4) * (h->v4ah.ah.payloadlen) << 2; - *header_length += (is_ah * is_ipv6) * (h->v6ah.ah.payloadlen) << 2; + if (is_ah && is_ipv4) + *header_length += (h->v4ah.ah.payloadlen) << 2; + else if(is_ah && is_ipv6) + *header_length += (h->v6ah.ah.payloadlen) << 2; return HICN_LIB_ERROR_NONE; } -- cgit 1.2.3-korg option value='stable/1606'>stable/1606 Vector Packet ProcessingGrokmirror user
aboutsummaryrefslogtreecommitdiffstats
blob: 19378e8584aa013e4842c6900ce9b8375a4c6d4a (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115