mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
lib_fdopendir.c:Fix crash in fdopendir caused by fdsan
Summary: Add fdsan check in fdopendir, fdsan can work normally when using fdopendir Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
@@ -27,6 +27,10 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_FDSAN
|
||||||
|
# include <android/fdsan.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -83,5 +87,12 @@ FAR DIR *fdopendir(int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dir->fd = fd;
|
dir->fd = fd;
|
||||||
|
|
||||||
|
#ifdef CONFIG_FDSAN
|
||||||
|
android_fdsan_exchange_owner_tag(fd, 0,
|
||||||
|
android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_DIR,
|
||||||
|
(uintptr_t)dir));
|
||||||
|
#endif
|
||||||
|
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user