diff options
author | 2006-06-21 10:48:36 +1000 | |
---|---|---|
committer | 2006-06-21 10:48:36 +1000 | |
commit | b016438c08877cb3b24808d260397a8aa8fe49ce (patch) | |
tree | 7d8879449234a75e28b4295725a3df411dcbb3aa /expand.c | |
parent | 7268a4a4e0ddb8ed10df20005cd78c90e900802f (diff) |
Update input validation. Always use the magic CHECK macro, which prints an error message including instructions on how to report this problem.
darcs-hash:20060621004836-ac50b-a47f296634eda0c469eb39034603015b1ad7ab5c.gz
Diffstat (limited to 'expand.c')
-rw-r--r-- | expand.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -101,6 +101,8 @@ int expand_is_clean( const wchar_t *in ) const wchar_t * str = in; + CHECK( in, 1 ); + /* Test characters that have a special meaning in the first character position */ @@ -161,6 +163,8 @@ wchar_t *expand_escape_variable( const wchar_t *in ) array_list_t l; string_buffer_t buff; + CHECK( in, 0 ); + al_init( &l ); tokenize_variable_array( in, &l ); sb_init( &buff ); @@ -1316,6 +1320,8 @@ static wchar_t * expand_tilde_internal( wchar_t *in ) wchar_t *expand_tilde( wchar_t *in) { + CHECK( in, 0 ); + if( in[0] == L'~' ) { in[0] = HOME_DIRECTORY; @@ -1374,6 +1380,9 @@ int expand_string( void *context, int res = EXPAND_OK; int start_count = al_get_count( end_out ); + CHECK( str, EXPAND_ERROR ); + CHECK( end_out, EXPAND_ERROR ); + if( (!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean( str ) ) { halloc_register( context, str ); @@ -1619,6 +1628,8 @@ wchar_t *expand_one( void *context, wchar_t *string, int flags ) array_list_t l; int res; wchar_t *one; + + CHECK( string, 0 ); if( (!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean( string ) ) { |