avoid using freed pointers and non-format strings
This commit is contained in:
parent
285d1f1d2b
commit
8cf33d7f2e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pam_krb5.c,v 1.25 2011/04/25 22:22:25 christos Exp $ */
|
||||
/* $NetBSD: pam_krb5.c,v 1.26 2013/12/28 18:04:03 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* This pam_krb5 module contains code that is:
|
||||
@ -53,7 +53,7 @@
|
||||
#ifdef __FreeBSD__
|
||||
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_krb5/pam_krb5.c,v 1.22 2005/01/24 16:49:50 rwatson Exp $");
|
||||
#else
|
||||
__RCSID("$NetBSD: pam_krb5.c,v 1.25 2011/04/25 22:22:25 christos Exp $");
|
||||
__RCSID("$NetBSD: pam_krb5.c,v 1.26 2013/12/28 18:04:03 christos Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -861,15 +861,15 @@ log_krb5(krb5_context ctx, krb5_error_code err,
|
||||
else
|
||||
errtxt = NULL;
|
||||
if (errtxt != NULL) {
|
||||
snprintf(b2, sizeof(b2), "%s", errtxt);
|
||||
krb5_free_error_message(ctx, errtxt);
|
||||
snprintf(b2, sizeof(b2), "%s (%s)", b1, errtxt);
|
||||
} else {
|
||||
snprintf(b2, sizeof(b2), "%s (unknown %d)", b1, (int)err);
|
||||
snprintf(b2, sizeof(b2), "unknown %d", (int)err);
|
||||
}
|
||||
if (data)
|
||||
syslog_r(LOG_DEBUG, data, "%s", b2);
|
||||
syslog_r(LOG_DEBUG, data, "%s (%s)", b1, b2);
|
||||
else
|
||||
PAM_LOG(b2);
|
||||
PAM_LOG("%s (%s)", b1, b2);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pam_ksu.c,v 1.6 2011/04/25 22:03:20 christos Exp $ */
|
||||
/* $NetBSD: pam_ksu.c,v 1.7 2013/12/28 18:04:03 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 Jacques A. Vidrine <nectar@FreeBSD.org>
|
||||
@ -29,7 +29,7 @@
|
||||
#ifdef __FreeBSD__
|
||||
__FBSDID("$FreeBSD: src/lib/libpam/modules/pam_ksu/pam_ksu.c,v 1.5 2004/02/10 10:13:21 des Exp $");
|
||||
#else
|
||||
__RCSID("$NetBSD: pam_ksu.c,v 1.6 2011/04/25 22:03:20 christos Exp $");
|
||||
__RCSID("$NetBSD: pam_ksu.c,v 1.7 2013/12/28 18:04:03 christos Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -177,12 +177,12 @@ log_krb5(krb5_context ctx, krb5_error_code err, const char *fmt, ...)
|
||||
else
|
||||
errtxt = NULL;
|
||||
if (errtxt != NULL) {
|
||||
snprintf(b2, sizeof(b2), "%s", errtxt);
|
||||
krb5_free_error_message(ctx, errtxt);
|
||||
snprintf(b2, sizeof(b2), "%s (%s)", b1, errtxt);
|
||||
} else {
|
||||
snprintf(b2, sizeof(b2), "%s (unknown %d)", b1, (int)err);
|
||||
snprintf(b2, sizeof(b2), "unknown %d", (int)err);
|
||||
}
|
||||
PAM_LOG(b2);
|
||||
PAM_LOG("%s (%s)", b1, b2);
|
||||
}
|
||||
|
||||
/* Determine the target principal given the current user and the target user.
|
||||
|
Loading…
Reference in New Issue
Block a user