[Libreoffice-commits] online.git: common/SigUtil.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Mar 6 09:49:34 UTC 2019
common/SigUtil.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit a1feac0c24fdadb23d7428e89ebfe825c2d8280c
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Mar 6 11:42:03 2019 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Mar 6 11:48:33 2019 +0200
Fix -Werror=stringop-truncation: Make sure FatalGdbString is NUL-terminated
(Note that when I say 'NUL' I mean the ASCII character called NUL,
i.e. a zero byte. Not to be confused with 'NULL'.)
Why FatalGdbString has to be a C style fixed size char array I don't
know. Or wait, I do know. Because SPEED!!! And using C strings safely
is trivial.
Change-Id: Id28b00a6e3219cf6f015c4209732f33216f83b22
diff --git a/common/SigUtil.cpp b/common/SigUtil.cpp
index 56f29349f..d5ae63c72 100644
--- a/common/SigUtil.cpp
+++ b/common/SigUtil.cpp
@@ -259,7 +259,8 @@ namespace SigUtil
<< Poco::Process::id() << "\n";
std::string streamStr = stream.str();
assert (sizeof (FatalGdbString) > strlen(streamStr.c_str()) + 1);
- strncpy(FatalGdbString, streamStr.c_str(), sizeof(FatalGdbString));
+ strncpy(FatalGdbString, streamStr.c_str(), sizeof(FatalGdbString)-1);
+ FatalGdbString[sizeof(FatalGdbString)-1] = '\0';
}
static
More information about the Libreoffice-commits
mailing list