summaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-23 18:19:44 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:57 +0200
commit9c3951314a3a0f623aefbd6c322a4da29550bdc6 (patch)
tree46904573bc9921b58ced93e5f99c779e805d7a7c /NitrokeyManager.cc
parent4963e8c0a9a371e2ad5f740aee7a73cb545a6ad4 (diff)
downloadlibnitrokey-9c3951314a3a0f623aefbd6c322a4da29550bdc6.tar.gz
libnitrokey-9c3951314a3a0f623aefbd6c322a4da29550bdc6.tar.bz2
Reverting memcpy to strcpy
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc8
1 files 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 <typename T>
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 <typename T>
-// void initialize(T& st){ bzero(&st, sizeof(st)); }
-
template <typename T>
typename T::CommandPayload get_payload(){
//Create, initialize and return by value command payload