summaryrefslogtreecommitdiffstats
path: root/src/vty
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-07-09 19:24:16 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2018-07-09 23:41:11 +0200
commit4e0add239f6516c11631a7539653bac6b6a51970 (patch)
tree4815b78c1f6a585a21b8f08cb6715d86cbd9bfd0 /src/vty
parentf2d323ef0f56892cdc52ccfd3f74c9084fb704f7 (diff)
vty: cosmetic: cmd_deopt(): use talloc_strndup(), not memcpy()
Change-Id: Ibf870ae02be706f802482f7cff6589a70cde8320
Diffstat (limited to 'src/vty')
-rw-r--r--src/vty/command.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/vty/command.c b/src/vty/command.c
index 689609c0..51dece3a 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -1311,18 +1311,11 @@ cmd_deopt(const char *str)
* match check for "blah"
*/
size_t len = strlen(str);
- char *tmp;
if (len < 3)
return NULL;
- /* tmp will hold a string of len-2 chars, so 'len' size is fine */
- tmp = talloc_size(tall_vty_cmd_ctx, len);
-
- memcpy(tmp, (str + 1), len - 2);
- tmp[len - 2] = '\0';
-
- return tmp;
+ return talloc_strndup(tall_vty_cmd_ctx, str + 1, len - 2);
}
static enum match_type