Merge "liblog: Harden log_id check."

am: c280143d9b

Change-Id: I2a87f95287be7ee8009cc9c56c7bbc82f1673b99
This commit is contained in:
Mark Salyzyn 2017-02-21 23:10:58 +00:00 committed by android-build-merger
commit cafb1b7776
2 changed files with 2 additions and 2 deletions

View file

@ -91,7 +91,7 @@ LIBLOG_HIDDEN struct android_log_transport_read logdLoggerRead = {
static int logdAvailable(log_id_t logId)
{
if (logId > LOG_ID_KERNEL) {
if (logId >= LOG_ID_MAX) {
return -EINVAL;
}
if (logId == LOG_ID_SECURITY) {

View file

@ -117,7 +117,7 @@ static void logdClose()
static int logdAvailable(log_id_t logId)
{
if (logId > LOG_ID_SECURITY) {
if (logId >= LOG_ID_MAX || logId == LOG_ID_KERNEL) {
return -EINVAL;
}
if (atomic_load(&logdLoggerWrite.context.sock) < 0) {