FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 11-23-2011, 09:15 AM
"Fabio M. Di Nitto"
 
Default libcman: correctly check for vars before using them

Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 5b015f0... ae6c709... M cman/lib/libcman.c
cman/lib/libcman.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
index 5b015f0..ae6c709 100644
--- a/cman/lib/libcman.c
+++ b/cman/lib/libcman.c
@@ -1018,12 +1018,6 @@ static int cman_set_quorum_device(cman_handle_t handle,
char buf[strlen(name)+1 + sizeof(int)];
VALIDATE_HANDLE(h);

- if ((!name) || (strlen(name) > MAX_CLUSTER_MEMBER_NAME_LEN) || (votes < 0))
- {
- errno = EINVAL;
- return -1;
- }
-
memcpy(buf, &votes, sizeof(int));
strcpy(buf+sizeof(int), name);
return info_call(h, ops, buf, strlen(name)+1+sizeof(int), NULL, 0);
@@ -1031,6 +1025,11 @@ static int cman_set_quorum_device(cman_handle_t handle,

int cman_register_quorum_device(cman_handle_t handle, char *name, int votes)
{
+ if ((!name) || (strlen(name) > MAX_CLUSTER_MEMBER_NAME_LEN) || (votes < 0))
+ {
+ errno = EINVAL;
+ return -1;
+ }
return cman_set_quorum_device(handle, CMAN_CMD_REG_QUORUMDEV, name, votes);
}

@@ -1069,6 +1068,11 @@ int cman_get_quorum_device(cman_handle_t handle, struct cman_qdev_info *info)

int cman_update_quorum_device(cman_handle_t handle, char *name, int votes)
{
+ if ((!name) || (strlen(name) > MAX_CLUSTER_MEMBER_NAME_LEN) || (votes < 0))
+ {
+ errno = EINVAL;
+ return -1;
+ }
return cman_set_quorum_device(handle, CMAN_CMD_UPDATE_QUORUMDEV, name, votes);
}

--
1.7.4.4
 

Thread Tools




All times are GMT. The time now is 01:38 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org