[systemd-devel] [PATCH] selinux-access:log_callback() increase buffer for audit logging

Lennart Poettering lennart at poettering.net
Wed Feb 13 10:39:09 PST 2013


On Wed, 13.02.13 17:08, harald at redhat.com (harald at redhat.com) wrote:

> From: Harald Hoyer <harald at redhat.com>
> 
> As per https://bugzilla.redhat.com/show_bug.cgi?id=883043#c5
> we can increase the buffer used with audit_log_user_avc_message() safely
> to 4096 bytes.

I have now changed this to use a dynamically sized buffer instead. This
should avoid the issue for good, so that we don't have to double the
buffer size in two months again. 

> ---
>  src/core/selinux-access.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c
> index 08a4834..363673a 100644
> --- a/src/core/selinux-access.c
> +++ b/src/core/selinux-access.c
> @@ -181,7 +181,7 @@ static int log_callback(int type, const char *fmt, ...) {
>  
>  #ifdef HAVE_AUDIT
>          if (get_audit_fd() >= 0) {
> -                char buf[LINE_MAX];
> +                char buf[4096];
>  
>                  vsnprintf(buf, sizeof(buf), fmt, ap);
>                  audit_log_user_avc_message(get_audit_fd(), AUDIT_USER_AVC, buf, NULL, NULL, NULL, 0);


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list