]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/bfdio.c
Fix a potential problem in the BFD library when accessing the Windows' nul device...
[thirdparty/binutils-gdb.git] / bfd / bfdio.c
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);