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

[Cluster-devel] cluster/cman/daemon cmanccs.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rmccabe sourceware org	2007-10-24 05:58:07

Modified files:
	cman/daemon    : cmanccs.c 

Log message:
	Commit msg with the last commit went missing..
	
	- Fix unsafe string handling:
	- replace memset(s,c,n);sprintf(s,...); with snprintf with proper error checking
	- don't overflow the stack if the cluster name specified in the env var is too long
	- don't overflow the stack if the local nodename from uname(2) is too long
	- don't overflow the stack if the local nodename specified in the env var is too long
	
	- Don't leak the ccs descriptor in get_ccs_join_info() on errors
	- Fix a couple of small memory leaks in error paths
	- Handle OOM conditions

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cmanccs.c.diff?cvsroot=cluster&r1=1.35&r2=1.36

--- cluster/cman/daemon/cmanccs.c	2007/10/24 05:55:07	1.35
+++ cluster/cman/daemon/cmanccs.c	2007/10/24 05:58:07	1.36
@@ -637,6 +637,8 @@
 	/* optional security key filename */
 	if (getenv("CMAN_KEYFILE")) {
 		key_filename = strdup(getenv("CMAN_KEYFILE"));
+		if (key_filename == NULL)
+			return -ENOMEM;
 	}
 	else {
 		error = ccs_get(cd, KEY_PATH, &str);
@@ -662,13 +664,13 @@
 		error = ccs_get(cd, path, &str);
 		if (!error) {
 			int votestmp = atoi(str);
+			free(str);
 			if (votestmp < 0 || votestmp > 255) {
 				log_printf(LOG_ERR, "invalid votes value %d", votestmp);
 				write_cman_pipe("Found invalid votes for node in CCS");
 				return -EINVAL;
 			}
 			votes = votestmp;
-			free(str);
 		}
 		else {
 			votes = 1;


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