ntdll: Avoid buffer underflow in find_dos_device().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2dc0758b5d
commit
14994715e9
|
@ -1924,7 +1924,6 @@ static int find_dos_device( const char *path )
|
|||
{
|
||||
if ((info[drive].dev == st.st_dev) && (info[drive].ino == st.st_ino))
|
||||
{
|
||||
if (len == 1) len = 0; /* preserve root slash in returned path */
|
||||
TRACE( "%s -> drive %c:, root=%s, name=%s\n",
|
||||
debugstr_a(path), 'A' + drive, debugstr_a(buffer), debugstr_a(path + len));
|
||||
free( buffer );
|
||||
|
@ -1933,8 +1932,8 @@ static int find_dos_device( const char *path )
|
|||
}
|
||||
}
|
||||
if (len <= 1) break; /* reached root */
|
||||
while (path[len - 1] != '/') len--;
|
||||
while (path[len - 1] == '/') len--;
|
||||
while (len > 1 && path[len - 1] != '/') len--;
|
||||
while (len > 1 && path[len - 1] == '/') len--;
|
||||
buffer[len] = 0;
|
||||
}
|
||||
free( buffer );
|
||||
|
@ -1952,7 +1951,6 @@ static NTSTATUS get_mountmgr_fs_info( HANDLE handle, int fd, struct mountmgr_uni
|
|||
int letter;
|
||||
|
||||
if ((status = server_get_unix_name( handle, &unix_name ))) return status;
|
||||
|
||||
letter = find_dos_device( unix_name );
|
||||
free( unix_name );
|
||||
|
||||
|
|
Loading…
Reference in New Issue