mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-29 21:43:55 +08:00
Even more input validation
darcs-hash:20060621100746-ac50b-8aa5648c05a656829a895669be27c6fa4f1d8458.gz
This commit is contained in:
parent
bf333f2a84
commit
407c96e943
11
common.c
11
common.c
|
@ -208,7 +208,12 @@ wchar_t *str2wcs_internal( const char *in, wchar_t *out )
|
||||||
int in_pos=0;
|
int in_pos=0;
|
||||||
int out_pos = 0;
|
int out_pos = 0;
|
||||||
mbstate_t state;
|
mbstate_t state;
|
||||||
size_t len = strlen(in);
|
size_t len;
|
||||||
|
|
||||||
|
CHECK( in, 0 );
|
||||||
|
CHECK( out, 0 );
|
||||||
|
|
||||||
|
len = strlen(in);
|
||||||
|
|
||||||
memset( &state, 0, sizeof(state) );
|
memset( &state, 0, sizeof(state) );
|
||||||
|
|
||||||
|
@ -265,6 +270,10 @@ char *wcs2str_internal( const wchar_t *in, char *out )
|
||||||
int in_pos=0;
|
int in_pos=0;
|
||||||
int out_pos = 0;
|
int out_pos = 0;
|
||||||
mbstate_t state;
|
mbstate_t state;
|
||||||
|
|
||||||
|
CHECK( in, 0 );
|
||||||
|
CHECK( out, 0 );
|
||||||
|
|
||||||
memset( &state, 0, sizeof(state) );
|
memset( &state, 0, sizeof(state) );
|
||||||
|
|
||||||
while( in[in_pos] )
|
while( in[in_pos] )
|
||||||
|
|
2
env.c
2
env.c
|
@ -1206,6 +1206,8 @@ void env_get_names( array_list_t *l, int flags )
|
||||||
hash_table_t names;
|
hash_table_t names;
|
||||||
env_node_t *n=top;
|
env_node_t *n=top;
|
||||||
|
|
||||||
|
CHECK( l, );
|
||||||
|
|
||||||
get_names_show_exported =
|
get_names_show_exported =
|
||||||
flags & ENV_EXPORT|| (!(flags & ENV_UNEXPORT));
|
flags & ENV_EXPORT|| (!(flags & ENV_UNEXPORT));
|
||||||
get_names_show_unexported =
|
get_names_show_unexported =
|
||||||
|
|
|
@ -306,8 +306,7 @@ wchar_t *env_universal_get( const wchar_t *name )
|
||||||
if( !init)
|
if( !init)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( !name )
|
CHECK( name, 0 );
|
||||||
return 0;
|
|
||||||
|
|
||||||
debug( 3, L"env_universal_get( \"%ls\" )", name );
|
debug( 3, L"env_universal_get( \"%ls\" )", name );
|
||||||
return env_universal_common_get( name );
|
return env_universal_common_get( name );
|
||||||
|
@ -315,6 +314,11 @@ wchar_t *env_universal_get( const wchar_t *name )
|
||||||
|
|
||||||
int env_universal_get_export( const wchar_t *name )
|
int env_universal_get_export( const wchar_t *name )
|
||||||
{
|
{
|
||||||
|
if( !init)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CHECK( name, 0 );
|
||||||
|
|
||||||
debug( 3, L"env_universal_get_export()" );
|
debug( 3, L"env_universal_get_export()" );
|
||||||
return env_universal_common_get_export( name );
|
return env_universal_common_get_export( name );
|
||||||
}
|
}
|
||||||
|
@ -388,6 +392,8 @@ void env_universal_set( const wchar_t *name, const wchar_t *value, int export )
|
||||||
if( !init )
|
if( !init )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CHECK( name, );
|
||||||
|
|
||||||
debug( 3, L"env_universal_set( \"%ls\", \"%ls\" )", name, value );
|
debug( 3, L"env_universal_set( \"%ls\", \"%ls\" )", name, value );
|
||||||
|
|
||||||
msg = create_message( export?SET_EXPORT:SET,
|
msg = create_message( export?SET_EXPORT:SET,
|
||||||
|
@ -413,6 +419,8 @@ int env_universal_remove( const wchar_t *name )
|
||||||
if( !init )
|
if( !init )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
CHECK( name, 1 );
|
||||||
|
|
||||||
res = !env_universal_common_get( name );
|
res = !env_universal_common_get( name );
|
||||||
|
|
||||||
debug( 3,
|
debug( 3,
|
||||||
|
@ -431,6 +439,9 @@ void env_universal_get_names( array_list_t *l,
|
||||||
int show_exported,
|
int show_exported,
|
||||||
int show_unexported )
|
int show_unexported )
|
||||||
{
|
{
|
||||||
|
if( !init )
|
||||||
|
return;
|
||||||
|
|
||||||
env_universal_common_get_names( l,
|
env_universal_common_get_names( l,
|
||||||
show_exported,
|
show_exported,
|
||||||
show_unexported );
|
show_unexported );
|
||||||
|
|
11
event.c
11
event.c
|
@ -196,6 +196,9 @@ static int event_is_blocked( event_t *e )
|
||||||
|
|
||||||
const wchar_t *event_get_desc( event_t *e )
|
const wchar_t *event_get_desc( event_t *e )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CHECK( e, 0 );
|
||||||
|
|
||||||
if( !get_desc_buff )
|
if( !get_desc_buff )
|
||||||
{
|
{
|
||||||
get_desc_buff=sb_halloc( global_context );
|
get_desc_buff=sb_halloc( global_context );
|
||||||
|
@ -253,6 +256,8 @@ void event_add_handler( event_t *event )
|
||||||
{
|
{
|
||||||
event_t *e;
|
event_t *e;
|
||||||
|
|
||||||
|
CHECK( event, );
|
||||||
|
|
||||||
e = event_copy( event, 0 );
|
e = event_copy( event, 0 );
|
||||||
|
|
||||||
if( !events )
|
if( !events )
|
||||||
|
@ -272,6 +277,8 @@ void event_remove( event_t *criterion )
|
||||||
array_list_t *new_list=0;
|
array_list_t *new_list=0;
|
||||||
event_t e;
|
event_t e;
|
||||||
|
|
||||||
|
CHECK( criterion, );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Because of concurrency issues (env_remove could remove an event
|
Because of concurrency issues (env_remove could remove an event
|
||||||
that is currently being executed), env_remove does not actually
|
that is currently being executed), env_remove does not actually
|
||||||
|
@ -331,6 +338,8 @@ int event_get( event_t *criterion, array_list_t *out )
|
||||||
if( !events )
|
if( !events )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
CHECK( criterion, 0 );
|
||||||
|
|
||||||
for( i=0; i<al_get_count( events); i++ )
|
for( i=0; i<al_get_count( events); i++ )
|
||||||
{
|
{
|
||||||
event_t *n = (event_t *)al_get( events, i );
|
event_t *n = (event_t *)al_get( events, i );
|
||||||
|
@ -644,6 +653,8 @@ void event_destroy()
|
||||||
|
|
||||||
void event_free( event_t *e )
|
void event_free( event_t *e )
|
||||||
{
|
{
|
||||||
|
CHECK( e, );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
When apropriate, we clear the argument vector
|
When apropriate, we clear the argument vector
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user