mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
addons/LoadState.cpp used strncpy, which MSVC deprecates (C4996) and which does not terminate on truncation, so the call site had to add the terminator itself. frame/Attributes.cpp had already met that warning and answered it with a local BoundedCopy helper. Promote that helper to Common rather than copy it a second time, and point both files at it. The helper treats a null source as empty, so LoadState loses its null-name branch as well. Behavior is unchanged: strncpy(dst, src, kMaxName - 1) plus a manual terminator wrote at most kMaxName - 1 characters, and so does BoundedCopy(dst, src, kMaxName). strncpy_s was the other option and is worse here. It invokes the invalid-parameter handler on truncation unless the caller passes _TRUNCATE, and LoadState runs inside an engine hook.