diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-05-13 15:54:00 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-05-13 15:54:00 +0200 |
commit | 06c0deb7935a9390a67bc02d6c323e64c785a026 (patch) | |
tree | c8343c0e1d504b2ae7d1ff5a727084f78a015f7e /NitrokeyManager.cc | |
parent | be0d677aa2e7eb87a309dc3927c0917380892641 (diff) | |
parent | 3b5f40a19ca6c6fde55fcdab4ff0a9f91a46a051 (diff) | |
download | libnitrokey-06c0deb7935a9390a67bc02d6c323e64c785a026.tar.gz libnitrokey-06c0deb7935a9390a67bc02d6c323e64c785a026.tar.bz2 |
Merge branch 'do_not_log_volatile_data'
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r-- | NitrokeyManager.cc | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index 096a8c4..9a9d106 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -26,30 +26,7 @@ char * strndup(const char* str, size_t maxlen){ #endif - - /** - * Copies string from pointer to fixed size C-style array. Src needs to be a valid C-string - eg. ended with '\0'. - * Throws when source is bigger than destination. - * @tparam T type of destination array - * @param dest fixed size destination array - * @param src pointer to source c-style valid string - */ - template <typename T> - void strcpyT(T& dest, const char* src){ - - if (src == nullptr) -// throw EmptySourceStringException(slot_number); - return; - const size_t s_dest = sizeof dest; - LOG(std::string("strcpyT sizes dest src ") - +std::to_string(s_dest)+ " " - +std::to_string(strlen(src))+ " " - ,nitrokey::log::Loglevel::DEBUG_L2); - if (strlen(src) > s_dest){ - throw TooLongStringException(strlen(src), s_dest, src); - } - strncpy((char*) &dest, src, s_dest); - } +using nitrokey::misc::strcpyT; template <typename T> typename T::CommandPayload get_payload(){ |