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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 508674486a5b1b3b25d7f28febb41e8712d8592d)

Change-Id: Ib65f63a1a7adef73d56d61ea59adfbca430dff13
Reviewed-on: http://gerrit.openafs.org/11045
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
Simon Wilkinson 2013-03-02 10:48:50 +00:00 committed by Stephan Wiesand
parent 99795bac24
commit 43b80fee3d

View File

@ -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 */ char logbuf[512]; /* not random! 63 . 63 , 63 . 63 max key */
logbuf[0] = '\0'; /* Empty string */
if (*principal) if (*principal)
strcpy(logbuf, principal); strcpy(logbuf, principal);
if (realm) { if (realm) {