--- trunk/src/dec_prom.c 2007/10/08 16:17:48 2 +++ trunk/src/dec_prom.c 2007/10/08 16:18:27 10 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: dec_prom.c,v 1.57 2005/02/22 12:05:19 debug Exp $ + * $Id: dec_prom.c,v 1.60 2005/06/26 11:36:28 debug Exp $ * * DECstation PROM emulation. */ @@ -133,7 +133,7 @@ case 0x38: /* read(handle, ptr, length) */ cpu->cd.mips.gpr[MIPS_GPR_V0] = -1; if ((int32_t)cpu->cd.mips.gpr[MIPS_GPR_A2] > 0) { - int disk_id = diskimage_bootdev(cpu->machine); + int disk_id = diskimage_bootdev(cpu->machine, NULL); int res; unsigned char *tmp_buf; @@ -145,8 +145,8 @@ break; } - res = diskimage_access(cpu->machine, disk_id, 0, - current_file_offset, tmp_buf, + res = diskimage_access(cpu->machine, disk_id, + DISKIMAGE_SCSI, 0, current_file_offset, tmp_buf, cpu->cd.mips.gpr[MIPS_GPR_A2]); /* If the transfer was successful, transfer the data @@ -363,7 +363,8 @@ switch (ch) { case '%': - strcpy(printfbuf, "%%"); + strlcpy(printfbuf, "%%", + sizeof(printfbuf)); break; case 'c': case 'd': @@ -375,7 +376,8 @@ /* Linux booters seem to go over the edge sometimes: */ ch = '\0'; - strcpy(printfbuf, "[...]\n"); + strlcpy(printfbuf, "[...]\n", + sizeof(printfbuf)); #else printf("[ decstation_prom_emul" "(): too many arguments ]"); @@ -391,15 +393,16 @@ switch (ch) { case 'c': - sprintf(printfbuf, "%c", ch2); + snprintf(printfbuf, sizeof( + printfbuf), "%c", ch2); break; case 'd': - sprintf(printfbuf, "%d", - argdata); + snprintf(printfbuf, sizeof( + printfbuf), "%d", argdata); break; case 'x': - sprintf(printfbuf, "%x", - argdata); + snprintf(printfbuf, sizeof( + printfbuf), "%x", argdata); break; case 's': /* Print a "%s" string. */ @@ -432,7 +435,8 @@ case '\0': break; default: - sprintf(printfbuf, "%c", ch); + snprintf(printfbuf, sizeof(printfbuf), + "%c", ch); } printfbuf[sizeof(printfbuf)-1] = '\0'; @@ -469,7 +473,7 @@ cpu->cd.mips.gpr[MIPS_GPR_V0] = 0; if ((int32_t)cpu->cd.mips.gpr[MIPS_GPR_A2] > 0) { - int disk_id = diskimage_bootdev(cpu->machine); + int disk_id = diskimage_bootdev(cpu->machine, NULL); int res; unsigned char *tmp_buf; @@ -481,7 +485,8 @@ break; } - res = diskimage_access(cpu->machine, disk_id, 0, + res = diskimage_access(cpu->machine, disk_id, + DISKIMAGE_SCSI, 0, cpu->cd.mips.gpr[MIPS_GPR_A0] * 512, tmp_buf, cpu->cd.mips.gpr[MIPS_GPR_A2]);