Merge "liblog: null terminate log_msg"
This commit is contained in:
commit
1153fbbcd3
1 changed files with 5 additions and 3 deletions
|
@ -109,8 +109,8 @@ int android_logger_list_read(struct logger_list* logger_list, struct log_msg* lo
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (ret > (int)sizeof(*log_msg)) {
|
||||
ret = sizeof(*log_msg);
|
||||
if (ret > LOGGER_ENTRY_MAX_LEN) {
|
||||
ret = LOGGER_ENTRY_MAX_LEN;
|
||||
}
|
||||
|
||||
if (ret < static_cast<int>(sizeof(log_msg->entry))) {
|
||||
|
@ -118,7 +118,7 @@ int android_logger_list_read(struct logger_list* logger_list, struct log_msg* lo
|
|||
}
|
||||
|
||||
if (log_msg->entry.hdr_size < sizeof(log_msg->entry) ||
|
||||
log_msg->entry.hdr_size >= sizeof(struct log_msg) - sizeof(log_msg->entry)) {
|
||||
log_msg->entry.hdr_size >= LOGGER_ENTRY_MAX_LEN - sizeof(log_msg->entry)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,8 @@ int android_logger_list_read(struct logger_list* logger_list, struct log_msg* lo
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
log_msg->buf[log_msg->entry.len + log_msg->entry.hdr_size] = '\0';
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue