diff --git a/ALTAIR/altair_sys.c b/ALTAIR/altair_sys.c index 83093ba0..f3b2d471 100644 --- a/ALTAIR/altair_sys.c +++ b/ALTAIR/altair_sys.c @@ -234,6 +234,7 @@ t_stat parse_sym (CONST char *cptr, t_addr addr, UNIT *uptr, t_value *val, int32 int32 cflag, i = 0, j, r; char gbuf[CBUFSIZE]; +memset (gbuf, 0, sizeof (gbuf)); cflag = (uptr == NULL) || (uptr == &cpu_unit); while (isspace (*cptr)) cptr++; /* absorb spaces */ if ((sw & SWMASK ('A')) || ((*cptr == '\'') && cptr++)) { /* ASCII char? */ @@ -251,7 +252,7 @@ if ((sw & SWMASK ('C')) || ((*cptr == '"') && cptr++)) { /* ASCII string? */ or numeric (including spaces). */ -while (1) { +while (i < sizeof (gbuf)) { if (*cptr == ',' || *cptr == '\0' || isdigit(*cptr)) break; @@ -285,9 +286,7 @@ if (toupper(gbuf[0]) == 'M' && /* kill trailing spaces if any */ gbuf[i] = '\0'; -for (j = i - 1; gbuf[j] == ' '; j--) { - gbuf[j] = '\0'; -} +sim_trim_endspc (gbuf); /* find opcode in table */ for (j = 0; j < 256; j++) {