1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

ctdb-tools/ctdb: Improve error checking when parsing node string

If a node isn't numeric then it is silently converted to 0.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Martin Schwenke 2013-11-22 13:57:31 +11:00 committed by Michael Adam
parent 44a0466ac1
commit 0fe178eb3a

View File

@ -223,7 +223,14 @@ static bool parse_nodestring(struct ctdb_context *ctdb,
tok = strtok(ns, ",");
while (tok != NULL) {
uint32_t pnn;
i = (uint32_t)strtoul(tok, NULL, 0);
char *endptr;
i = (uint32_t)strtoul(tok, &endptr, 0);
if (i == 0 && tok == endptr) {
DEBUG(DEBUG_ERR,
("Invalid node %s\n", tok));
talloc_free(tmp_ctx);
exit(ERR_NONODE);
}
if (i >= nodemap->num) {
DEBUG(DEBUG_ERR, ("Node %u does not exist\n", i));
talloc_free(tmp_ctx);