]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix a potential problem in the BFD library when accessing the Windows' nul device...
authorHimal <himalr@proton.me>
Tue, 3 Jan 2023 12:07:16 +0000 (12:07 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 3 Jan 2023 12:07:16 +0000 (12:07 +0000)
PR 29947
* bfdio.c (_bfd_real_fopen): Do not add a prefix to the Windows'
nul device filename.

bfd/ChangeLog
bfd/bfdio.c

index a7d9845247ab8a75423e788c6ffbfb24c625b47c..91a73aca5e803a1cec48e71e6098a7810233c109 100644 (file)
@@ -1,3 +1,9 @@
+2023-01-03  Himal  <himalr@proton.me>
+
+       PR 29947
+       * bfdio.c (_bfd_real_fopen): Do not add a prefix to the Windows'
+       nul device filename.
+
 2023-01-03  Nick Clifton  <nickc@redhat.com>
 
        * po/fr.po: Updated French trabslation.
index e9fa5bb012c981e46a6e6f998aa0312929180d96..337d4a10b66aa121e459a342f1967ce1ffaf6700 100644 (file)
@@ -154,6 +154,11 @@ _bfd_real_fopen (const char *filename, const char *modes)
    wcscpy (fullPath, prefix);
 
    int        prefixLen = sizeof(prefix) / sizeof(wchar_t);
+
+   /* Do not add a prefix to the null device.  */
+   if (stricmp (filename, "nul") == 0)
+    prefixLen = 1;
+
    wchar_t *  fullPathOffset = fullPath + prefixLen - 1;
 
    GetFullPathNameW (partPath, fullPathWSize, fullPathOffset, lpFilePart);