Skip to content

Commit

Permalink
add length check
Browse files Browse the repository at this point in the history
it seems like the strncpy is clobbering something

man i don't have c down
  • Loading branch information
0xcaff committed Feb 23, 2024
1 parent 9629cc3 commit 83032c5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions goldhen_plugins/plugin_src/extern_traces/source/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ long sceKernelWrite(int, const void *, unsigned long);
void extern_logf(const char *msg)
{
int len = strlen(msg);
if (logging_state.buffer_idx + len >= MAX_BUFFERED_BYTES) {
printf("extern_traces: extern_logf dropping logs\n");
return;
}

strncpy(&logging_state.buffer[logging_state.buffer_idx], msg, len);
logging_state.buffer_idx += len;

Expand Down

0 comments on commit 83032c5

Please sign in to comment.