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 10-25-2011, 12:09 PM
"Fabio M. Di Nitto"
 
Default config: fix a few theoretical buffer overflows

Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
:100644 100644 12c5320... 12536ae... M config/libs/libccsconfdb/extras.c
config/libs/libccsconfdb/extras.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/config/libs/libccsconfdb/extras.c b/config/libs/libccsconfdb/extras.c
index 12c5320..12536ae 100644
--- a/config/libs/libccsconfdb/extras.c
+++ b/config/libs/libccsconfdb/extras.c
@@ -65,7 +65,7 @@ int ccs_lookup_nodename(int cd, const char *nodename, char **retval)
}

/* Try just the hostname */
- strcpy(host_only, nodename);
+ strncpy(host_only, nodename, sizeof(host_only) - 1);
p = strchr(host_only, '.');
if (p != NULL) {
*p = '';
@@ -134,7 +134,7 @@ int ccs_lookup_nodename(int cd, const char *nodename, char **retval)
errno = E2BIG;
return -1;
}
- strcpy(canonical_name, str);
+ strncpy(canonical_name, str, sizeof(canonical_name) - 1);
}

if (strlen(str) >= sizeof(cur_node)) {
@@ -143,7 +143,7 @@ int ccs_lookup_nodename(int cd, const char *nodename, char **retval)
return -1;
}

- strcpy(cur_node, str);
+ strncpy(cur_node, str, sizeof(cur_node) - 1);

p = strchr(cur_node, '.');
if (p != NULL)
--
1.7.4.4
 

Thread Tools




All times are GMT. The time now is 09:08 AM.

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