gbranden pushed a commit to branch master
in repository groff.

commit fc98eb14860c5ff3523049515b2654200b809ac1
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
AuthorDate: Thu Jun 12 16:52:32 2025 -0500

    [gropdf]: Use stricter MS-DOS/Win filespec check.
    
    * src/devices/gropdf/gropdf.pl (OpenFontFile, OpenIncludedFile): Make
      check for MS-DOS/Windows-style absolute filespec stricter; not only
      must the second character be ':', but the first must now be an
      uppercase Basic Latin letter.
---
 ChangeLog                    |  9 +++++++++
 src/devices/gropdf/gropdf.pl | 10 +++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 56d482699..41f5fe309 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-07-04  G. Branden Robinson <g.branden.robin...@gmail.com>
+
+       [gropdf]: Use stricter MS-DOS/Windows filespec check.
+
+       * src/devices/gropdf/gropdf.pl (OpenFontFile)
+       (OpenIncludedFile): Make check for MS-DOS/Windows-style absolute
+       filespec stricter; not only must the second character be ':',
+       but the first must now be an uppercase Basic Latin letter.
+
 2025-07-04  G. Branden Robinson <g.branden.robin...@gmail.com>
 
        * src/devices/gropdf/gropdf.pl: Refactor.
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 74c49c085..60431d647 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -1238,8 +1238,9 @@ sub OpenFontFile
     # Is the file specification absolute?
     #
     # XXX: Forbid this?  See Savannah #66419.
-    if ((substr($fileName,0,1) eq '/')
-       or (substr($fileName,1,1) eq ':')) # dos
+    if (substr($fileName,0,1) eq '/' # POSIX
+       or (substr($fileName,0,1) =~ m/[A-Z]/
+           and substr($fileName,1,1) eq ':')) # MS-DOS/Windows
     {
        $resolvedFileName=$fileName
            if (-r "$fileName" and open($$f,"<$fileName"));
@@ -2463,7 +2464,10 @@ sub OpenIncludedFile
     my $fileName=undef;
     my $F;
 
-    if (substr($arg,0,1) eq '/' or substr($arg,1,1) eq ':') # dos
+    # Is the file specification absolute?
+    if (substr($arg,0,1) eq '/' # POSIX
+       or (substr($arg,0,1) =~ m/[A-Z]/
+           and substr($arg,1,1) eq ':')) # MS-DOS/Windows
     {
        if (-r $arg and open($F,"<$arg"))
        {


_______________________________________________
groff-commit mailing list
groff-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to