diff options
author | Himal <himalr@proton.me> | 2023-01-03 12:07:16 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2023-01-03 12:07:16 +0000 |
commit | a8cf07d37b0063df888da82aed00babd1907ab7e (patch) | |
tree | 00d804c1399144bfd2c9d9d622f1ee74a0e19f5a /bfd/bfdio.c | |
parent | e8b4b7b258d7bd926de2d8758c2a55e28ba46c48 (diff) | |
download | gdb-a8cf07d37b0063df888da82aed00babd1907ab7e.zip gdb-a8cf07d37b0063df888da82aed00babd1907ab7e.tar.gz gdb-a8cf07d37b0063df888da82aed00babd1907ab7e.tar.bz2 |
Fix a potential problem in the BFD library when accessing the Windows' nul device driver.
PR 29947
* bfdio.c (_bfd_real_fopen): Do not add a prefix to the Windows'
nul device filename.
Diffstat (limited to 'bfd/bfdio.c')
-rw-r--r-- | bfd/bfdio.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bfd/bfdio.c b/bfd/bfdio.c index e9fa5bb..337d4a1 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -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); |