#include "agent.h"
#include "ust-app.h"
#include "utils.h"
-#include "error.h"
+#include "common/error.h"
#define AGENT_RET_CODE_INDEX(code) (code - AGENT_RET_CODE_SUCCESS)
}
/* Filter expression */
- if (strncmp(event->filter_expression, key->filter_expression,
- strlen(event->filter_expression)) != 0) {
+ if (!!event->filter_expression ^ !!key->filter_expression) {
+ /* One has a filter expression, the other does not */
goto no_match;
}
+ if (event->filter_expression) {
+ if (strncmp(event->filter_expression, key->filter_expression,
+ strlen(event->filter_expression)) != 0) {
+ goto no_match;
+ }
+ }
+
return 1;
no_match:
for (i = 0; i < nb_event; i++) {
offset += len;
- strncpy(tmp_events[i].name, reply->payload + offset,
- sizeof(tmp_events[i].name));
+ if (lttng_strncpy(tmp_events[i].name, reply->payload + offset,
+ sizeof(tmp_events[i].name))) {
+ ret = LTTNG_ERR_INVALID;
+ goto error;
+ }
tmp_events[i].pid = app->pid;
tmp_events[i].enabled = -1;
len = strlen(reply->payload + offset) + 1;