*fixed a memory overflow bug with the ASC statement.

This commit is contained in:
paladin-t 2016-03-08 16:30:44 +08:00
parent c94ffc7da9
commit 5f440b66b8
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,6 @@
Mar. 8 2016
Fixed a memory overflow bug with the ASC statement
Mar. 4 2016
Fixed a memory leak with sub routine parameter
Improved inputer

View File

@ -14654,6 +14654,7 @@ static int _std_asc(mb_interpreter_t* s, void** l) {
int result = MB_FUNC_OK;
char* arg = 0;
int_t val = 0;
size_t sz = 0;
mb_assert(s && l);
@ -14668,7 +14669,9 @@ static int _std_asc(mb_interpreter_t* s, void** l) {
goto _exit;
}
memcpy(&val, arg, strlen(arg));
sz = strlen(arg);
if(sizeof(int_t) < sz) sz = sizeof(int_t);
memcpy(&val, arg, sz);
mb_check(mb_push_int(s, l, val));
_exit: