fix a potential invalid dereference

Change-Id: I3dc9a8b868953ad3c9eb1ddfd1f76c3be94af8a6
This commit is contained in:
Maciej Żenczykowski 2022-07-13 20:51:17 +00:00
parent 8693c789d3
commit 6f4e6ae532

View file

@ -30,9 +30,9 @@
#include <sys/wait.h>
#include <unistd.h>
// This is BpfLoader v0.25
// This is BpfLoader v0.26
#define BPFLOADER_VERSION_MAJOR 0u
#define BPFLOADER_VERSION_MINOR 25u
#define BPFLOADER_VERSION_MINOR 26u
#define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR)
#include "bpf/BpfUtils.h"
@ -1078,7 +1078,7 @@ static int loadCodeSections(const char* elfPath, vector<codeSection>& cs, const
for (const auto& line : lines) ALOGW("%s", line.c_str());
ALOGW("bpf_prog_load - END log_buf contents.");
if (cs[i].prog_def->optional) {
if (cs[i].prog_def.has_value() && cs[i].prog_def->optional) {
ALOGW("failed program is marked optional - continuing...");
continue;
}