ALTAIR: Fix potential reference to uninitialized memory (Coverity)
This commit is contained in:
parent
fa7e350c78
commit
62dc8ff6ec
1 changed files with 3 additions and 4 deletions
|
@ -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++) {
|
||||
|
|
Loading…
Add table
Reference in a new issue