* [PATCH] pam_cifscreds: fix warning on NULL arg passed to %s in pam_syslog()
@ 2024-03-08 16:25 Paulo Alcantara
0 siblings, 0 replies; only message in thread
From: Paulo Alcantara @ 2024-03-08 16:25 UTC (permalink / raw)
To: piastryyy; +Cc: linux-cifs, Paulo Alcantara
Fix the following compiler warning with -Wformat-overflow in
cifscreds_pam_update():
pam_cifscreds.c: In function ‘cifscreds_pam_update’:
pam_cifscreds.c:340:83: warning: ‘%s’ directive argument is null
[-Wformat-overflow=]
340 | pam_syslog(ph, LOG_ERR, "error: Update credential key for %s: %s",
| ^~
Fixes: cbbcd6e71c0a ("cifscreds: create PAM module to insert credentials at login")
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
---
pam_cifscreds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pam_cifscreds.c b/pam_cifscreds.c
index 5d99c2db3038..eb9851d52a7d 100644
--- a/pam_cifscreds.c
+++ b/pam_cifscreds.c
@@ -338,7 +338,7 @@ static int cifscreds_pam_update(pam_handle_t *ph, const char *user, const char *
key_serial_t key = key_add(currentaddress, user, password, keytype);
if (key <= 0) {
pam_syslog(ph, LOG_ERR, "error: Update credential key for %s: %s",
- currentaddress, strerror(errno));
+ (currentaddress ?: "(null)"), strerror(errno));
}
}
--
2.44.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-08 16:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08 16:25 [PATCH] pam_cifscreds: fix warning on NULL arg passed to %s in pam_syslog() Paulo Alcantara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).