summaryrefslogtreecommitdiff
path: root/lib/radius/parse.c
diff options
context:
space:
mode:
authorLuke Howard <lukeh@padl.com>2011-11-14 16:59:55 +1100
committerLuke Howard <lukeh@padl.com>2011-11-14 16:59:55 +1100
commitac17a556bd50969c8157d50761449b702afa4af8 (patch)
tree61900a1a4746f20c2debae948322ea07330a2d44 /lib/radius/parse.c
parentd6e790ddd52c0aa09af6e515d79d3a676c01fdad (diff)
port new RADIUS library to Windows
Conflicts: lib/configure.ac lib/include/radsec/radsec.h lib/radius/client.h
Diffstat (limited to 'lib/radius/parse.c')
-rw-r--r--lib/radius/parse.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/radius/parse.c b/lib/radius/parse.c
index cd7491a..8446306 100644
--- a/lib/radius/parse.c
+++ b/lib/radius/parse.c
@@ -30,18 +30,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "client.h"
+
+#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
+#endif
ssize_t nr_vp_sscanf_value(VALUE_PAIR *vp, const char *value)
{
char *end;
switch (vp->da->type) {
- case RS_TYPE_STRING:
- strlcpy(vp->vp_strvalue, value, sizeof(vp->vp_strvalue));
- vp->length = strlen(vp->vp_strvalue);
- return vp->length;
+ case RS_TYPE_STRING: {
+ size_t len = strlen(value);
+ if (len >= RS_MAX_STRING_LEN)
+ return -RSE_ATTR_TOO_LARGE;
+
+ memcpy(vp->vp_strvalue, value, len + 1);
+ return (vp->length = len);
+ }
case RS_TYPE_DATE:
case RS_TYPE_INTEGER:
vp->vp_integer = strtoul(value, &end, 10);