Replace a few more sprintf with snprintf

This commit is contained in:
Henrik Rydgård committed 2024-10-15 15:45:19 +02:00
1 parent 1280fcc581
commit 41eeb491e7
4 files changed
+14 -16

No files matched your search

+4 -4
View File
@@ -140,7 +140,7 @@ public:
static const char *GetStaticTypeName() { return "CallBack"; }
void GetQuickInfo(char *ptr, int size) override {
sprintf(ptr, "thread=%i, argument= %08x",
snprintf(ptr, size, "thread=%i, argument= %08x",
//hackAddress,
nc.threadId,
nc.commonArgument);
@@ -378,7 +378,7 @@ public:
const char *GetTypeName() override { return GetStaticTypeName(); }
static const char *GetStaticTypeName() { return "Thread"; }
void GetQuickInfo(char *ptr, int size) override {
sprintf(ptr, "pc= %08x sp= %08x %s %s %s %s %s %s (wt=%i wid=%i wv= %08x )",
snprintf(ptr, size, "pc= %08x sp= %08x %s %s %s %s %s %s (wt=%i wid=%i wv= %08x )",
context.pc, context.r[MIPS_REG_SP],
(nt.status & THREADSTATUS_RUNNING) ? "RUN" : "",
(nt.status & THREADSTATUS_READY) ? "READY" : "",
@@ -1699,7 +1699,7 @@ static void __ReportThreadQueueEmpty() {
idleThread0->GetQuickInfo(idleDescription0, sizeof(idleDescription0));
idleStatus0 = idleThread0->nt.status;
} else {
sprintf(idleDescription0, "DELETED");
truncate_cpy(idleDescription0, "DELETED");
}
char idleDescription1[256];
@@ -1708,7 +1708,7 @@ static void __ReportThreadQueueEmpty() {
idleThread1->GetQuickInfo(idleDescription1, sizeof(idleDescription1));
idleStatus1 = idleThread1->nt.status;
} else {
sprintf(idleDescription1, "DELETED");
truncate_cpy(idleDescription1, "DELETED");
}
ERROR_LOG_REPORT_ONCE(threadqueueempty, Log::sceKernel, "Failed to reschedule: out of threads on queue (%d, %d)", idleStatus0, idleStatus1);