X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fselinux-access.c;h=426aed07d263171def62b05ae811ecc3b08be4de;hb=b42defe3b8ed3947d85db654a6cdb1b9999f394d;hp=08a4834575a3c8548e99e34340f0f5e38bc69073;hpb=0b9cc004a4dd20b32459615dd1ab98ba27202095;p=elogind.git diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c index 08a483457..426aed07d 100644 --- a/src/core/selinux-access.c +++ b/src/core/selinux-access.c @@ -174,20 +174,25 @@ static int audit_callback( user_avc's into the /var/log/audit/audit.log, otherwise they will be sent to syslog. */ -static int log_callback(int type, const char *fmt, ...) { +_printf_attr_(2, 3) static int log_callback(int type, const char *fmt, ...) { va_list ap; va_start(ap, fmt); #ifdef HAVE_AUDIT if (get_audit_fd() >= 0) { - char buf[LINE_MAX]; + _cleanup_free_ char *buf = NULL; + int r; - vsnprintf(buf, sizeof(buf), fmt, ap); - audit_log_user_avc_message(get_audit_fd(), AUDIT_USER_AVC, buf, NULL, NULL, NULL, 0); + r = vasprintf(&buf, fmt, ap); va_end(ap); - return 0; + if (r >= 0) { + audit_log_user_avc_message(get_audit_fd(), AUDIT_USER_AVC, buf, NULL, NULL, NULL, 0); + return 0; + } + + va_start(ap, fmt); } #endif log_metav(LOG_USER | LOG_INFO, __FILE__, __LINE__, __FUNCTION__, fmt, ap);