summaryrefslogtreecommitdiffstats
path: root/src/libuemf
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/libuemf
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/libuemf')
-rw-r--r--src/libuemf/uemf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libuemf/uemf.c b/src/libuemf/uemf.c
index 3180c757c..afa116e75 100644
--- a/src/libuemf/uemf.c
+++ b/src/libuemf/uemf.c
@@ -1858,8 +1858,8 @@ U_LOGCOLORSPACEA logcolorspacea_set(
lcsa.lcsIntent = lcsIntent;
lcsa.lcsEndpoints = lcsEndpoints;
lcsa.lcsGammaRGB = lcsGammaRGB;
- memset(lcsa.lcsFilename,0,U_MAX_PATH); // zero out the Filename field
strncpy(lcsa.lcsFilename,lcsFilename,U_MAX_PATH);
+ lcsa.lcsFilename[U_MAX_PATH-1] = '\0';
return(lcsa);
}
@@ -1889,6 +1889,7 @@ U_LOGCOLORSPACEW logcolorspacew_set(
lcsa.lcsEndpoints = lcsEndpoints;
lcsa.lcsGammaRGB = lcsGammaRGB;
wchar16strncpypad(lcsa.lcsFilename,lcsFilename,U_MAX_PATH);
+ lcsa.lcsFilename[U_MAX_PATH-1] = '\0';
return(lcsa);
}
@@ -1983,6 +1984,7 @@ U_LOGFONT logfont_set(
lf.lfQuality = lfQuality;
lf.lfPitchAndFamily = lfPitchAndFamily;
wchar16strncpypad(lf.lfFaceName, lfFaceName, U_LF_FACESIZE); // pad this one as the intial structure was not set to zero
+ lf.lfFaceName[U_LF_FACESIZE-1] = '\0';
return(lf);
}
@@ -2006,7 +2008,9 @@ U_LOGFONT_PANOSE logfont_panose_set(
U_LOGFONT_PANOSE lfp;
memset(&lfp,0,sizeof(U_LOGFONT_PANOSE)); // all fields zero unless needed. Many should be ignored or must be 0.
wchar16strncpy(lfp.elfFullName, elfFullName, U_LF_FULLFACESIZE);
+ lfp.elfFullName[U_LF_FULLFACESIZE-1] = '\0';
wchar16strncpy(lfp.elfStyle, elfStyle, U_LF_FACESIZE);
+ lfp.elfStyle[U_LF_FACESIZE-1] = '\0';
lfp.elfLogFont = elfLogFont;
lfp.elfStyleSize = elfStyleSize;
lfp.elfPanose = elfPanose;