[libunwind] [libunwind] Remove unnecessary dependencies on fprintf and stdio.h for increased baremetal friendliness (PR #72040)
Alexander Richardson via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 20 10:44:36 PST 2023
================
@@ -681,7 +680,7 @@ inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
uint16_t nameLen;
char *funcName = getFuncNameFromTBTable(addr, nameLen, offset);
if (funcName != NULL) {
- snprintf(buf, bufLen, "%.*s", nameLen, funcName);
+ strncpy(buf, funcName, nameLen < bufLen ? nameLen : bufLen);
----------------
arichardson wrote:
This will always write up to 512 '\0' bytes. maybe best to use memcpy+strlen instead?
https://github.com/llvm/llvm-project/pull/72040
More information about the cfe-commits
mailing list