mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 20:31:19 -03:00
Add some input validation code to various functions
darcs-hash:20060222154152-ac50b-608032284165f099beecd1cd4f7c6bb2b45df432.gz
This commit is contained in:
12
common.c
12
common.c
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user