From c68b561f048a02f479819b1c9cb3b5b896db18a6 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Fri, 6 May 2016 12:26:29 +0530 Subject: quotad: fix potential buffer overflows This converts sprintf to gf_asprintf in following components: * quotad.c * dht * afr * protocol/client * rpc/rpc-lib * rpc/rpc-transport Change-Id: If8a267bab3d91003bdef3a92664077a0136745ee BUG: 1332073 Signed-off-by: Raghavendra G Reviewed-on: http://review.gluster.org/14102 Tested-by: Manikandan Selvaganesh Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Manikandan Selvaganesh --- libglusterfs/src/common-utils.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libglusterfs/src/common-utils.c') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 311ed72d04c..8dc5141247e 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -668,9 +668,14 @@ gf_dump_config_flags () /* Define to the full name and version of this package. */ #ifdef PACKAGE_STRING { - char msg[128]; - sprintf (msg, "package-string: %s", PACKAGE_STRING); - gf_msg_plain_nomem (GF_LOG_ALERT, msg); + char *msg = NULL; + int ret = -1; + + ret = gf_asprintf (&msg, "package-string: %s", PACKAGE_STRING); + if (ret >= 0) { + gf_msg_plain_nomem (GF_LOG_ALERT, msg); + GF_FREE (msg); + } } #endif -- cgit