mirror of
https://github.com/apache/nuttx.git
synced 2026-08-07 05:27:17 +00:00
procfs/meminfo: skip invalid character before memdump
In the case of echo characters, atoi will mistake CRLF as a digit character and convert it to 0 Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
0f8ecc0150
commit
9c30d3bf33
1 changed files with 6 additions and 0 deletions
|
|
@ -36,6 +36,7 @@
|
|||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/pgalloc.h>
|
||||
|
|
@ -523,6 +524,11 @@ static ssize_t memdump_write(FAR struct file *filep, FAR const char *buffer,
|
|||
break;
|
||||
#if CONFIG_MM_BACKTRACE >= 0
|
||||
default:
|
||||
if (!isdigit(buffer[0]))
|
||||
{
|
||||
return buflen;
|
||||
}
|
||||
|
||||
pid = atoi(buffer);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue