]> mj.ucw.cz Git - pciutils.git/commit
libpci: windows: Fix usage of GetModuleFileName()
authorPali Rohár <pali@kernel.org>
Fri, 18 Nov 2022 20:47:04 +0000 (21:47 +0100)
committerPali Rohár <pali@kernel.org>
Fri, 18 Nov 2022 20:47:04 +0000 (21:47 +0100)
commit0382965825caa27deaac3ab6a25145c896b9053b
treee7eb354c31a350fdb9cf15e75c7441dd0ff5856f
parente2d9340ba416ef0856fb8198e16ffd255225952c
libpci: windows: Fix usage of GetModuleFileName()

Module file name can have arbitrary length despite all MS examples say
about MAX_PATH upper limit. This limit does not apply for example when
executable is running from network disk with very long UNC paths or
when using "\\??\\" prefix for specifying executable binary path.

So handle buffer truncatenation by retrying GetModuleFileName() call with
larger buffer.

Fixes loading of pci.ids file when lspci.exe binary is running from network
drive with path longer than 260 bytes.
lib/init.c