mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-21 20:16:51 +00:00
libselinux: audit2why: make sure path is nul terminated
We use strncpy which could leave a non-nul terminated string if the source is longer than PATH_MAX. Add that nul. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
960d6ee879
commit
933840af6c
@ -195,8 +195,9 @@ static int __policy_init(const char *init_path)
|
||||
int rc;
|
||||
unsigned int cnt;
|
||||
|
||||
path[PATH_MAX-1] = '\0';
|
||||
if (init_path) {
|
||||
strncpy(path, init_path, PATH_MAX);
|
||||
strncpy(path, init_path, PATH_MAX-1);
|
||||
fp = fopen(path, "r");
|
||||
if (!fp) {
|
||||
snprintf(errormsg, sizeof(errormsg),
|
||||
|
Loading…
Reference in New Issue
Block a user