logd: klogd and Mediatek part deux

(cherry pick from commit 47dba71f240624fc0fc9d39e2b91dc82ef164b39)

- switch to an open coded strnrchr
- validity checking on n, taglen and b values.

Bug: 23517551
Change-Id: I568e25c5aa6d8474835454a0e83b19c2921b7986
1 file changed