Skip to content

Fix memory allocation for gsFont path strings - #107

Open
PS2HomeDeveloper wants to merge 1 commit into
ps2dev:masterfrom
PS2HomeDeveloper:patch-3
Open

PS2HomeDeveloper wants to merge 1 commit into
ps2dev:masterfrom
PS2HomeDeveloper:patch-3

Conversation

@PS2HomeDeveloper

Copy link
Copy Markdown

Summary

gsKit_init_font allocates Path and Path_DAT using strlen(path), but copies the strings with strcpy, which also writes the terminating NUL byte. Both allocations are therefore one byte too small.

Allocate space for the terminator in both font-path buffers.

Testing

  • Build gsKit with the PS2 toolchain.
  • Initialize a regular font path and verify the stored path is NUL-terminated.
  • Initialize BMP_DAT and PNG_DAT font paths and verify the corresponding .dat path is formed correctly.

Allocate additional space for null terminator in gsFont paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant