pam-util: fix pam_syslog_pam_error() format string
To cut off a string at some position we must set the "precision" not the field width in format strings. This led to some assert()s being hit where they really should not be.
This commit is contained in:
committed by
Luca Boccassi
parent
0d5f59a248
commit
f200d6cae3
@@ -39,7 +39,8 @@ int pam_syslog_pam_error(pam_handle_t *handle, int level, int error, const char
|
||||
pamerr = "n/a"; /* We cannot have any formatting chars */
|
||||
|
||||
char buf[p - format + strlen(pamerr) + 1];
|
||||
xsprintf(buf, "%*s%s", (int)(p - format), format, pamerr);
|
||||
xsprintf(buf, "%.*s%s", (int)(p - format), format, pamerr);
|
||||
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL;
|
||||
pam_vsyslog(handle, level, buf, ap);
|
||||
REENABLE_WARNING;
|
||||
|
||||
Reference in New Issue
Block a user