aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-11-12 05:37:55 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-11-12 05:37:55 +0000
commit7da3c54554696625308c5b920d569fb9592084eb (patch)
treedeb87cb459603c9a5427443bbf6c7a30225c4545
parent1ed404b31fa668bdb6569fc7ba4e8009a0938ee6 (diff)
parent153e539e62f510a2a246df8390efbb41e5af20f3 (diff)
downloadrecovery-android-security-11.0.0_r74.tar.gz
Change-Id: I9f2b0d94f10e69f40906354f9bf2bfa2d18925c3
-rw-r--r--minui/events.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/minui/events.cpp b/minui/events.cpp
index 87f81122..863ac747 100644
--- a/minui/events.cpp
+++ b/minui/events.cpp
@@ -29,7 +29,9 @@
#include <functional>
#include <memory>
+#include <string>
+#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include "minui/minui.h"
@@ -118,12 +120,12 @@ static int inotify_cb(int fd, __unused uint32_t epevents) {
}
offset += sizeof(inotify_event) + pevent->len;
- pevent->name[pevent->len] = '\0';
- if (strncmp(pevent->name, "event", 5)) {
+ std::string event_name(pevent->name, pevent->len);
+ if (!android::base::StartsWith(event_name, "event")) {
continue;
}
- android::base::unique_fd dfd(openat(dirfd(dir.get()), pevent->name, O_RDONLY));
+ android::base::unique_fd dfd(openat(dirfd(dir.get()), event_name.c_str(), O_RDONLY));
if (dfd == -1) {
break;
}