Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libpam/modules avoid using freed pointers and non-format...
details: https://anonhg.NetBSD.org/src/rev/2c65566e9fa0
branches: trunk
changeset: 325553:2c65566e9fa0
user: christos <christos%NetBSD.org@localhost>
date: Sat Dec 28 18:04:03 2013 +0000
description:
avoid using freed pointers and non-format strings
diffstat:
lib/libpam/modules/pam_krb5/pam_krb5.c | 12 ++++++------
lib/libpam/modules/pam_ksu/pam_ksu.c | 10 +++++-----
2 files changed, 11 insertions(+), 11 deletions(-)
diffs (72 lines):
diff -r 756e30940b06 -r 2c65566e9fa0 lib/libpam/modules/pam_krb5/pam_krb5.c
--- a/lib/libpam/modules/pam_krb5/pam_krb5.c Sat Dec 28 17:36:50 2013 +0000
+++ b/lib/libpam/modules/pam_krb5/pam_krb5.c Sat Dec 28 18:04:03 2013 +0000
@@ -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 @@
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);
}
/*
diff -r 756e30940b06 -r 2c65566e9fa0 lib/libpam/modules/pam_ksu/pam_ksu.c
--- a/lib/libpam/modules/pam_ksu/pam_ksu.c Sat Dec 28 17:36:50 2013 +0000
+++ b/lib/libpam/modules/pam_ksu/pam_ksu.c Sat Dec 28 18:04:03 2013 +0000
@@ -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@localhost>
@@ -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 @@
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.
Home |
Main Index |
Thread Index |
Old Index