From 505a9bce029e51540739c853a6c9eef0ecfb2e90 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 4 Apr 2018 11:07:56 -0700 Subject: fixes #329 type checking not done for setopt --- src/protocol/pair1/pair.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/protocol/pair1/pair.c') diff --git a/src/protocol/pair1/pair.c b/src/protocol/pair1/pair.c index ee67cf7b..becbbfa7 100644 --- a/src/protocol/pair1/pair.c +++ b/src/protocol/pair1/pair.c @@ -397,12 +397,12 @@ pair1_sock_close(void *arg) } static int -pair1_sock_setopt_raw(void *arg, const void *buf, size_t sz) +pair1_sock_setopt_raw(void *arg, const void *buf, size_t sz, int typ) { pair1_sock *s = arg; int rv; nni_mtx_lock(&s->mtx); - rv = s->started ? NNG_ESTATE : nni_setopt_bool(&s->raw, buf, sz); + rv = s->started ? NNG_ESTATE : nni_copyin_bool(&s->raw, buf, sz, typ); nni_mtx_unlock(&s->mtx); return (rv); } @@ -415,12 +415,12 @@ pair1_sock_getopt_raw(void *arg, void *buf, size_t *szp, int typ) } static int -pair1_sock_setopt_maxttl(void *arg, const void *buf, size_t sz) +pair1_sock_setopt_maxttl(void *arg, const void *buf, size_t sz, int typ) { pair1_sock *s = arg; int rv; nni_mtx_lock(&s->mtx); // Have to be locked against recv cb. - rv = nni_setopt_int(&s->ttl, buf, sz, 1, 255); + rv = nni_copyin_int(&s->ttl, buf, sz, 1, 255, typ); nni_mtx_unlock(&s->mtx); return (rv); } @@ -433,12 +433,12 @@ pair1_sock_getopt_maxttl(void *arg, void *buf, size_t *szp, int typ) } static int -pair1_sock_setopt_poly(void *arg, const void *buf, size_t sz) +pair1_sock_setopt_poly(void *arg, const void *buf, size_t sz, int typ) { pair1_sock *s = arg; int rv; nni_mtx_lock(&s->mtx); - rv = s->started ? NNG_ESTATE : nni_setopt_bool(&s->poly, buf, sz); + rv = s->started ? NNG_ESTATE : nni_copyin_bool(&s->poly, buf, sz, typ); nni_mtx_unlock(&s->mtx); return (rv); } -- cgit v1.2.3-70-g09d2