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:
axel 2006-10-08 23:27:59 +10:00
parent 0e03e872be
commit 6400b60bdd
5 changed files with 21 additions and 22 deletions

View file

@ -815,7 +815,7 @@ int complete_is_valid_option( const wchar_t *str,
str[0] = opt[j];
str[1]=0;
al_push( errors,
wcsdupcat2(_( L"Unknown option: " ), L"'", str, L"'", 0) );
wcsdupcat2(_( L"Unknown option: " ), L"'", str, L"'", (void *)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)
{
al_push( errors,
wcsdupcat2( _(L"Unknown option: "), L"'", opt, L"\'", 0) );
wcsdupcat2( _(L"Unknown option: "), L"'", opt, L"\'", (void *)0) );
}
else
{
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,
COMPLETE_SEP_STR,
new_desc,
0 );
(void *)0 );
al_set( comp, i, new_el );
free( el );
@ -1300,7 +1300,7 @@ static void complete_cmd( const wchar_t *cmd,
nxt_completion = wcsdupcat2( nxt_path,
(nxt_path[wcslen(nxt_path)-1]==L'/'?L"":L"/"),
cmd,
0 );
(void *)0 );
if( ! nxt_completion )
continue;
@ -1357,7 +1357,7 @@ static void complete_cmd( const wchar_t *cmd,
wcsdupcat2( nxt_path,
(nxt_path[wcslen(nxt_path)-1]==L'/'?L"":L"/"),
cmd,
0 );
(void *)0 );
if( ! nxt_completion )
{
continue;
@ -1824,22 +1824,22 @@ static int complete_variable( const wchar_t *var,
if( wcsncmp( var, name, varlen) == 0 )
{
wchar_t *value_unescaped, *value;
wchar_t *blarg;
value_unescaped = env_get( name );
if( value_unescaped )
{
wchar_t *desc;
value = expand_escape_variable( value_unescaped );
/*
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;
al_push( comp, blarg );
al_push( comp, desc );
}
free( value );
}

View file

@ -559,8 +559,7 @@ void highlight_shell( wchar_t * buff,
{
int last_type = tok_last_type( &tok );
int prev_argc=0;
switch( last_type )
{
case TOK_STRING:
@ -624,7 +623,7 @@ void highlight_shell( wchar_t * buff,
int is_subcommand = 0;
int mark = tok_get_pos( &tok );
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_COMMAND;
if( parser_is_subcommand( cmd ) )
{
tok_next( &tok );
@ -687,7 +686,7 @@ void highlight_shell( wchar_t * buff,
else
{
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);
}
had_cmd = 1;
@ -761,7 +760,7 @@ void highlight_shell( wchar_t * buff,
{
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_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;
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 ) );
}
}
}

View file

@ -150,7 +150,7 @@ static int history_load()
&hash_wcs_cmp,
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" );
@ -384,7 +384,7 @@ static void history_save()
/* 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" );
if( out_stream )

4
kill.c
View file

@ -96,7 +96,7 @@ void kill_add( wchar_t *str )
if( (disp = env_get( L"DISPLAY" )) )
{
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 );
free( cut_buffer );
free( cmd );
@ -145,7 +145,7 @@ static void kill_check_x_buffer()
else
{
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( next_line );
}

View file

@ -712,7 +712,7 @@ wchar_t *parser_cdpath_get( void *context, wchar_t *dir )
whole_path =
wcsdupcat2( expanded_path,
( expanded_path[path_len-1] != L'/' )?L"/":L"",
dir, 0 );
dir, (void *)0 );
free(expanded_path );