From: Martin Schwenke Date: Fri, 15 Apr 2016 04:52:45 +0000 (+1000) Subject: ctdb-tools: Remove simple uses of strcpy(3) X-Git-Tag: talloc-2.1.7~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5042802bf67d6db0044119c2d12ce260987c0c48;p=thirdparty%2Fsamba.git ctdb-tools: Remove simple uses of strcpy(3) Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs Autobuild-User(master): Amitay Isaacs Autobuild-Date(master): Sun Apr 17 17:37:06 CEST 2016 on sn-devel-144 --- diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 84d8132fdcc..7305aa4be54 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -92,7 +92,7 @@ static int printm(const char *format, ...) size_t len = strlen(format); char new_format[len+1]; - strcpy(new_format, format); + strncpy(new_format, format, len+1); if (options.machineseparator[0] != ':') { all_string_sub(new_format, @@ -2718,7 +2718,8 @@ static int control_setifacelink(struct ctdb_context *ctdb, int argc, const char talloc_free(tmp_ctx); return -1; } - strcpy(info.name, argv[0]); + strncpy(info.name, argv[0], sizeof(info.name)-1); + info.name[sizeof(info.name)-1] = '\0'; if (strcmp(argv[1], "up") == 0) { info.link_state = 1;