From 99cc9af68c770cd551025249b760630b2a9e9fb0 Mon Sep 17 00:00:00 2001 From: Chris Liddell Date: Wed, 16 Feb 2022 15:01:26 +0000 Subject: Move xps/ sources away from gs_sprintf to gs_snprintf --- xps/xpsttf.c | 4 ++-- xps/xpszip.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'xps') diff --git a/xps/xpsttf.c b/xps/xpsttf.c index 22ddf5251..527170d5a 100644 --- a/xps/xpsttf.c +++ b/xps/xpsttf.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 @@ -190,7 +190,7 @@ xps_true_callback_glyph_name(gs_font *pfont, gs_glyph glyph, gs_const_string *ps { /* Invent a name if we don't know the table format. */ char buf[32]; - gs_sprintf(buf, "glyph%d", (int)glyph); + gs_snprintf(buf, sizeof(buf), "glyph%d", (int)glyph); /* Ugly hackery. see comment below, after 'not mac' this ends up as a memory leak. * The PostScript interpreter adds the strings it creates to the PostScript name table diff --git a/xps/xpszip.c b/xps/xpszip.c index 1ccabf8c0..6a0762a27 100644 --- a/xps/xpszip.c +++ b/xps/xpszip.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 @@ -371,11 +371,11 @@ xps_read_zip_part(xps_context_t *ctx, const char *partname) size = 0; while (!seen_last) { - gs_sprintf(buf, "%s/[%d].piece", name, count); + gs_snprintf(buf, sizeof(buf), "%s/[%d].piece", name, count); ent = xps_find_zip_entry(ctx, buf); if (!ent) { - gs_sprintf(buf, "%s/[%d].last.piece", name, count); + gs_snprintf(buf, sizeof(buf), "%s/[%d].last.piece", name, count); ent = xps_find_zip_entry(ctx, buf); seen_last = !!ent; } @@ -398,9 +398,9 @@ xps_read_zip_part(xps_context_t *ctx, const char *partname) for (i = 0; i < count; i++) { if (i < count - 1) - gs_sprintf(buf, "%s/[%d].piece", name, i); + gs_snprintf(buf, sizeof(buf), "%s/[%d].piece", name, i); else - gs_sprintf(buf, "%s/[%d].last.piece", name, i); + gs_snprintf(buf, sizeof(buf), "%s/[%d].last.piece", name, i); ent = xps_find_zip_entry(ctx, buf); if (!ent) gs_warn("missing piece"); @@ -471,11 +471,11 @@ xps_read_dir_part(xps_context_t *ctx, const char *name) size = 0; while (1) { - gs_sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, count); + gs_snprintf(buf, sizeof(buf), "%s%s/[%d].piece", ctx->directory, name, count); file = gp_fopen(ctx->memory, buf, "rb"); if (!file) { - gs_sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, count); + gs_snprintf(buf, sizeof(buf), "%s%s/[%d].last.piece", ctx->directory, name, count); file = gp_fopen(ctx->memory, buf, "rb"); } if (!file) @@ -495,9 +495,9 @@ xps_read_dir_part(xps_context_t *ctx, const char *name) for (i = 0; i < count; i++) { if (i < count - 1) - gs_sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, i); + gs_snprintf(buf, sizeof(buf), "%s%s/[%d].piece", ctx->directory, name, i); else - gs_sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, i); + gs_snprintf(buf, sizeof(buf), "%s%s/[%d].last.piece", ctx->directory, name, i); file = gp_fopen(ctx->memory, buf, "rb"); n = xps_fread(part->data + offset, 1, size - offset, file); offset += n; -- cgit v1.2.1