summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/metafile-print.cpp
diff options
context:
space:
mode:
authorBryce Harrington <bryce@bryceharrington.org>2015-08-29 23:30:03 +0000
committerbryce <bryce@ubuntu.com>2015-08-29 23:30:03 +0000
commit04d1dc5111b134e8618dd306149dc7a768838c77 (patch)
treec6979e33acaf4879e409b1aac757e638b67a40a9 /src/extension/internal/metafile-print.cpp
parentFix a bug on ToogleButton Parameter when call a function without showing the ... (diff)
downloadinkscape-04d1dc5111b134e8618dd306149dc7a768838c77.tar.gz
inkscape-04d1dc5111b134e8618dd306149dc7a768838c77.zip
Ensure strncpy'd strings are null terminated
(bzr r14332)
Diffstat (limited to 'src/extension/internal/metafile-print.cpp')
-rw-r--r--src/extension/internal/metafile-print.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp
index 2fb36be85..47ba5971c 100644
--- a/src/extension/internal/metafile-print.cpp
+++ b/src/extension/internal/metafile-print.cpp
@@ -285,8 +285,8 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf
return;
}
char temp[32]; // large enough
- temp[31] = '\0';
- strncpy(temp, pat_i->getAttribute("id"), 31); // Some names may be longer than [EW]MFhatch#_######
+ strncpy(temp, pat_i->getAttribute("id"), sizeof(temp)-1); // Some names may be longer than [EW]MFhatch#_######
+ temp[sizeof(temp)-1] = '\0';
hatch_classify(temp, hatchType, hatchColor, bkColor);
if (*hatchType != -1) {
return;