diff options
author | Alex Cherepanov <alex.cherepanov@artifex.com> | 2010-12-27 23:34:39 +0000 |
---|---|---|
committer | Alex Cherepanov <alex.cherepanov@artifex.com> | 2010-12-27 23:34:39 +0000 |
commit | 23c28853a7b420854a409d647d72411bcf5b634d (patch) | |
tree | c9dfc5afa56da3a3f0810c76551fb17c524c9811 /gs/base/gdevpdfu.c | |
parent | 10624ae77a2e3082fcbdcddf5ba21af3a077714a (diff) | |
download | ghostpdl-23c28853a7b420854a409d647d72411bcf5b634d.tar.gz |
Fix unterminated string used by "%%CreationDate:" comment in ps2write
device. Partial fix for 691853.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@11979 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/base/gdevpdfu.c')
-rw-r--r-- | gs/base/gdevpdfu.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gs/base/gdevpdfu.c b/gs/base/gdevpdfu.c index e4df015d9..33373f262 100644 --- a/gs/base/gdevpdfu.c +++ b/gs/base/gdevpdfu.c @@ -374,8 +374,8 @@ int ps2write_dsc_header(gx_device_pdf * pdev, int pages) stream *s = pdev->strm; if (pdev->ForOPDFRead && pdev->OPDFReadProcsetPath.size) { - char cre_date_time[40]; - int code, status; + char cre_date_time[41]; + int code, status, cre_date_time_len; char BBox[256]; int width = (int)(pdev->width * 72.0 / pdev->HWResolution[0] + 0.5); int height = (int)(pdev->height * 72.0 / pdev->HWResolution[1] + 0.5); @@ -383,8 +383,9 @@ int ps2write_dsc_header(gx_device_pdf * pdev, int pages) stream_write(s, (byte *)"%!PS-Adobe-3.0\n", 15); sprintf(BBox, "%%%%BoundingBox: 0 0 %d %d\n", width, height); stream_write(s, (byte *)BBox, strlen(BBox)); - pdf_get_docinfo_item(pdev, "/CreationDate", cre_date_time, sizeof(cre_date_time)); - sprintf(BBox, "%%%%Creator: %s %d (%s)\n", gs_product, (int)gs_revision, + cre_date_time_len = pdf_get_docinfo_item(pdev, "/CreationDate", cre_date_time, sizeof(cre_date_time) - 1); + cre_date_time[cre_date_time_len] = 0; + sprintf(BBox, "%%%%Creator: %s %d (%s)\n", gs_product, (int)gs_revision, pdev->dname); stream_write(s, (byte *)BBox, strlen(BBox)); stream_puts(s, "%%LanguageLevel: 2\n"); |