summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-03-31 14:41:07 +0200
committerJeremy Allison <jra@samba.org>2016-03-31 20:30:11 +0200
commit4f65fa9c7b60264d71c8fe8ed715fb5c63e528ba (patch)
tree999c8122746a094b6935fcc867494e4e38237806
parent9d6d62010be2a54b6828cc4cc9c13b5657c8b4a0 (diff)
downloadsamba-4f65fa9c7b60264d71c8fe8ed715fb5c63e528ba.tar.gz
pam_winbind: Avoid a use of sprintf
pam_winbind depends on talloc, which depends on libreplace, so we have asprintf available. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--nsswitch/pam_winbind.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c
index b2e1778c69d..42c4f8e5964 100644
--- a/nsswitch/pam_winbind.c
+++ b/nsswitch/pam_winbind.c
@@ -191,17 +191,17 @@ static void _pam_log_int(const pam_handle_t *pamh,
{
char *format2 = NULL;
const char *service;
+ int ret;
pam_get_item(pamh, PAM_SERVICE, (const void **) &service);
- format2 = (char *)malloc(strlen(MODULE_NAME)+strlen(format)+strlen(service)+5);
- if (format2 == NULL) {
+ ret = asprintf(&format2, "%s(%s): %s", MODULE_NAME, service, format);
+ if (ret == -1) {
/* what else todo ? */
vsyslog(err, format, args);
return;
}
- sprintf(format2, "%s(%s): %s", MODULE_NAME, service, format);
vsyslog(err, format2, args);
SAFE_FREE(format2);
}