Skip to content

Changes to avoid strncpy in EE and host code#881

Open
uyjulian wants to merge 3 commits into
ps2dev:masterfrom
uyjulian:no_strncpy
Open

Changes to avoid strncpy in EE and host code#881
uyjulian wants to merge 3 commits into
ps2dev:masterfrom
uyjulian:no_strncpy

Conversation

@uyjulian

@uyjulian uyjulian commented Jul 2, 2026

Copy link
Copy Markdown
Member

strncpy has major flaws:

  • Will zero initialize extra memory after NULL terminator
  • Will not NULL terminate if written bytes is equal to buffer size

uyjulian added 3 commits July 1, 2026 18:24
It has major flaws:
* Will zero initialize extra memory after NULL terminator
* Will not NULL terminate if written bytes is equal to buffer size
@AKuHAK

AKuHAK commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

doh, isnt it supposed to be rather fixed in strncpy implementation?

@uyjulian

uyjulian commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

The strncpy in newlib is the C standard specification. The implementation is correct, but the specification has footguns

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.

2 participants