diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-06-23 15:26:55 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-06-23 15:28:48 +0100 |
commit | 41e9cab4e1c9d6df26db1cecd30fe6aafacc80a7 (patch) | |
tree | 2b6fda50d0f007b4c55d6a051be0194bb8100a39 /src/device/log.hpp | |
parent | device_ledger: fix potential buffer overflow from bad size calc (diff) | |
download | monero-41e9cab4e1c9d6df26db1cecd30fe6aafacc80a7.tar.xz |
device: misc cleanup
use snprintf "just in case" where appropriate
consistently use unsigned for temp values
pass std::string by const ref rather than by value
add length check (which can't happen in practice) for memcpy
Diffstat (limited to '')
-rw-r--r-- | src/device/log.hpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/device/log.hpp b/src/device/log.hpp index 1ab572c2c..1d1635dc1 100644 --- a/src/device/log.hpp +++ b/src/device/log.hpp @@ -44,8 +44,8 @@ namespace hw { namespace ledger { void buffer_to_str(char *to_buff, size_t to_len, const char *buff, size_t len) ; - void log_hexbuffer(std::string msg, const char* buff, size_t len); - void log_message(std::string msg, std::string info ); + void log_hexbuffer(const std::string &msg, const char* buff, size_t len); + void log_message(const std::string &msg, const std::string &info ); #ifdef DEBUG_HWDEVICE #define TRACK printf("file %s:%d\n",__FILE__, __LINE__) //#define TRACK MCDEBUG("ledger"," At file " << __FILE__ << ":" << __LINE__) @@ -59,8 +59,8 @@ namespace hw { crypto::ec_scalar decrypt(const crypto::ec_scalar &res); rct::keyV decrypt(const rct::keyV &keys); - void check32(std::string msg, std::string info, const char *h, const char *d, bool crypted=false); - void check8(std::string msg, std::string info, const char *h, const char *d, bool crypted=false); + void check32(const std::string &msg, const std::string &info, const char *h, const char *d, bool crypted=false); + void check8(const std::string &msg, const std::string &info, const char *h, const char *d, bool crypted=false); void set_check_verbose(bool verbose); #endif |