summaryrefslogtreecommitdiffstats
path: root/src/extension
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
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')
-rw-r--r--src/extension/internal/metafile-print.cpp4
-rw-r--r--src/extension/internal/pdfinput/svg-builder.cpp1
2 files changed, 3 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;
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index 58e2030d9..a448be639 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -498,6 +498,7 @@ void SvgBuilder::addShadedFill(GfxShading *shading, double *matrix, GfxPath *pat
// Obtain clipping path's id from the URL
gchar clip_path_id[32];
strncpy(clip_path_id, clip_path_url + 5, strlen(clip_path_url) - 6);
+ clip_path_id[sizeof (clip_path_id) - 1] = '\0';
SPObject *clip_obj = _doc->getObjectById(clip_path_id);
if (clip_obj) {
clip_obj->deleteObject();