diff options
author | Luke Howard <lukeh@padl.com> | 2011-11-14 16:59:55 +1100 |
---|---|---|
committer | Luke Howard <lukeh@padl.com> | 2011-11-14 16:59:55 +1100 |
commit | ac17a556bd50969c8157d50761449b702afa4af8 (patch) | |
tree | 61900a1a4746f20c2debae948322ea07330a2d44 /lib/radius/parse.c | |
parent | d6e790ddd52c0aa09af6e515d79d3a676c01fdad (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.c | 15 |
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); |