From: Simon Wilkinson Date: Sat, 2 Mar 2013 10:48:50 +0000 (+0000) Subject: kauth: Handle calls to ka_log with no principal X-Git-Tag: upstream/1.8.0_pre1^2~1348 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=508674486a5b1b3b25d7f28febb41e8712d8592d;p=packages%2Fo%2Fopenafs.git 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) Change-Id: I928b2807c093ac3f71a28150a117fd7b7eb29b05 Reviewed-on: http://gerrit.openafs.org/9396 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman --- diff --git a/src/kauth/kalog.c b/src/kauth/kalog.c index 0b209ffbe..00330ea23 100644 --- a/src/kauth/kalog.c +++ b/src/kauth/kalog.c @@ -129,6 +129,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) {