CDC1700: Fix Coverity identified potential buffer overrun
This commit is contained in:
parent
fcf3104f6a
commit
b64f3cd1c7
2 changed files with 841 additions and 834 deletions
|
@ -639,6 +639,10 @@ in the directory you would normally run the emulator and add the following:
|
||||||
d 0570 0649
|
d 0570 0649
|
||||||
# 1733-2 unit 1
|
# 1733-2 unit 1
|
||||||
d 056F 0649
|
d 056F 0649
|
||||||
|
# 1728 Card Reader/Punch
|
||||||
|
d 056D 0649
|
||||||
|
d 057E 0649
|
||||||
|
d 0589 0649
|
||||||
#
|
#
|
||||||
set cpu protect
|
set cpu protect
|
||||||
continue
|
continue
|
||||||
|
@ -768,11 +772,12 @@ the output will be on the comment device (the console teletype):
|
||||||
4.4 Software Development Tools
|
4.4 Software Development Tools
|
||||||
|
|
||||||
The easiest way to make use of the software development tools (Macro
|
The easiest way to make use of the software development tools (Macro
|
||||||
Assembler and Fortran Compiler) is through the batch system. For this
|
Assembler and Fortran Compiler) is through the batch system. You will need to
|
||||||
description I'm going to assume the source code (assembler or Fortran) is
|
patch out at least the 1728 Card Reader/Punch for this to work (see section
|
||||||
available on the host system (I'm assuming a Linux or Unix derivative system).
|
4.1 above). For this description I'm going to assume the source code
|
||||||
You will need the mksimtape utility available in the simtools respository on
|
(assembler or Fortran) is available on the host system (I'm assuming a Linux
|
||||||
github:
|
or Unix derivative system). You will need the mksimtape utility available in
|
||||||
|
the simtools respository on github:
|
||||||
|
|
||||||
1. Create the source file (e.g. test.ftn) in upper case only.
|
1. Create the source file (e.g. test.ftn) in upper case only.
|
||||||
|
|
||||||
|
|
|
@ -340,10 +340,11 @@ char *textRep(uint16 start, uint16 len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static char text[64];
|
static char text[64];
|
||||||
|
size_t text_space = sizeof (text) - 1;
|
||||||
|
|
||||||
text[0] = '\0';
|
text[0] = '\0';
|
||||||
|
|
||||||
for (i = 0; (i < (2 * len)) && (strlen(text) < MAXTEXT); i++) {
|
for (i = 0; (i < (2 * len)) && (text_space >= MAXTEXT); i++) {
|
||||||
uint16 ch = M[start];
|
uint16 ch = M[start];
|
||||||
|
|
||||||
if ((i & 1) == 0)
|
if ((i & 1) == 0)
|
||||||
|
@ -351,7 +352,8 @@ char *textRep(uint16 start, uint16 len)
|
||||||
else start++;
|
else start++;
|
||||||
ch &= 0x7F;
|
ch &= 0x7F;
|
||||||
|
|
||||||
strcat(text, charRep[ch]);
|
strncpy(&text[strlen(text)], charRep[ch], text_space);
|
||||||
|
text_space -= strlen(charRep[ch]);
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue