summaryrefslogtreecommitdiff
path: root/hwpfilter/source/hstyle.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'hwpfilter/source/hstyle.cxx')
-rw-r--r--hwpfilter/source/hstyle.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx
index cc3ef07cc987..87fd1efbe978 100644
--- a/hwpfilter/source/hstyle.cxx
+++ b/hwpfilter/source/hstyle.cxx
@@ -66,7 +66,18 @@ void HWPStyle::SetName(int n, char const *name)
if (n >= 0 && n < nstyles)
{
if (name)
- strncpy(DATA[n].name, name, MAXSTYLENAME);
+ {
+#if defined __GNUC__ && __GNUC__ == 8 && __GNUC_MINOR__ == 2 && !defined __clang__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
+ auto const p = DATA[n].name;
+ strncpy(p, name, MAXSTYLENAME);
+ p[MAXSTYLENAME] = '\0'; // just in case, even though the array is zero-initialized
+#if defined __GNUC__ && __GNUC__ == 8 && __GNUC_MINOR__ == 2 && !defined __clang__
+#pragma GCC diagnostic pop
+#endif
+ }
else
DATA[n].name[0] = 0;
}