]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
kauth: Handle calls to ka_log with no principal
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 2 Mar 2013 10:48:50 +0000 (10:48 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Tue, 3 Jun 2014 16:42:08 +0000 (12:42 -0400)
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>
src/kauth/kalog.c

index 6929b6f74f8e7618a22b2e70f5b67632dd25ee21..35fbbdb7f737642ac3b7e03d838204435b22fe9e 100644 (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 */
 
+    logbuf[0] = '\0';          /* Empty string */
+
     if (*principal)
        strcpy(logbuf, principal);
     if (realm) {