Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Cluster Development (http://www.linux-archive.org/cluster-development/)
-   -   libcman: fix possible string nontermination: barrier name (http://www.linux-archive.org/cluster-development/711483-libcman-fix-possible-string-nontermination-barrier-name.html)

Jan Pokorný 10-11-2012 02:21 PM

libcman: fix possible string nontermination: barrier name
 
Similar to node name case (separate changeset).

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
cman/lib/libcman.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
index 012047d..f27e726 100644
--- a/cman/lib/libcman.c
+++ b/cman/lib/libcman.c
@@ -912,7 +912,7 @@ int cman_barrier_register(cman_handle_t handle, const char *name, int flags, int
}

binfo.cmd = BARRIER_CMD_REGISTER;
- strncpy(binfo.name, name, sizeof(binfo.name) - 1);
+ strncpy(binfo.name, name, sizeof(binfo.name));
binfo.arg = nodes;
binfo.flags = flags;

@@ -933,7 +933,7 @@ int cman_barrier_change(cman_handle_t handle, const char *name, int flags, int a
}

binfo.cmd = BARRIER_CMD_CHANGE;
- strncpy(binfo.name, name, sizeof(binfo.name) - 1);
+ strncpy(binfo.name, name, sizeof(binfo.name));
binfo.arg = arg;
binfo.flags = flags;

@@ -954,7 +954,7 @@ int cman_barrier_wait(cman_handle_t handle, const char *name)
}

binfo.cmd = BARRIER_CMD_WAIT;
- strncpy(binfo.name, name, sizeof(binfo.name) - 1);
+ strncpy(binfo.name, name, sizeof(binfo.name));

return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0);
}
@@ -972,7 +972,7 @@ int cman_barrier_delete(cman_handle_t handle, const char *name)
}

binfo.cmd = BARRIER_CMD_DELETE;
- strncpy(binfo.name, name, sizeof(binfo.name) - 1);
+ strncpy(binfo.name, name, sizeof(binfo.name));

return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0);
}
--
1.7.11.4

Jan Pokorný 10-11-2012 02:21 PM

libcman: fix possible string nontermination: barrier name
 
Similar to node name case (separate changeset).

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
cman/lib/libcman.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
index f27e726..d9d6c36 100644
--- a/cman/lib/libcman.c
+++ b/cman/lib/libcman.c
@@ -1131,6 +1131,6 @@ int cman_node_fenced(cman_handle_t handle, int nodeid, uint64_t time, char *agen

f.nodeid = nodeid;
f.fence_time = time;
- strncpy(f.fence_agent, agent, sizeof(f.fence_agent) - 1);
+ strncpy(f.fence_agent, agent, sizeof(f.fence_agent));
return info_call(h, CMAN_CMD_UPDATE_FENCE_INFO, &f, sizeof(f), NULL, 0);
}
--
1.7.11.4


All times are GMT. The time now is 01:00 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.