summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/store.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/discord/store.cpp b/discord/store.cpp
index 8e88e7b..9b615fd 100644
--- a/discord/store.cpp
+++ b/discord/store.cpp
@@ -2140,7 +2140,7 @@ const char *Store::Database::ErrStr() const {
const char *errmsg = sqlite3_errmsg(m_db);
std::string tmp = errstr + std::string("\n\t") + errmsg;
tmp.copy(m_err_scratch, sizeof(m_err_scratch) - 1);
- m_err_scratch[sizeof(m_err_scratch) - 1] = '\0';
+ m_err_scratch[std::min(tmp.size(), sizeof(m_err_scratch) - 1)] = '\0';
return m_err_scratch;
}