Package: freeradius / 3.0.12+dfsg-5+deb9u1

fr-gv-303.patch Patch series | download
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
From 21e2e95751bfb54c0fb0328392d06671a75c191c Mon Sep 17 00:00:00 2001
From: "Alan T. DeKok" <aland@freeradius.org>
Date: Mon, 3 Jul 2017 15:37:44 -0400
Subject: [PATCH] FR-GV-303 - do memchr() of end-p, not q-p

---
 src/modules/proto_dhcp/dhcp.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

Index: freeradius-3.0.12+dfsg/src/modules/proto_dhcp/dhcp.c
===================================================================
--- freeradius-3.0.12+dfsg.orig/src/modules/proto_dhcp/dhcp.c
+++ freeradius-3.0.12+dfsg/src/modules/proto_dhcp/dhcp.c
@@ -773,25 +773,23 @@ static int fr_dhcp_attr2vp(TALLOC_CTX *c
 		 *	multiple additional VPs
 		 */
 		fr_cursor_init(&cursor, vp_p);
-		for (;;) {
-			q = memchr(p, '\0', q - p);
+		while (p < end) {
+			q = memchr(p, '\0', end - p);
 			/* Malformed but recoverable */
 			if (!q) q = end;
 
 			fr_pair_value_bstrncpy(vp, (char const *)p, q - p);
 			p = q + 1;
 
+			if (p >= end) break;
+
 			/* Need another VP for the next round */
-			if (p < end) {
-				vp = fr_pair_afrom_da(ctx, vp->da);
-				if (!vp) {
-					fr_pair_list_free(vp_p);
-					return -1;
-				}
-				fr_cursor_insert(&cursor, vp);
-				continue;
+			vp = fr_pair_afrom_da(ctx, vp->da);
+			if (!vp) {
+				fr_pair_list_free(vp_p);
+				return -1;
 			}
-			break;
+			fr_cursor_insert(&cursor, vp);
 		}
 	}
 		break;