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:
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;
|
||||
|
Loading…
Reference in New Issue
Block a user