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 cman_tool: prevent buffer overrun

Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 6d8a1eb... 5a5aa7b... M cman/cman_tool/main.c
cman/cman_tool/main.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index 6d8a1eb..5a5aa7b 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -641,7 +641,7 @@ static void set_votes(commandline_t *comline)
else {
/* Resolve node name into a number */
node.cn_nodeid = 0;
- strcpy(node.cn_name, comline->nodenames[0]);
+ strncpy(node.cn_name, comline->nodenames[0], CMAN_MAX_NODENAME_LEN);
if (cman_get_node(h, node.cn_nodeid, &node))
die("Can't set votes for node %s : %s
", node.cn_name, strerror(errno));
nodeid = node.cn_nodeid;
@@ -864,7 +864,7 @@ static void kill_node(commandline_t *comline)

/* Resolve node name into a number */
node.cn_nodeid = 0;
- strcpy(node.cn_name, comline->nodenames[i]);
+ strncpy(node.cn_name, comline->nodenames[i], CMAN_MAX_NODENAME_LEN);
if (cman_get_node(h, node.cn_nodeid, &node)) {
fprintf(stderr, "Can't kill node %s : %s
", node.cn_name, strerror(errno));
continue;
--
1.7.4.4
 

Thread Tools




All times are GMT. The time now is 04:46 PM.

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