diff options
Diffstat (limited to 'devices/vector/gdevpdfe.c')
-rw-r--r-- | devices/vector/gdevpdfe.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/devices/vector/gdevpdfe.c b/devices/vector/gdevpdfe.c index e083ee11..ec011d8b 100644 --- a/devices/vector/gdevpdfe.c +++ b/devices/vector/gdevpdfe.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. +/* Copyright (C) 2001-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -209,7 +209,7 @@ pdf_xmp_time(char *buf, int buf_length) time(&t); tms = *localtime(&t); #endif - gs_sprintf(buf1, + gs_snprintf(buf1, sizeof(buf1), "%04d-%02d-%02d", tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday); strncpy(buf, buf1, buf_length); @@ -489,8 +489,11 @@ pdf_xmp_write_translated(gx_device_pdf *pdev, stream *s, const byte *data, int d /* Skip the Byte Order Mark (0xfe 0xff) */ buf0b = (short *)(buf0 + 2); code = gs_ConvertUTF16((unsigned char *)buf0b, j - 2, (unsigned char **)&buf1b, data_length * 2 * sizeof(unsigned char)); - if (code < 0) + if (code < 0) { + gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated"); + gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated"); return code; + } write(s, (const byte *)buf1, buf1b - buf1); gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated"); } @@ -881,7 +884,7 @@ pdf_document_metadata(gx_device_pdf *pdev) code = COS_WRITE_OBJECT(pres->object, pdev, resourceNone); if (code < 0) return code; - gs_sprintf(buf, "%ld 0 R", pres->object->id); + gs_snprintf(buf, sizeof(buf), "%ld 0 R", pres->object->id); pdf_record_usage(pdev, pres->object->id, resource_usage_part9_structure); code = cos_dict_put_c_key_object(pdev->Catalog, "/Metadata", pres->object); |