summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2023-03-09 19:08:16 +0000
committerRobin Watts <Robin.Watts@artifex.com>2023-03-09 19:08:16 +0000
commit6b68da571b22ff6cd68a145cb0470365c684c311 (patch)
tree4d2bb67abe777fbf9510591d30dbc778a852923d /base
parent1a01eca72fbefdb2f9b0f581a1b26a59506b9248 (diff)
downloadghostpdl-6b68da571b22ff6cd68a145cb0470365c684c311.tar.gz
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.
Diffstat (limited to 'base')
-rw-r--r--base/gdevpipe.c4
1 files changed, 2 insertions, 2 deletions
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;