From: Ruben Kerkhof Date: Sat, 28 Nov 2015 17:48:20 +0000 (+0100) Subject: amqp: use the right buffer size for sstrncpy X-Git-Tag: collectd-5.6.0~563^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fdf35969e6616be69f376c213235072cccf06569;p=collectd.git amqp: use the right buffer size for sstrncpy buffer is a char *, not an array, so size_of returns the size of the pointer. --- diff --git a/src/amqp.c b/src/amqp.c index aba4f012..4206bdc1 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -199,11 +199,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: @@ -215,7 +215,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: