Add some input validation code to various functions

darcs-hash:20060222154152-ac50b-608032284165f099beecd1cd4f7c6bb2b45df432.gz
This commit is contained in:
axel
2006-02-23 01:41:52 +10:00
parent 3afead1827
commit ca04fc745d
11 changed files with 225 additions and 84 deletions

View File

@@ -212,8 +212,13 @@ wchar_t *str2wcs( const char *in )
size_t len = strlen(in);
out = malloc( sizeof(wchar_t)*(len+1) );
if( !out )
{
die_mem();
}
return str2wcs_internal( in, out );
}
wchar_t *str2wcs_internal( const char *in, wchar_t *out )
@@ -226,11 +231,6 @@ wchar_t *str2wcs_internal( const char *in, wchar_t *out )
memset( &state, 0, sizeof(state) );
if( !out )
{
die_mem();
}
while( in[in_pos] )
{
res = mbrtowc( &out[out_pos], &in[in_pos], len-in_pos, &state );