mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
Fix a few places where uncasted 0 was used as a null pointer in vararg functions, causing potential crashes on 64-bit platforms
darcs-hash:20061008132759-ac50b-23fe4f70a5143b8b187780403d8d21fb69c3e83f.gz
This commit is contained in:
parent
0e03e872be
commit
6400b60bdd
5 changed files with 21 additions and 22 deletions
22
complete.c
22
complete.c
|
@ -815,7 +815,7 @@ int complete_is_valid_option( const wchar_t *str,
|
||||||
str[0] = opt[j];
|
str[0] = opt[j];
|
||||||
str[1]=0;
|
str[1]=0;
|
||||||
al_push( errors,
|
al_push( errors,
|
||||||
wcsdupcat2(_( L"Unknown option: " ), L"'", str, L"'", 0) );
|
wcsdupcat2(_( L"Unknown option: " ), L"'", str, L"'", (void *)0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
opt_found = 0;
|
opt_found = 0;
|
||||||
|
@ -833,12 +833,12 @@ int complete_is_valid_option( const wchar_t *str,
|
||||||
if( hash_get_count( &gnu_match_hash )==0)
|
if( hash_get_count( &gnu_match_hash )==0)
|
||||||
{
|
{
|
||||||
al_push( errors,
|
al_push( errors,
|
||||||
wcsdupcat2( _(L"Unknown option: "), L"'", opt, L"\'", 0) );
|
wcsdupcat2( _(L"Unknown option: "), L"'", opt, L"\'", (void *)0) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
al_push( errors,
|
al_push( errors,
|
||||||
wcsdupcat2( _(L"Multiple matches for option: "), L"'", opt, L"\'", 0) );
|
wcsdupcat2( _(L"Multiple matches for option: "), L"'", opt, L"\'", (void *)0) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1214,7 +1214,7 @@ static void complete_cmd_desc( const wchar_t *cmd, array_list_t *comp )
|
||||||
wchar_t *new_el = wcsdupcat2( el,
|
wchar_t *new_el = wcsdupcat2( el,
|
||||||
COMPLETE_SEP_STR,
|
COMPLETE_SEP_STR,
|
||||||
new_desc,
|
new_desc,
|
||||||
0 );
|
(void *)0 );
|
||||||
|
|
||||||
al_set( comp, i, new_el );
|
al_set( comp, i, new_el );
|
||||||
free( el );
|
free( el );
|
||||||
|
@ -1300,7 +1300,7 @@ static void complete_cmd( const wchar_t *cmd,
|
||||||
nxt_completion = wcsdupcat2( nxt_path,
|
nxt_completion = wcsdupcat2( nxt_path,
|
||||||
(nxt_path[wcslen(nxt_path)-1]==L'/'?L"":L"/"),
|
(nxt_path[wcslen(nxt_path)-1]==L'/'?L"":L"/"),
|
||||||
cmd,
|
cmd,
|
||||||
0 );
|
(void *)0 );
|
||||||
if( ! nxt_completion )
|
if( ! nxt_completion )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1357,7 +1357,7 @@ static void complete_cmd( const wchar_t *cmd,
|
||||||
wcsdupcat2( nxt_path,
|
wcsdupcat2( nxt_path,
|
||||||
(nxt_path[wcslen(nxt_path)-1]==L'/'?L"":L"/"),
|
(nxt_path[wcslen(nxt_path)-1]==L'/'?L"":L"/"),
|
||||||
cmd,
|
cmd,
|
||||||
0 );
|
(void *)0 );
|
||||||
if( ! nxt_completion )
|
if( ! nxt_completion )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -1825,21 +1825,21 @@ static int complete_variable( const wchar_t *var,
|
||||||
{
|
{
|
||||||
wchar_t *value_unescaped, *value;
|
wchar_t *value_unescaped, *value;
|
||||||
|
|
||||||
wchar_t *blarg;
|
|
||||||
|
|
||||||
value_unescaped = env_get( name );
|
value_unescaped = env_get( name );
|
||||||
if( value_unescaped )
|
if( value_unescaped )
|
||||||
{
|
{
|
||||||
|
wchar_t *desc;
|
||||||
|
|
||||||
value = expand_escape_variable( value_unescaped );
|
value = expand_escape_variable( value_unescaped );
|
||||||
/*
|
/*
|
||||||
Variable description is 'Variable: VALUE
|
Variable description is 'Variable: VALUE
|
||||||
*/
|
*/
|
||||||
blarg = wcsdupcat2( &name[varlen], COMPLETE_SEP_STR, COMPLETE_VAR_DESC_VAL, value, 0 );
|
desc = wcsdupcat2( &name[varlen], COMPLETE_SEP_STR, COMPLETE_VAR_DESC_VAL, value, (void *)0 );
|
||||||
|
|
||||||
if( blarg )
|
if( desc )
|
||||||
{
|
{
|
||||||
res =1;
|
res =1;
|
||||||
al_push( comp, blarg );
|
al_push( comp, desc );
|
||||||
}
|
}
|
||||||
free( value );
|
free( value );
|
||||||
}
|
}
|
||||||
|
|
|
@ -560,7 +560,6 @@ void highlight_shell( wchar_t * buff,
|
||||||
int last_type = tok_last_type( &tok );
|
int last_type = tok_last_type( &tok );
|
||||||
int prev_argc=0;
|
int prev_argc=0;
|
||||||
|
|
||||||
|
|
||||||
switch( last_type )
|
switch( last_type )
|
||||||
{
|
{
|
||||||
case TOK_STRING:
|
case TOK_STRING:
|
||||||
|
@ -687,7 +686,7 @@ void highlight_shell( wchar_t * buff,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( error )
|
if( error )
|
||||||
al_push( error, wcsdupcat2 ( L"Unknown command \'", cmd, L"\'", 0 ));
|
al_push( error, wcsdupcat2 ( L"Unknown command \'", cmd, L"\'", (void *)0 ));
|
||||||
color[ tok_get_pos( &tok ) ] = (HIGHLIGHT_ERROR);
|
color[ tok_get_pos( &tok ) ] = (HIGHLIGHT_ERROR);
|
||||||
}
|
}
|
||||||
had_cmd = 1;
|
had_cmd = 1;
|
||||||
|
@ -761,7 +760,7 @@ void highlight_shell( wchar_t * buff,
|
||||||
{
|
{
|
||||||
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;
|
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;
|
||||||
if( error )
|
if( error )
|
||||||
al_push( error, wcsdupcat2( L"Directory \'", dir, L"\' does not exist", 0 ) );
|
al_push( error, wcsdupcat2( L"Directory \'", dir, L"\' does not exist", (void *)0 ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -777,7 +776,7 @@ void highlight_shell( wchar_t * buff,
|
||||||
{
|
{
|
||||||
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;
|
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;
|
||||||
if( error )
|
if( error )
|
||||||
al_push( error, wcsdupcat2( L"File \'", target, L"\' does not exist", 0 ) );
|
al_push( error, wcsdupcat2( L"File \'", target, L"\' does not exist", (void *)0 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ static int history_load()
|
||||||
&hash_wcs_cmp,
|
&hash_wcs_cmp,
|
||||||
4096 );
|
4096 );
|
||||||
|
|
||||||
fn = wcsdupcat2( env_get(L"HOME"), L"/.", mode_name, L"_history", 0 );
|
fn = wcsdupcat2( env_get(L"HOME"), L"/.", mode_name, L"_history", (void *)0 );
|
||||||
|
|
||||||
in_stream = wfopen( fn, "r" );
|
in_stream = wfopen( fn, "r" );
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ static void history_save()
|
||||||
|
|
||||||
/* Save the global history */
|
/* Save the global history */
|
||||||
{
|
{
|
||||||
fn = wcsdupcat2( env_get(L"HOME"), L"/.", mode_name, L"_history", 0 );
|
fn = wcsdupcat2( env_get(L"HOME"), L"/.", mode_name, L"_history", (void *)0 );
|
||||||
|
|
||||||
out_stream = wfopen( fn, "w" );
|
out_stream = wfopen( fn, "w" );
|
||||||
if( out_stream )
|
if( out_stream )
|
||||||
|
|
4
kill.c
4
kill.c
|
@ -96,7 +96,7 @@ void kill_add( wchar_t *str )
|
||||||
if( (disp = env_get( L"DISPLAY" )) )
|
if( (disp = env_get( L"DISPLAY" )) )
|
||||||
{
|
{
|
||||||
wchar_t *escaped_str = escape( str, 1 );
|
wchar_t *escaped_str = escape( str, 1 );
|
||||||
wchar_t *cmd = wcsdupcat2(L"echo ", escaped_str, L"|xsel -b",0);
|
wchar_t *cmd = wcsdupcat2(L"echo ", escaped_str, L"|xsel -b",(void *)0);
|
||||||
exec_subshell( cmd, 0 );
|
exec_subshell( cmd, 0 );
|
||||||
free( cut_buffer );
|
free( cut_buffer );
|
||||||
free( cmd );
|
free( cmd );
|
||||||
|
@ -145,7 +145,7 @@ static void kill_check_x_buffer()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wchar_t *old = new_cut_buffer;
|
wchar_t *old = new_cut_buffer;
|
||||||
new_cut_buffer= wcsdupcat2( new_cut_buffer, L"\\n", next_line, 0 );
|
new_cut_buffer= wcsdupcat2( new_cut_buffer, L"\\n", next_line, (void *)0 );
|
||||||
free( old );
|
free( old );
|
||||||
free( next_line );
|
free( next_line );
|
||||||
}
|
}
|
||||||
|
|
2
parser.c
2
parser.c
|
@ -712,7 +712,7 @@ wchar_t *parser_cdpath_get( void *context, wchar_t *dir )
|
||||||
whole_path =
|
whole_path =
|
||||||
wcsdupcat2( expanded_path,
|
wcsdupcat2( expanded_path,
|
||||||
( expanded_path[path_len-1] != L'/' )?L"/":L"",
|
( expanded_path[path_len-1] != L'/' )?L"/":L"",
|
||||||
dir, 0 );
|
dir, (void *)0 );
|
||||||
|
|
||||||
free(expanded_path );
|
free(expanded_path );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue