summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2023-03-23 17:05:03 +0000
committerRobin Watts <Robin.Watts@artifex.com>2023-03-23 20:29:08 +0000
commitafec45259049d3940abb0134c67abf8869123b74 (patch)
treed5d8ad6fc9a6866e2fa819f674ec2eeab19ef967 /xps
parent7813261a42912317a6da6a94b0a39749dad3d1a3 (diff)
downloadghostpdl-afec45259049d3940abb0134c67abf8869123b74.tar.gz
Guard against buffer overflow in xps_clean_path.
Ghostscript reapplication of the fix for bug 706497. Thanks to Chamal Desilva for the report!
Diffstat (limited to 'xps')
-rw-r--r--xps/xpsmem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xps/xpsmem.c b/xps/xpsmem.c
index e9fb9c8f3..82881e089 100644
--- a/xps/xpsmem.c
+++ b/xps/xpsmem.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
@@ -107,7 +107,8 @@ xps_clean_path(char *name)
}
}
- if (q == name) /* empty string is really "." */
+ /* Guard against the 'blah:' case, where name == terminator. */
+ if (q == name && *q != 0) /* empty string is really "." */
*q++ = '.';
*q = '\0';