linux-audit / audit-userspace

Linux audit userspace repository
GNU General Public License v2.0
567 stars 201 forks source link

Fix USE_AFTER_FREE SAST findings #376

Open Cropi opened 3 weeks ago

Cropi commented 3 weeks ago

Covscan reports there are two issues labeled with USE_AFTER_FREE.

  1. lru: In remove_node, when the queue has only one single element,. the queue->front pointer is updated but the queue->end is not. It does not cause any problems because in dequeue we loop until queue->count > 0 , instead of queue->end != NULL .
  2. auditd-event: covscan says that Equality between "oconf->plugin_dir" and "nconf->plugin_dir" implies that they are aliases. I think the condition if (oconf->plugin_dir != nconf->plugin_dir ...) will always be true because in clear_config, we have: config->plugin_dir = strdup("/etc/audit/plugins.d");