From: Arran Cudbard-Bell Date: Wed, 25 Jun 2014 19:47:32 +0000 (+0100) Subject: CID #1223702 X-Git-Tag: release_3_0_4_rc2~178 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=freeradius.git;a=commitdiff_plain;h=821eb3af74eefcff5dc449a92c1c1d213ce72f40 CID #1223702 --- diff --git a/src/modules/proto_dhcp/dhcp.c b/src/modules/proto_dhcp/dhcp.c index 9ad51fb..3863c7d 100644 --- a/src/modules/proto_dhcp/dhcp.c +++ b/src/modules/proto_dhcp/dhcp.c @@ -837,20 +837,23 @@ static int fr_dhcp_attr2vp(VALUE_PAIR **vp_p, TALLOC_CTX *ctx, uint8_t const *da uint8_t const *q, *end; vp_cursor_t cursor; + p = data; + q = end = data + len; + + if (!vp->da->flags.array) { + pairstrncpy(vp, (char const *)p, q - p); + break; + } + /* * Initialise the cursor as we may be inserting * multiple additional VPs */ - if (vp->da->flags.array) fr_cursor_init(&cursor, vp_p); - - p = data; - q = end = data + len; + fr_cursor_init(&cursor, vp_p); for (;;) { - if (vp->da->flags.array) { - q = memchr(p, '\0', q - p); - /* Malformed but recoverable */ - if (!q) q = end; - } + q = memchr(p, '\0', q - p); + /* Malformed but recoverable */ + if (!q) q = end; pairstrncpy(vp, (char const *)p, q - p); p = q + 1;