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)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 7 Mar 2013 15:56:19 +0000 (07:56 -0800)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/kauth/kalog.c

index 0b209ff..00330ea 100644 (file)
@@ -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) {