mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibC: Fix scandir
not checking for allocation failure
This commit is contained in:
parent
1af072e0f3
commit
adfdb63e02
Notes:
sideshowbarker
2024-07-17 20:45:29 +09:00
Author: https://github.com/mhermier Commit: https://github.com/SerenityOS/serenity/commit/adfdb63e020 Pull-request: https://github.com/SerenityOS/serenity/pull/11827 Reviewed-by: https://github.com/BertalanD Reviewed-by: https://github.com/bgianfo ✅
@ -278,6 +278,9 @@ int scandir(const char* dir_name,
|
||||
|
||||
const int size = tmp_names.size();
|
||||
auto** names = static_cast<struct dirent**>(kmalloc_array(size, sizeof(struct dirent*)));
|
||||
if (names == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
for (auto i = 0; i < size; i++) {
|
||||
names[i] = tmp_names[i];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user