fix a memory allocation bug in commit 1e27024d75

This commit is contained in:
Grissiom 2010-10-08 09:01:25 +08:00
parent 41ae7bccc2
commit f47caefdb9

2
env.c
View File

@ -654,7 +654,7 @@ void env_init()
{
wchar_t *nshlvl, **end_nshlvl;
/* add an extra space for digit dump (9+1=10) */
size_t i = wcslen( shlvl ) + 2;
size_t i = wcslen( shlvl ) + 2 * sizeof(wchar_t);
nshlvl = malloc(i);
end_nshlvl = calloc( 1, sizeof(nshlvl) );
if ( nshlvl && swprintf( nshlvl, i,