mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 16:11:56 +08:00
libc: backtrace_malloc change sprintf to snprintf
since snprintf can handle NULL pointer but sprintf can't. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
0a1a1e9b79
commit
a9e4c6ace1
@@ -42,7 +42,7 @@ static FAR char **backtrace_malloc(FAR void *const *buffer, int size)
|
||||
|
||||
while (size-- > 0)
|
||||
{
|
||||
int ret = sprintf(NULL, "%pS", *buffer++);
|
||||
int ret = snprintf(NULL, 0, "%pS", *buffer++);
|
||||
if (ret < 0)
|
||||
{
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user