mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-05 00:35:13 +00:00
Bah, the whole using linux/socket.h get AF_* tokens versus sys/socket.h
thing again. Fix to use the kernel's definition of AF_MAX in linux/socket.h if it's larger than glibc's AF_MAX definition in sys/socket.h and add a wrapper function so that we don't have include af_names.h everywhere. Also, fix memory leaks around the handling of network entries of policies.
This commit is contained in:
@@ -656,10 +656,10 @@ int sd_serialize_profile(sd_serialize *p, struct codomain *profile,
|
||||
return 0;
|
||||
|
||||
if (profile->network_allowed) {
|
||||
int i;
|
||||
if (!sd_write_array(p, "net_allowed_af", AF_MAX))
|
||||
size_t i;
|
||||
if (!sd_write_array(p, "net_allowed_af", get_af_max()))
|
||||
return 0;
|
||||
for (i = 0; i < AF_MAX; i++) {
|
||||
for (i = 0; i < get_af_max(); i++) {
|
||||
u16 allowed = profile->network_allowed[i] &
|
||||
~profile->deny_network[i];
|
||||
if (!sd_write16(p, allowed))
|
||||
|
Reference in New Issue
Block a user