mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-16 09:36:52 +00:00
libsemanage: prevent string overflow on final paths
Verify that the final path does not exceed the size of the buffer before copying. This can only occur if an alternate path for the policy root and/or the policy store root has been specified and if the resulting path would exceed PATH_MAX. A similar check is already applied by semanage_make_final(). Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
This commit is contained in:
parent
9a9b0e9d61
commit
84b19ae72e
@ -1597,7 +1597,12 @@ static int semanage_install_final_tmp(semanage_handle_t * sh)
|
||||
/* skip genhomedircon if configured */
|
||||
if (sh->conf->disable_genhomedircon &&
|
||||
i == SEMANAGE_FC_HOMEDIRS) continue;
|
||||
|
||||
|
||||
if (strlen(dst) >= sizeof(fn)) {
|
||||
ERR(sh, "Unable to compose the final paths.");
|
||||
status = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
strcpy(fn, dst);
|
||||
ret = semanage_mkpath(sh, dirname(fn));
|
||||
if (ret < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user