Skip to content

Commit fb3031c

Browse files
committed
Fix zmq_ctx_get_ext not setting the length of the out string
1 parent 34f7fa2 commit fb3031c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/ctx.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ int zmq::ctx_t::set (int option_, const void *optval_, size_t optvallen_)
293293
return -1;
294294
}
295295

296-
int zmq::ctx_t::get (int option_, void *optval_, const size_t *optvallen_)
296+
int zmq::ctx_t::get (int option_, void *optval_, size_t *optvallen_)
297297
{
298298
const bool is_int = (*optvallen_ == sizeof (int));
299299
int *value = static_cast<int *> (optval_);
@@ -607,7 +607,7 @@ int zmq::thread_ctx_t::set (int option_, const void *optval_, size_t optvallen_)
607607

608608
int zmq::thread_ctx_t::get (int option_,
609609
void *optval_,
610-
const size_t *optvallen_)
610+
size_t *optvallen_)
611611
{
612612
const bool is_int = (*optvallen_ == sizeof (int));
613613
int *value = static_cast<int *> (optval_);
@@ -630,6 +630,7 @@ int zmq::thread_ctx_t::get (int option_,
630630
scoped_lock_t locker (_opt_sync);
631631
memcpy (optval_, _thread_name_prefix.data (),
632632
_thread_name_prefix.size ());
633+
*optvallen_ = _thread_name_prefix.size ();
633634
return 0;
634635
}
635636
break;

src/ctx.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class thread_ctx_t
4646
const char *name_ = NULL) const;
4747

4848
int set (int option_, const void *optval_, size_t optvallen_);
49-
int get (int option_, void *optval_, const size_t *optvallen_);
49+
int get (int option_, void *optval_, size_t *optvallen_);
5050

5151
protected:
5252
// Synchronisation of access to context options.
@@ -89,7 +89,7 @@ class ctx_t ZMQ_FINAL : public thread_ctx_t
8989

9090
// Set and get context properties.
9191
int set (int option_, const void *optval_, size_t optvallen_);
92-
int get (int option_, void *optval_, const size_t *optvallen_);
92+
int get (int option_, void *optval_, size_t *optvallen_);
9393
int get (int option_);
9494

9595
// Create and destroy a socket.

0 commit comments

Comments
 (0)