From 43b80fee3dee191fe7d768f2594eb1f57cdda624 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sat, 2 Mar 2013 10:48:50 +0000 Subject: [PATCH] kauth: Handle calls to ka_log with no principal If ka_log is called without a principal string, then the resulting buffer will be garbage, as we don't start with a string for strlcat to append to. Caught by coverity (#985959) Reviewed-on: http://gerrit.openafs.org/9396 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman (cherry picked from commit 508674486a5b1b3b25d7f28febb41e8712d8592d) Change-Id: Ib65f63a1a7adef73d56d61ea59adfbca430dff13 Reviewed-on: http://gerrit.openafs.org/11045 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Stephan Wiesand --- src/kauth/kalog.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/kauth/kalog.c b/src/kauth/kalog.c index 6929b6f74f..35fbbdb7f7 100644 --- a/src/kauth/kalog.c +++ b/src/kauth/kalog.c @@ -137,6 +137,8 @@ ka_log(char *principal, char *instance, char *sprincipal, char *sinstance, { char logbuf[512]; /* not random! 63 . 63 , 63 . 63 max key */ + logbuf[0] = '\0'; /* Empty string */ + if (*principal) strcpy(logbuf, principal); if (realm) {