projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Do not permit NULL pointer on enable API calls
[lttng-tools.git]
/
liblttngctl
/
lttngctl.c
diff --git
a/liblttngctl/lttngctl.c
b/liblttngctl/lttngctl.c
index fc6ff3cc1ac92b41e28184dd04dc03944ba054ce..c91a242f32a246c9f021ac99ddb40f0c0ab66dde 100644
(file)
--- a/
liblttngctl/lttngctl.c
+++ b/
liblttngctl/lttngctl.c
@@
-496,10
+496,11
@@
int lttng_enable_event(struct lttng_handle *handle,
{
struct lttcomm_session_msg lsm;
{
struct lttcomm_session_msg lsm;
- if (
!handle
|| ev == NULL) {
+ if (
handle == NULL
|| ev == NULL) {
return -1;
}
return -1;
}
+ /* If no channel name, we put the default name */
if (channel_name == NULL) {
copy_string(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME,
sizeof(lsm.u.enable.channel_name));
if (channel_name == NULL) {
copy_string(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME,
sizeof(lsm.u.enable.channel_name));
@@
-566,13
+567,14
@@
int lttng_enable_channel(struct lttng_handle *handle,
{
struct lttcomm_session_msg lsm;
{
struct lttcomm_session_msg lsm;
- if (!handle) {
+ /*
+ * NULL arguments are forbidden. No default values.
+ */
+ if (handle == NULL || chan == NULL) {
return -1;
}
return -1;
}
- if (chan) {
- memcpy(&lsm.u.channel.chan, chan, sizeof(lsm.u.channel.chan));
- }
+ memcpy(&lsm.u.channel.chan, chan, sizeof(lsm.u.channel.chan));
lsm.cmd_type = LTTNG_ENABLE_CHANNEL;
lsm.cmd_type = LTTNG_ENABLE_CHANNEL;
This page took
0.023497 seconds
and
4
git commands to generate.