mirror of
https://github.com/open-simh/simh.git
synced 2026-05-05 15:43:58 +00:00
TMXR: Fix various potential buffer overruns (COVERITY)
This commit is contained in:
@@ -850,7 +850,7 @@ if (mp->port) /* copy port */
|
|||||||
if (mp->logfiletmpl[0]) /* logfile info */
|
if (mp->logfiletmpl[0]) /* logfile info */
|
||||||
sprintf (growstring(&tptr, 7 + strlen (mp->logfiletmpl)), ",Log=%s", mp->logfiletmpl);
|
sprintf (growstring(&tptr, 7 + strlen (mp->logfiletmpl)), ",Log=%s", mp->logfiletmpl);
|
||||||
while ((*tptr == ',') || (*tptr == ' '))
|
while ((*tptr == ',') || (*tptr == ' '))
|
||||||
memcpy (tptr, tptr+1, strlen(tptr+1)+1);
|
memmove (tptr, tptr+1, strlen(tptr+1)+1);
|
||||||
for (i=0; i<mp->lines; ++i) {
|
for (i=0; i<mp->lines; ++i) {
|
||||||
char *lptr;
|
char *lptr;
|
||||||
lp = mp->ldsc + i;
|
lp = mp->ldsc + i;
|
||||||
@@ -863,7 +863,7 @@ for (i=0; i<mp->lines; ++i) {
|
|||||||
}
|
}
|
||||||
if (mp->lines == 1)
|
if (mp->lines == 1)
|
||||||
while ((*tptr == ',') || (*tptr == ' '))
|
while ((*tptr == ',') || (*tptr == ' '))
|
||||||
memcpy (tptr, tptr+1, strlen(tptr+1)+1);
|
memmove (tptr, tptr+1, strlen(tptr+1)+1);
|
||||||
if (*tptr == '\0') {
|
if (*tptr == '\0') {
|
||||||
free (tptr);
|
free (tptr);
|
||||||
tptr = NULL;
|
tptr = NULL;
|
||||||
@@ -2509,14 +2509,14 @@ while (*tptr) {
|
|||||||
if (0 == MATCH_CMD (gbuf, "CONNECT")) {
|
if (0 == MATCH_CMD (gbuf, "CONNECT")) {
|
||||||
if ((NULL == cptr) || ('\0' == *cptr))
|
if ((NULL == cptr) || ('\0' == *cptr))
|
||||||
return sim_messagef (SCPE_2FARG, "Missing Connect Specifier\n");
|
return sim_messagef (SCPE_2FARG, "Missing Connect Specifier\n");
|
||||||
strcpy (destination, cptr);
|
strncpy (destination, cptr, sizeof(destination)-1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (0 == MATCH_CMD (gbuf, "SPEED")) {
|
if (0 == MATCH_CMD (gbuf, "SPEED")) {
|
||||||
if ((NULL == cptr) || ('\0' == *cptr) ||
|
if ((NULL == cptr) || ('\0' == *cptr) ||
|
||||||
(_tmln_speed_delta (cptr) < 0))
|
(_tmln_speed_delta (cptr) < 0))
|
||||||
return sim_messagef (SCPE_ARG, "Invalid Speed Specifier: %s\n", (cptr ? cptr : ""));
|
return sim_messagef (SCPE_ARG, "Invalid Speed Specifier: %s\n", (cptr ? cptr : ""));
|
||||||
strcpy (speed, cptr);
|
strncpy (speed, cptr, sizeof(speed)-1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cptr = get_glyph (gbuf, port, ';');
|
cptr = get_glyph (gbuf, port, ';');
|
||||||
|
|||||||
Reference in New Issue
Block a user