mirror of
https://github.com/cubixle/radius-rs.git
synced 2026-04-30 15:58:44 +01:00
Fix alignment bug
This commit is contained in:
+4
-5
@@ -31,14 +31,13 @@ impl Attributes {
|
|||||||
attrs.push(AVP {
|
attrs.push(AVP {
|
||||||
typ: bs[i],
|
typ: bs[i],
|
||||||
attribute: if length > 2 {
|
attribute: if length > 2 {
|
||||||
debug!("ATTR {:?}", &bs[i + 2..length]);
|
Attribute(bs[i + 2..i + length].to_vec())
|
||||||
Attribute(bs[i + 2..length + 2].to_vec())
|
|
||||||
} else {
|
} else {
|
||||||
Attribute(vec![])
|
Attribute(vec![])
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
i += 2 + length;
|
i += length;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Attributes(attrs))
|
Ok(Attributes(attrs))
|
||||||
@@ -86,7 +85,7 @@ impl Attributes {
|
|||||||
return Err("attribute is too large".to_owned());
|
return Err("attribute is too large".to_owned());
|
||||||
}
|
}
|
||||||
|
|
||||||
n += 1 + 1 + (attr_len as u16);
|
n += 2 + (attr_len as u16);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(n)
|
Ok(n)
|
||||||
@@ -101,7 +100,7 @@ impl Attributes {
|
|||||||
return Err("attribute is too large".to_owned());
|
return Err("attribute is too large".to_owned());
|
||||||
}
|
}
|
||||||
encoded.push(avp.typ);
|
encoded.push(avp.typ);
|
||||||
encoded.push(attr_len as u8);
|
encoded.push(2 + attr_len as u8);
|
||||||
encoded.extend(&avp.attribute.0);
|
encoded.extend(&avp.attribute.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user