liblog: accept log messages with hdr_size greater than known headers

We don't need to be so strict about this comparison.  It's possible
that logd will extend the message that it passes to readers in the
future, and since we have a hdr_size parameter it can do so in a
backwards compatible way, as long as we loosen this restriction.

This keeps a sane upper bound that the hdr_size cannot be larger than
the log message itself.

Test: logcat, liblog-unit-tests
Change-Id: I8a6bea2a2d6e3315d998c51c1029e466ff06b45f
diff --git a/liblog/include/log/log_read.h b/liblog/include/log/log_read.h
index ee3b250..6601072 100644
--- a/liblog/include/log/log_read.h
+++ b/liblog/include/log/log_read.h
@@ -114,7 +114,7 @@
   }
   char* msg() {
     unsigned short hdr_size = entry.hdr_size;
-    if (hdr_size != sizeof(entry)) {
+    if (hdr_size >= sizeof(struct log_msg) - sizeof(entry)) {
       return nullptr;
     }
     return reinterpret_cast<char*>(buf) + hdr_size;
diff --git a/liblog/logger_read.cpp b/liblog/logger_read.cpp
index c65501c..0d383ff 100644
--- a/liblog/logger_read.cpp
+++ b/liblog/logger_read.cpp
@@ -120,7 +120,8 @@
     return -EINVAL;
   }
 
-  if (log_msg->entry.hdr_size != sizeof(log_msg->entry)) {
+  if (log_msg->entry.hdr_size < sizeof(log_msg->entry) ||
+      log_msg->entry.hdr_size >= sizeof(struct log_msg) - sizeof(log_msg->entry)) {
     return -EINVAL;
   }