]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix buffer overflow in soh.c
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 20 Nov 2015 17:05:49 +0000 (12:05 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 20 Nov 2015 17:05:55 +0000 (12:05 -0500)
src/main/soh.c

index ab2bad02594ebbef21dc298af4b16346d2697410..754ad84e478a1cefde8624a17c19027d8ddf6a6b 100644 (file)
@@ -145,7 +145,6 @@ static int eapsoh_mstlv(REQUEST *request, uint8_t const *p, unsigned int data_le
        VALUE_PAIR *vp;
        uint8_t c;
        int t;
-       char *q;
 
        while (data_len > 0) {
                c = *p++;
@@ -248,11 +247,7 @@ static int eapsoh_mstlv(REQUEST *request, uint8_t const *p, unsigned int data_le
                        vp = pair_make_request("SoH-MS-Machine-Name", NULL, T_OP_EQ);
                        if (!vp) return 0;
 
-                       vp->vp_strvalue = q = talloc_array(vp, char, t);
-                       vp->type = VT_DATA;
-
-                       memcpy(q, p, t);
-                       q[t] = 0;
+                       fr_pair_value_bstrncpy(vp, p, t);
 
                        p += t;
                        data_len -= 2 + t;