diff options
author | Martin Schwenke <martin@meltin.net> | 2013-11-22 13:57:31 +1100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-11-27 18:46:17 +0100 |
commit | 0fe178eb3ae75c08b040813ddb4ed7b8ac3ead44 (patch) | |
tree | 92a3af0344928b181966c061715190b8e43a35e8 /ctdb | |
parent | 44a0466ac1c69fe9f0734a6225c1a1a38e48299a (diff) | |
download | samba-0fe178eb3ae75c08b040813ddb4ed7b8ac3ead44.tar.gz samba-0fe178eb3ae75c08b040813ddb4ed7b8ac3ead44.tar.xz samba-0fe178eb3ae75c08b040813ddb4ed7b8ac3ead44.zip |
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>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/tools/ctdb.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 3db2668e1b..7b046c40f4 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -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); |