From 58a503a9659c95813d0eb09382e3478b242f2de8 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Sat, 28 Nov 2015 18:48:20 +0100 Subject: [PATCH] amqp: use the right buffer size for sstrncpy buffer is a char *, not an array, so size_of returns the size of the pointer. --- src/amqp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/amqp.c b/src/amqp.c index bf0f80f5..1e23a563 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -194,11 +194,11 @@ static char *camqp_strerror (camqp_config_t *conf, /* {{{ */ switch (r.reply_type) { case AMQP_RESPONSE_NORMAL: - sstrncpy (buffer, "Success", sizeof (buffer)); + sstrncpy (buffer, "Success", buffer_size); break; case AMQP_RESPONSE_NONE: - sstrncpy (buffer, "Missing RPC reply type", sizeof (buffer)); + sstrncpy (buffer, "Missing RPC reply type", buffer_size); break; case AMQP_RESPONSE_LIBRARY_EXCEPTION: @@ -210,7 +210,7 @@ static char *camqp_strerror (camqp_config_t *conf, /* {{{ */ return (sstrerror (r.library_error, buffer, buffer_size)); #endif else - sstrncpy (buffer, "End of stream", sizeof (buffer)); + sstrncpy (buffer, "End of stream", buffer_size); break; case AMQP_RESPONSE_SERVER_EXCEPTION: -- 2.11.0