fix buffer overflow
This commit is contained in:
parent
bb71204a11
commit
fcb59e5c74
@ -471,7 +471,7 @@ init_tout(PL_chars_t *t, size_t len)
|
|||||||
{ t->text.t = t->buf;
|
{ t->text.t = t->buf;
|
||||||
t->storage = PL_CHARS_LOCAL;
|
t->storage = PL_CHARS_LOCAL;
|
||||||
} else
|
} else
|
||||||
{ t->text.t = PL_malloc(len);
|
{ t->text.t = PL_malloc(len+1);
|
||||||
t->storage = PL_CHARS_MALLOC;
|
t->storage = PL_CHARS_MALLOC;
|
||||||
}
|
}
|
||||||
succeed;
|
succeed;
|
||||||
@ -480,7 +480,7 @@ init_tout(PL_chars_t *t, size_t len)
|
|||||||
{ t->text.w = (pl_wchar_t*)t->buf;
|
{ t->text.w = (pl_wchar_t*)t->buf;
|
||||||
t->storage = PL_CHARS_LOCAL;
|
t->storage = PL_CHARS_LOCAL;
|
||||||
} else
|
} else
|
||||||
{ t->text.w = PL_malloc(len*sizeof(pl_wchar_t));
|
{ t->text.w = PL_malloc((len+1)*sizeof(pl_wchar_t));
|
||||||
t->storage = PL_CHARS_MALLOC;
|
t->storage = PL_CHARS_MALLOC;
|
||||||
}
|
}
|
||||||
succeed;
|
succeed;
|
||||||
|
Reference in New Issue
Block a user