SCP: Silence compiler warning about potential sprintf buffer truncation
This commit is contained in:
parent
9cb93a64f2
commit
845a4d8f0e
1 changed files with 2 additions and 2 deletions
4
scp.c
4
scp.c
|
@ -2873,8 +2873,8 @@ if (cptr == NULL) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cptr2 = NULL;
|
cptr2 = NULL;
|
||||||
if (cptr && sizeof (nbuf) > strlen (cptr) + strlen ("/simh.ini") + 1) {
|
if (cptr && (sizeof (nbuf) > strlen (cptr) + strlen ("/simh.ini") + 3)) {
|
||||||
sprintf(nbuf, "\"%s%s%ssimh.ini\"", cptr2 ? cptr2 : "", cptr, strchr (cptr, '/') ? "/" : "\\");
|
snprintf(nbuf, sizeof (nbuf), "\"%s%s%ssimh.ini\"", cptr2 ? cptr2 : "", cptr, strchr (cptr, '/') ? "/" : "\\");
|
||||||
stat = do_cmd (-1, nbuf) & ~SCPE_NOMESSAGE; /* simh.ini proc cmd file */
|
stat = do_cmd (-1, nbuf) & ~SCPE_NOMESSAGE; /* simh.ini proc cmd file */
|
||||||
}
|
}
|
||||||
if (SCPE_BARE_STATUS(stat) == SCPE_OPENERR)
|
if (SCPE_BARE_STATUS(stat) == SCPE_OPENERR)
|
||||||
|
|
Loading…
Add table
Reference in a new issue