projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: notification: assert on len > 0 for dropped notification message
[lttng-tools.git]
/
src
/
lib
/
lttng-ctl
/
rotate.c
diff --git
a/src/lib/lttng-ctl/rotate.c
b/src/lib/lttng-ctl/rotate.c
index 2dbaa46a3eaf9d955b3d50f030c0504421aa3260..17964fb1070784b9b65badf61eca9a94da9e819c 100644
(file)
--- a/
src/lib/lttng-ctl/rotate.c
+++ b/
src/lib/lttng-ctl/rotate.c
@@
-169,7
+169,7
@@
void lttng_rotation_handle_destroy(
if (!rotation_handle) {
return;
}
if (!rotation_handle) {
return;
}
- lttng_trace_archive_location_
destroy
(rotation_handle->archive_location);
+ lttng_trace_archive_location_
put
(rotation_handle->archive_location);
free(rotation_handle);
}
free(rotation_handle);
}
@@
-219,8
+219,11
@@
int lttng_rotate_session(const char *session_name,
memset(&lsm, 0, sizeof(lsm));
lsm.cmd_type = LTTNG_ROTATE_SESSION;
memset(&lsm, 0, sizeof(lsm));
lsm.cmd_type = LTTNG_ROTATE_SESSION;
- lttng_ctl_copy_string(lsm.session.name, session_name,
- sizeof(lsm.session.name));
+
+ ret = lttng_strncpy(lsm.session.name, session_name,
+ sizeof(lsm.session.name));
+ /* Source length already validated. */
+ assert(ret == 0);
ret = lttng_ctl_ask_sessiond(&lsm, (void **) &rotate_return);
if (ret <= 0) {
ret = lttng_ctl_ask_sessiond(&lsm, (void **) &rotate_return);
if (ret <= 0) {
@@
-282,8
+285,10
@@
enum lttng_rotation_status lttng_rotation_update_schedule(
memset(&lsm, 0, sizeof(lsm));
lsm.cmd_type = LTTNG_ROTATION_SET_SCHEDULE;
memset(&lsm, 0, sizeof(lsm));
lsm.cmd_type = LTTNG_ROTATION_SET_SCHEDULE;
-
lttng_ctl_copy_string
(lsm.session.name, session_name,
+
ret = lttng_strncpy
(lsm.session.name, session_name,
sizeof(lsm.session.name));
sizeof(lsm.session.name));
+ /* Source length already validated. */
+ assert(ret == 0);
lsm.u.rotation_set_schedule.type = (uint32_t) schedule->type;
switch (schedule->type) {
lsm.u.rotation_set_schedule.type = (uint32_t) schedule->type;
switch (schedule->type) {
@@
-366,10
+371,19
@@
int get_schedules(const char *session_name,
struct lttng_rotation_schedules *schedules = NULL;
struct lttng_rotation_schedule *periodic = NULL, *size = NULL;
struct lttng_rotation_schedules *schedules = NULL;
struct lttng_rotation_schedule *periodic = NULL, *size = NULL;
+ if (!session_name) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
+
memset(&lsm, 0, sizeof(lsm));
lsm.cmd_type = LTTNG_SESSION_LIST_ROTATION_SCHEDULES;
memset(&lsm, 0, sizeof(lsm));
lsm.cmd_type = LTTNG_SESSION_LIST_ROTATION_SCHEDULES;
-
lttng_ctl_copy_string
(lsm.session.name, session_name,
+
ret = lttng_strncpy
(lsm.session.name, session_name,
sizeof(lsm.session.name));
sizeof(lsm.session.name));
+ if (ret) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
ret = lttng_ctl_ask_sessiond(&lsm, (void **) &schedules_comm);
if (ret < 0) {
ret = lttng_ctl_ask_sessiond(&lsm, (void **) &schedules_comm);
if (ret < 0) {
This page took
0.023488 seconds
and
4
git commands to generate.