two little bugfixes :)

This commit is contained in:
Adam Olsen 2001-05-22 15:11:54 +00:00
parent e65c1bd7e1
commit abd7d79d6b
2 changed files with 5 additions and 2 deletions

View file

@ -125,7 +125,10 @@ GIB_Interpret_Inst (char *inst)
if (ret) if (ret)
return ret; return ret;
gib_argc = 0; gib_argc = 0;
for (i = 0; buffer3[i] != ' '; i++); for (i = 0; buffer3[i] != ' '; i++)
if (buffer3[i] == '\0')
return GIB_E_PARSE;
gib_argv[0] = malloc (i + 1); gib_argv[0] = malloc (i + 1);
strncpy (gib_argv[0], buffer3, i); strncpy (gib_argv[0], buffer3, i);
gib_argv[0][i] = 0; gib_argv[0][i] = 0;

View file

@ -38,7 +38,7 @@ GIB_InStack_Push (gib_inst_t * instruction, int argc, char **argv)
gib_instack = gib_instack =
realloc (gib_instack, sizeof (gib_instack_t) * (gib_insp + 1)); realloc (gib_instack, sizeof (gib_instack_t) * (gib_insp + 1));
gib_instack[gib_insp].argv = malloc (argc + 1); gib_instack[gib_insp].argv = malloc ((argc + 1) * sizeof(char *));
for (i = 0; i <= argc; i++) { for (i = 0; i <= argc; i++) {
gib_instack[gib_insp].argv[i] = malloc (strlen (argv[i]) + 1); gib_instack[gib_insp].argv[i] = malloc (strlen (argv[i]) + 1);