Merge "liblog: Harden log_id check."

This commit is contained in:
Mark Salyzyn 2017-02-21 23:06:33 +00:00 committed by Gerrit Code Review
commit c280143d9b
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) {