semodule: Don't forget to munmap() data
PATCH 1/1 semodule: Don't forget to munmap() data
semanage_module_extract() mmap()'s the module raw data but it leaves on the caller to munmap() them.
Reported-by Ondrej Mosnacek <[email protected]>
Signed-off-by Petr Lautrbach <[email protected]>
--- policycoreutils/semodule/semodule.c | 3 +++ 1 file changed, 3 insertions(+)
policycoreutils/semodule/semodule.c +3 -0
@@ -394,6 +394,9 @@ static char *hash_module_data(const char *module_name, const int prio) { sha256_buf[i *2 ] =0 ; cleanup_extract: +if (data_len >0 ) { +munmap (data, data_len); + }semanage_module_info_destroy (sh, extract_info);free (extract_info);semanage_module_key_destroy (sh, modkey);
Signature · 1 line
2.33.1
Quoted 6 lines · Petr Lautrbach
semanage_module_extract()mmap()'s the module raw data but it leaves on the caller tomunmap()them.Reported-by Ondrej Mosnacek <[email protected]>Signed-off-by Petr Lautrbach <[email protected]>
Acked-by James Carter <[email protected]>
Quoted 21 lines
--- policycoreutils/semodule/semodule.c | 3 +++ 1 file changed, 3 insertions(+)policycoreutils/semodule/semodule.c +3
-1@@ -394,6 +394,9 @@ static char *hash_module_data(const char *module_name, const int prio) { sha256_buf[i *2 ] =0 ; cleanup_extract: +if (data_len >0 ) { +munmap (data, data_len); + }semanage_module_info_destroy (sh, extract_info);free (extract_info);semanage_module_key_destroy (sh, modkey); --2.33.1
Quoted 9 lines · James Carter
Quoted 6 lines · Petr Lautrbach
semanage_module_extract()mmap()'s the module raw data but it leaves on the caller tomunmap()them.Reported-by Ondrej Mosnacek <[email protected]>Signed-off-by Petr Lautrbach <[email protected]>Acked-by James Carter <[email protected]>
Merged.
Quoted 21 lines
Quoted 21 lines
--- policycoreutils/semodule/semodule.c | 3 +++ 1 file changed, 3 insertions(+)policycoreutils/semodule/semodule.c +3
-1@@ -394,6 +394,9 @@ static char *hash_module_data(const char *module_name, const int prio) { sha256_buf[i *2 ] =0 ; cleanup_extract: +if (data_len >0 ) { +munmap (data, data_len); + }semanage_module_info_destroy (sh, extract_info);free (extract_info);semanage_module_key_destroy (sh, modkey); --2.33.1