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 04-06-2012, 07:38 PM
Jan Pokorný
 
Default rgmanager: reslist: another string related cleanup

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
reslist.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/reslist.c b/reslist.c
index b75f4b0..43430cd 100644
--- a/reslist.c
+++ b/reslist.c
@@ -107,9 +107,12 @@ _attr_value(resource_node_t *node, const char *attrname, const char *ptype)
/* Difference guaranteed to be non-negative
(for x >= 0: &ra->ra_value[x] >= &ra->ra_value[0]) */
len = (c - ra->ra_value);
- memset(p_type, 0, sizeof(p_type));
+ if (len >= sizeof(p_type))
+ len = sizeof(p_type) - 1;
+
memcpy(p_type, ra->ra_value, len);
-
+ p_type[sizeof(p_type)-1] = '';
+
/* Skip the "%" and recurse */
return _attr_value(node->rn_parent, ++c, p_type);
}
 

Thread Tools




All times are GMT. The time now is 05:25 AM.

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