summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0d0386e)
Issue
=====
If an exclusion string is smaller than the `LTTNG_SYMBOL_NAME_LEN`
integer, the `lttng_dynamic_buffer_append()` call will append
unallocated data to the buffer.
Fix
===
Use the `exclusion_len` value to copy the actual exclusion and pad the
remaining bytes with zeros.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I04c6681c28e82de29791541eb490158db9e503d0
for (i = 0; i < exclusion_count; i++) {
size_t exclusion_len;
for (i = 0; i < exclusion_count; i++) {
size_t exclusion_len;
- exclusion_len = lttng_strnlen(*(exclusion_list + i),
+ exclusion_len = lttng_strnlen(exclusion_list[i],
LTTNG_SYMBOL_NAME_LEN);
if (exclusion_len == LTTNG_SYMBOL_NAME_LEN) {
/* Exclusion is not NULL-terminated. */
LTTNG_SYMBOL_NAME_LEN);
if (exclusion_len == LTTNG_SYMBOL_NAME_LEN) {
/* Exclusion is not NULL-terminated. */
}
ret = lttng_dynamic_buffer_append(&payload.buffer,
}
ret = lttng_dynamic_buffer_append(&payload.buffer,
- *(exclusion_list + i), LTTNG_SYMBOL_NAME_LEN);
+ exclusion_list[i], exclusion_len);
+ if (ret) {
+ goto mem_error;
+ }
+
+ /*
+ * Padding the rest of the entry with zeros. Every exclusion
+ * entries take LTTNG_SYMBOL_NAME_LEN bytes in the buffer.
+ */
+ ret = lttng_dynamic_buffer_set_size(&payload.buffer,
+ LTTNG_SYMBOL_NAME_LEN * (i + 1));
if (ret) {
goto mem_error;
}
if (ret) {
goto mem_error;
}