summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-02-05 14:36:29 +1100
committerAmitay Isaacs <amitay@gmail.com>2013-02-05 16:05:13 +1100
commit37632efde0b365f43f162aa7a6ad15fe00878ab8 (patch)
treec01aa9029849c56c7ba1078c74431637636a73aa
parente8837204610b42ef2c0c38cd880524ec92dee4e9 (diff)
downloadsamba-37632efde0b365f43f162aa7a6ad15fe00878ab8.tar.gz
samba-37632efde0b365f43f162aa7a6ad15fe00878ab8.tar.xz
samba-37632efde0b365f43f162aa7a6ad15fe00878ab8.zip
ctdbd: Don't use a fixed length buffer for the hung script command
The amount of data to write into the buffer wasn't constrained anywhere... Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 9b0d56b16775aa16f33bdfdf831256e085fa3339)
-rw-r--r--ctdb/server/eventscript.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index ae744c834b..817cb0cbc4 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -531,14 +531,16 @@ static void ctdb_run_debug_hung_script(struct ctdb_context *ctdb, struct ctdb_ev
return;
}
if (pid == 0) {
- char buf[200];
+ char *buf;
if (getenv("CTDB_DEBUG_HUNG_SCRIPT") != NULL) {
debug_hung_script = getenv("CTDB_DEBUG_HUNG_SCRIPT");
}
- sprintf(buf, "%s %d", debug_hung_script, state->child);
+ buf = talloc_asprintf(NULL, "%s %d",
+ debug_hung_script, state->child);
system(buf);
+ talloc_free(buf);
/* Now we can kill the child */
ctdb_kill(state->ctdb, state->child, SIGTERM);