diff options
author | Volker Lendecke <vl@samba.org> | 2015-03-13 14:20:05 +0000 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2015-03-13 19:14:20 +0100 |
commit | d171d2010a256a46446de5328a0897df3838855a (patch) | |
tree | d3da2f2e4f378d50909908f7003011c9b698c62f /ctdb/server | |
parent | 8d9bb5c54aae0099e0dde2d9a904676fcb9340c0 (diff) | |
download | samba-d171d2010a256a46446de5328a0897df3838855a.tar.gz |
ctdb: Fix CID 1125613 Destination buffer too small
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Mar 13 19:14:20 CET 2015 on sn-devel-104
Diffstat (limited to 'ctdb/server')
-rw-r--r-- | ctdb/server/eventscript.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c index b51d95350db..4dd437924f3 100644 --- a/ctdb/server/eventscript.c +++ b/ctdb/server/eventscript.c @@ -184,7 +184,12 @@ static struct ctdb_scripts_wire *ctdb_get_script_list(struct ctdb_context *ctdb, for (i = 0; i < count; i++) { struct ctdb_script_wire *s = &scripts->scripts[i]; - strcpy(s->name, namelist[i]->d_name); + if (strlcpy(s->name, namelist[i]->d_name, sizeof(s->name)) >= + sizeof(s->name)) { + s->status = -ENAMETOOLONG; + continue; + } + s->status = 0; if (!check_executable(ctdb->event_script_dir, namelist[i]->d_name)) { @@ -335,6 +340,7 @@ static int script_status(struct ctdb_scripts_wire *scripts) for (i = 0; i < scripts->num_scripts; i++) { switch (scripts->scripts[i].status) { + case -ENAMETOOLONG: case -ENOENT: case -ENOEXEC: /* Disabled or missing; that's OK. */ |