fs/procfs: fix potential null pointer access in procfs_opendir
Some entries have the opendir function set to NULL, for example
g_mount_operations.
A null pointer dereference can be triggered by an
opendir("/proc/fs/blocks") for example.
Signed-off-by: Beat Küng <beat-kueng@gmx.net>
This commit is contained in:
parent
0de4bd7938
commit
ac2078a8bf
1 changed files with 6 additions and 2 deletions
|
|
@ -714,8 +714,12 @@ static int procfs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
|
|||
* derived from struct procfs_dir_priv_s as dir.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(g_procfs_entries[x].ops != NULL &&
|
||||
g_procfs_entries[x].ops->opendir != NULL);
|
||||
DEBUGASSERT(g_procfs_entries[x].ops != NULL);
|
||||
|
||||
if (g_procfs_entries[x].ops->opendir == NULL)
|
||||
{
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
ret = g_procfs_entries[x].ops->opendir(relpath, dir);
|
||||
if (ret == OK)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue