kauth: don't call lcstring with a null source argument
authorGarrett Wollman <wollman@csail.mit.edu>
Wed, 25 Jul 2012 03:54:56 +0000 (23:54 -0400)
committerDerrick Brashear <shadow@dementix.org>
Wed, 25 Jul 2012 20:27:45 +0000 (13:27 -0700)
This code was probably never executed, but now that lcstring() has
an AFS_NONNULL annotation, the static analyzer indicates the
potential null-pointer-dereference.

Change-Id: Idb41c2af1cb38bc5c084d4912614e0a553d4aa5a
Reviewed-on: http://gerrit.openafs.org/7864
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/kauth/authclient.c

index c3d400c..10bef97 100644 (file)
@@ -104,8 +104,8 @@ ka_GetServers(char *cell, struct afsconf_cell * cellinfo)
     char cellname[MAXKTCREALMLEN];
 
     LOCK_GLOBAL_MUTEX;
-    if (cell && !strlen(cell))
-       cell = 0;
+    if (cell == NULL || strlen(cell) == 0)
+       cell = NULL;
     else
        cell = lcstring(cellname, cell, sizeof(cellname));