Fixes issues found by Coverity.
Change-Id: Ib226c27ebea07a27879e4450ca04cd2340ca7511
e->what = PROC_EVENT_COMM;
e->event_data.comm.process_pid = pid;
e->event_data.comm.process_tgid = tgid;
- strcpy(e->event_data.comm.comm, comm);
+
+ /* Copy the string and make sure we are null-terminated */
+ strncpy(e->event_data.comm.comm, comm, sizeof(e->event_data.comm.comm));
+ e->event_data.comm.comm[sizeof(e->event_data.comm.comm) - 1] = '\0';
mrp_list_append(list, &evt->hook);
}
memset(last_user_buf, 0, sizeof(last_user_buf));
- ret = fread(last_user_buf, 1, sizeof(last_user_buf), last_user_file);
+ ret = fread(last_user_buf, 1, sizeof(last_user_buf) - 1, last_user_file);
if (ret < 0) {
goto end;
goto end;
}
+ last_user_buf[ret] = '\0';
+
mrp_log_info("system-controller: last user '%s'", last_user_buf);
last_user = mrp_strdup(last_user_buf);