libselinux: restorecon_xattr: clear dir_xattr_* after freeing
Stephen Smalley
maintainerPATCH 1/1 libselinux: restorecon_xattr: clear dir_xattr_* after freeing
We need to clear dir_xattr_* after freeing to prevent potential UAF on a subsequent call to selinux_restorecon_xattr().
Signed-off-by Stephen Smalley <[email protected]>
--- libselinux/src/selinux_restorecon.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
libselinux/src/selinux_restorecon.c +10 -10
@@ -2021,17 +2021,17 @@ cleanup: (void )fts_close (fts); errno = rc; -if (dir_xattr_list) { -/* Free any used memory */ - current = dir_xattr_list; -while (current) { - next = current->next; -free (current->directory); -free (current->digest); -free (current); - current = next; - } +/* Free any used memory */ + current = dir_xattr_list; +while (current) { + next = current->next; +free (current->directory); +free (current->digest); +free (current); + current = next; } + dir_xattr_list =NULL ; + dir_xattr_last =NULL ;return -1 ; }
Signature · 1 line
2.54.0
Quoted 5 lines · Stephen Smalley
We need to clear dir_xattr_* after freeing to prevent potential UAF on a subsequent call to
selinux_restorecon_xattr().Signed-off-by Stephen Smalley <[email protected]>
Acked-by James Carter <[email protected]>
Quoted 39 lines
--- libselinux/src/selinux_restorecon.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)libselinux/src/selinux_restorecon.c +10
-11@@ -2021,17 +2021,17 @@ cleanup: (void )fts_close (fts); errno = rc; -if (dir_xattr_list) { -/* Free any used memory */ - current = dir_xattr_list; -while (current) { - next = current->next; -free (current->directory); -free (current->digest); -free (current); - current = next; - } +/* Free any used memory */ + current = dir_xattr_list; +while (current) { + next = current->next; +free (current->directory); +free (current->digest); +free (current); + current = next; } + dir_xattr_list =NULL ; + dir_xattr_last =NULL ;return -1 ; } --2.54.0
Stephen Smalley
maintainerQuoted 10 lines · James Carter
Quoted 5 lines · Stephen Smalley
We need to clear dir_xattr_* after freeing to prevent potential UAF on a subsequent call to
selinux_restorecon_xattr().Signed-off-by Stephen Smalley <[email protected]>Acked-by James Carter <[email protected]>
Merged.
Quoted 40 lines
Quoted 40 lines
--- libselinux/src/selinux_restorecon.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)libselinux/src/selinux_restorecon.c +10
-11@@ -2021,17 +2021,17 @@ cleanup: (void )fts_close (fts); errno = rc; -if (dir_xattr_list) { -/* Free any used memory */ - current = dir_xattr_list; -while (current) { - next = current->next; -free (current->directory); -free (current->digest); -free (current); - current = next; - } +/* Free any used memory */ + current = dir_xattr_list; +while (current) { + next = current->next; +free (current->directory); +free (current->digest); +free (current); + current = next; } + dir_xattr_list =NULL ; + dir_xattr_last =NULL ;return -1 ; } --2.54.0