Fix segfault caused by a backslash followed by a null inside single quotes

darcs-hash:20060615005931-ac50b-4c6be7129dfd2c3a5759a811b605ad32fceff758.gz
This commit is contained in:
axel
2006-06-15 10:59:31 +10:00
parent 52a0149e4f
commit a983798295
3 changed files with 18 additions and 5 deletions

View File

@@ -72,12 +72,15 @@ static int is_potential_path( const wchar_t *path )
void *context = halloc( 0, 0 );
tilde = expand_tilde( wcsdup(path) );
halloc_register( context, tilde );
unescaped = unescape( tilde, 1 );
if( unescaped )
{
// debug( 1, L"%ls -> %ls ->%ls", path, tilde, unescaped );
halloc_register( context, unescaped );
halloc_register( context, tilde );
for( in = out = unescaped; *in; in++ )
{
@@ -110,7 +113,7 @@ static int is_potential_path( const wchar_t *path )
}
*out = 0;
if( !has_magic )
if( !has_magic && wcslen( unescaped ) )
{
int must_be_dir = 0;
DIR *dir;
@@ -151,6 +154,7 @@ static int is_potential_path( const wchar_t *path )
}
}
}
halloc_free( context );