This is necessary, as the function relies on strnlen in order to
determine how many bytes to write, and at the same time it doesn't
guarantee that the whole buffer is being written (the buffer is only
enlarged, never shrunk).
Change-Id: I1a761ae61aee888f16e9243a136dec8c9b76b7ec
*cb = '\0';
cb++;
}
+
+ *cb = '\0';
}
static ssize_t partition_write_buffer(struct zlog_file *zlog_file_data, size_t len)
zlog_file_data = (struct zlog_file *)filep->private_data;
- if (len > zlog_file_data->buffer_len && !update_zlog_data_buffer_size(zlog_file_data, len)) {
+ if (len >= zlog_file_data->buffer_len && !update_zlog_data_buffer_size(zlog_file_data, len + 1)) {
pr_err("update_zlog_data_buffer_size failed\n");
return -ENOMEM;
}