diff options
author | axel <axel@liljencrantz.se> | 2006-06-21 10:48:36 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-06-21 10:48:36 +1000 |
commit | b016438c08877cb3b24808d260397a8aa8fe49ce (patch) | |
tree | 7d8879449234a75e28b4295725a3df411dcbb3aa /parse_util.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 'parse_util.c')
-rw-r--r-- | parse_util.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/parse_util.c b/parse_util.c index ce02d835..2209c3a6 100644 --- a/parse_util.c +++ b/parse_util.c @@ -52,7 +52,10 @@ int parse_util_lineno( const wchar_t *str, int len ) static wchar_t *prev_str2 = 0; static int i2 = 0; static int res2 = 1; + + CHECK( str, 0 ); + if( str != prev_str || i>len ) { if( prev_str2 == str && i2 <= len ) @@ -100,6 +103,8 @@ int parse_util_locate_cmdsubst( const wchar_t *in, wchar_t *paran_begin=0, *paran_end=0; + CHECK( in, 0 ); + for( pos = (wchar_t *)in; *pos; pos++ ) { if( prev != '\\' ) @@ -176,14 +181,13 @@ void parse_util_cmdsubst_extent( const wchar_t *buff, wchar_t *begin, *end; wchar_t *pos; + CHECK( buff, ); + if( a ) *a=0; if( b ) *b = 0; - if( !buff ) - return; - pos = (wchar_t *)buff; while( 1 ) @@ -243,6 +247,8 @@ static void job_or_process_extent( const wchar_t *buff, tokenizer tok; + CHECK( buff, ); + if( a ) *a=0; if( b ) @@ -342,6 +348,8 @@ void parse_util_token_extent( const wchar_t *buff, wchar_t *a, *b, *pa, *pb; + CHECK( buff, ); + assert( cursor_pos >= 0 ); |