liblog: fix an undefined-behavor in __write_to_log_daemon()
The behavior of passing NULL to c-string functions is undefined. Test: passed clang-tidy checks Bug: none Change-Id: Ie7bcc43cd19bc4a1c314381af3929eae0a6154b9
This commit is contained in:
parent
8eb237ad57
commit
6efb877973
1 changed files with 1 additions and 1 deletions
|
@ -343,7 +343,7 @@ static int __write_to_log_daemon(log_id_t log_id, struct iovec *vec, size_t nr)
|
|||
}
|
||||
}
|
||||
/* tag must be nul terminated */
|
||||
if (strnlen(tag, len) >= len) {
|
||||
if (tag && strnlen(tag, len) >= len) {
|
||||
tag = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue