[Simh] SIMH 3.9 problem report
Darrell Pittman
darrell at vdpittman.com
Thu Dec 20 23:15:32 EST 2012
Dear Mr. Supnik:
I stumbled across a small problem in the scp.c module for SIMH. I entered
the command help get. The help_cmd() function did a lookup for the GET
command in cmd_table[], which it found, but the structure member help (a
char pointer) for the GET command was a NULL pointer, which was in turn
passed into fputs(), which tried to dereference the NULL pointer and caused
an exception.
I took the liberty of patching help_cmd() to supply a default string if help
text is unavailable in cmd_table[]. My version of help_cmd() now reads as
follows:
t_stat help_cmd (int32 flag, char *cptr)
{
char gbuf[CBUFSIZE];
CTAB *cmdp;
GET_SWITCHES (cptr);
if (*cptr) {
cptr = get_glyph (cptr, gbuf, 0);
if (*cptr)
return SCPE_2MARG;
if (cmdp = find_cmd (gbuf)) {
const char* helptxt = cmdp->help ? cmdp->help : "No help
available\n"; // ß insert line
fputs (helptxt, stdout);
// ß change line
if (sim_log)
fputs (helptxt, sim_log);
// ß change line
}
else return SCPE_ARG;
}
else {
fprint_help (stdout);
if (sim_log)
fprint_help (sim_log);
}
return SCPE_OK;
}
Thank you for this wonderful SIMH system!
Best regards,
Darrell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20121220/f928760d/attachment.html>
More information about the Simh
mailing list