summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.c
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2016-05-06 12:26:29 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-08-27 04:10:42 -0700
commit6b406ac42f55233df474fa304dbb9e6fc447bd8f (patch)
treed4bd0fb066871bd210c0aa836778f7da180580b0 /libglusterfs/src/common-utils.c
parent50fa85c071553b41f33a8167b31c8a9b54cfe3e3 (diff)
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 This is a backport of http://review.gluster.org/#/c/14102/ > Change-Id: If8a267bab3d91003bdef3a92664077a0136745ee > BUG: 1332073 > Signed-off-by: Raghavendra G <rgowdapp@redhat.com> > Reviewed-on: http://review.gluster.org/14102 > Tested-by: Manikandan Selvaganesh <mselvaga@redhat.com> > Smoke: Gluster Build System <jenkins@build.gluster.org> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Manikandan Selvaganesh <mselvaga@redhat.com> Change-Id: If8a267bab3d91003bdef3a92664077a0136745ee BUG: 1366746 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-on: http://review.gluster.org/15325 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: Manikandan Selvaganesh <mselvaga@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r--libglusterfs/src/common-utils.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index b62e69cf102..973e31c636c 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -667,9 +667,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