Blame SOURCES/sudo-1.8.23-fix_empty_username_in_do_syslog.patch

46eb58
diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c
46eb58
index 2c685cd..7751a67 100644
46eb58
--- a/plugins/sudoers/logging.c
46eb58
+++ b/plugins/sudoers/logging.c
46eb58
@@ -106,7 +106,15 @@ do_syslog(int pri, char *msg)
46eb58
      * Log the full line, breaking into multiple syslog(3) calls if necessary
46eb58
      */
46eb58
     fmt = _("%8s : %s");
46eb58
-    maxlen = def_syslog_maxlen - (strlen(fmt) - 5 + strlen(sudo_user_name));
46eb58
+
46eb58
+
46eb58
+    if (!sudo_user_name) {
46eb58
+        maxlen = def_syslog_maxlen - (strlen(fmt) - 5);
46eb58
+    }
46eb58
+    else {
46eb58
+        maxlen = def_syslog_maxlen - (strlen(fmt) - 5 + strlen(sudo_user_name));
46eb58
+    }
46eb58
+
46eb58
     for (p = msg; *p != '\0'; ) {
46eb58
 	len = strlen(p);
46eb58
 	if (len > maxlen) {
46eb58
@@ -122,7 +130,12 @@ do_syslog(int pri, char *msg)
46eb58
 	    save = *tmp;
46eb58
 	    *tmp = '\0';
46eb58
 
46eb58
-	    mysyslog(pri, fmt, sudo_user_name, p);
46eb58
+        if(!sudo_user_name) {
46eb58
+            mysyslog(pri, fmt, "NaN", p);
46eb58
+        }
46eb58
+	    else{
46eb58
+            mysyslog(pri, fmt, sudo_user_name, p);
46eb58
+        }
46eb58
 
46eb58
 	    *tmp = save;			/* restore saved character */
46eb58