[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 14/19] config: make sure error reporting does not overflow buffers



Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>
---
:100644 100644 9479bc2... a25df09... M	config/plugins/xml/config.c
 config/plugins/xml/config.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/config/plugins/xml/config.c b/config/plugins/xml/config.c
index 9479bc2..a25df09 100644
--- a/config/plugins/xml/config.c
+++ b/config/plugins/xml/config.c
@@ -106,11 +106,11 @@ static int xml_readconfig(struct objdb_iface_ver0 *objdb, const char **error_str
 
 	/* Read low-level totem/aisexec etc config from cluster.conf */
 	if (!(ret = init_config(objdb, configfile, error_reason)))
-		sprintf(error_reason, "Successfully read config from %s\n",
-			configfile);
+		snprintf(error_reason, sizeof(error_reason),
+			 "Successfully read config from %s\n", configfile);
 	else
-		sprintf(error_reason, "Unable to read config from %s\n",
-			configfile);
+		snprintf(error_reason, sizeof(error_reason),
+			"Unable to read config from %s\n", configfile);
 
 	*error_string = error_reason;
 
-- 
1.7.4.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]