Make sure channel ends with -channel.
Also changed to_more_stable_channel() to return true for arbitrary channels.
Bug: 72259103
Test: update_engine_unittests
Change-Id: Ifddbc5f28563c956241c69141523c5a73ba53151
diff --git a/image_properties_android.cc b/image_properties_android.cc
index fa25683..4dc2c02 100644
--- a/image_properties_android.cc
+++ b/image_properties_android.cc
@@ -22,6 +22,7 @@
#include <android-base/properties.h>
#include <base/logging.h>
+#include <base/strings/string_util.h>
#include <bootloader.h>
#include <brillo/osrelease_reader.h>
#include <brillo/strings/string_utils.h>
@@ -122,6 +123,10 @@
LOG(INFO) << "No channel set in misc.";
return false;
}
+ if (!base::EndsWith(channel, "-channel", base::CompareCase::SENSITIVE)) {
+ LOG(ERROR) << "Channel " << channel << " doesn't end with -channel.";
+ return false;
+ }
out_channel->assign(channel);
return true;
}