From 6b68da571b22ff6cd68a145cb0470365c684c311 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 9 Mar 2023 19:08:16 +0000 Subject: Bug 706464: Avoid strcpy onto itself. It seems that the pipe opening code can copy a string on top of itself. No point in that, and it's strictly against the C rules. Avoid that case. Thanks to Youngseok Choi for the report. --- base/gdevpipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'base') diff --git a/base/gdevpipe.c b/base/gdevpipe.c index 5bdc485be..78aeeab8d 100644 --- a/base/gdevpipe.c +++ b/base/gdevpipe.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. +/* Copyright (C) 2001-2023 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -57,7 +57,7 @@ fs_file_open_pipe(const gs_memory_t *mem, void *secret, const char *fname, char return_error(gs_fopen_errno_to_code(errno)); } - if (rfname != NULL) + if (rfname != NULL && rfname != fname) strcpy(rfname, fname); return 0; -- cgit v1.2.1