From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 24 Oct 2007 05:58:07 -0000 Subject: [Cluster-devel] cluster/cman/daemon cmanccs.c Message-ID: <20071024055807.1373.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: rmccabe at 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;