summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_physio.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2020-01-26 21:24:58 +0000
committerschwarze <schwarze@openbsd.org>2020-01-26 21:24:58 +0000
commit4f2bc1d17e5767d0f48188324382434a9ae418e6 (patch)
tree78d3b616982657e72ab05a1a0e885a481cce6fd7 /sys/kern/kern_physio.c
parentSupport for queries on ports != 53 (diff)
downloadwireguard-openbsd-4f2bc1d17e5767d0f48188324382434a9ae418e6.tar.xz
wireguard-openbsd-4f2bc1d17e5767d0f48188324382434a9ae418e6.zip
Repair more of the issues that i found in filescan() while investigating
the report from <Andreas dot Kahari at abc dot se> on ports@: For a symlink, use the first of the following names that is available: 1. In -t mode, the symlink itself (unchanged). 2. When the (unresolved) symlink already resides inside the manpath, just strip the manpath and use the rest (unchanged). 3. When prefix(es) of the unresolved symlink point to the manpath, strip the longest such prefix and use the rest (new); this fixes situations where the manpath or one of its parent directories is a symlink and at the same time contains symlinks to manual pages. 4. Fall back to the fully resolved symlink, with the manpath stripped (new); this may for example happen when the command line passes symlinks from outside the manpath that point to manual pages inside the manpath, or if manual page trees contain symlinks to symlinks and not all of them are given on the command line. The fallback (4) isn't perfect. You can construct symlink spaghetti in such a way that this algorithm will not enter all manual page names into the database that a human would be able to deduce. But i do not expect such spaghetti to actually occur in practice (not even in ports), and a full fix would require re-implementing realpath(3) in terms of step-by-step readlink(2) calls, repeating the complicated algorithm (3) after each step. While here, also stop using PATH_MAX as the size of a static buffer in filescan(); on some systems, it can be unreasonably large. Instead, allocate path strings dynamically.
Diffstat (limited to 'sys/kern/kern_physio.c')
0 files changed, 0 insertions, 0 deletions