From 9c3951314a3a0f623aefbd6c322a4da29550bdc6 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Sat, 23 Jul 2016 18:19:44 +0200 Subject: Reverting memcpy to strcpy Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index d46b718..2a0033f 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -7,14 +7,10 @@ namespace nitrokey{ template void strcpyT(T& dest, const char* src){ const int s = sizeof dest; -// strcpy((char*) &dest, src); - memcpy(&dest, src, s); - dest[s-1] = 0; + assert(strlen(src) <= s); + strncpy((char*) &dest, src, s); } -// template -// void initialize(T& st){ bzero(&st, sizeof(st)); } - template typename T::CommandPayload get_payload(){ //Create, initialize and return by value command payload -- cgit v1.2.3