]> sourceware.org Git - newlib-cygwin.git/commit
Cygwin: normalize_win32_path: Avoid buffer underruns
authorCorinna Vinschen <corinna@vinschen.de>
Tue, 29 May 2018 16:11:42 +0000 (18:11 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 29 May 2018 16:23:14 +0000 (18:23 +0200)
commit35998fc2fa6cbb7d761f6d88346246bd3627552b
treed442b0ffd7abe9f1325b03facc13543586f4c904
parent7d00a5e320db60b462be5b330fc1358f706add76
Cygwin: normalize_win32_path: Avoid buffer underruns

Thanks to Ken Harris <Ken.Harris@mathworks.com> for the diagnosis.

When backing up tail to handle a "..", the code only checked that
it didn't underrun the destination buffer while removing path
components.  It did *not* take into account that the first backslash
in the path had to be kept intact.  Example path to trigger the
problem: "C:\A..\..\..\B'

Fix this by moving the dst pointer to the first backslash so subsequent
tests cannot underrun this position.  Also make sure that we always
*have* a backslash.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/path.cc
This page took 0.029907 seconds and 5 git commands to generate.