[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - common/SigUtil.cpp
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 30 18:52:09 UTC 2019
common/SigUtil.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit eb7cd2bf7731f97372ebc55c36e57bb51ce4f5ed
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Mar 6 11:42:03 2019 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Oct 30 19:51:52 2019 +0100
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
Reviewed-on: https://gerrit.libreoffice.org/81797
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/common/SigUtil.cpp b/common/SigUtil.cpp
index 77ed8e296..50d4ecc71 100644
--- a/common/SigUtil.cpp
+++ b/common/SigUtil.cpp
@@ -253,7 +253,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