-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mamake: eliminate strcpy(3) and sprintf(3) use
These functions throw deprecation or security warnings on some compilers or linkers. None of the usages are actually problematic because the code always makes sure the actual or maximum string length is known and fits into the buffers. However... In mamake, strcpy is only used to copy into a buffer that was just allocated, so the string length was already calculated with strlen. While strcpy has to scan for the terminating zero byte, memcpy can copy with a known length, which is faster. So this commit replaces all strcpy use with memcpy, applying code tweaks where expedient. sprintf may become problematic so easily that it's best to use snprintf as an extra guard against future potential buffer overflows. The cost is negligible. So this commit does that, too.
- Loading branch information
Showing
1 changed file
with
33 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters