If environment variable HOME is set but empty, the check for a trailing
slash would lead to an out-of-bounds access.

--- which-2.21/which.c~	2015-06-21 11:53:10.569495520 +0200
+++ which-2.21/which.c	2015-06-21 11:56:55.298057365 +0200
@@ -515,7 +515,7 @@
     strncpy(home, h, sizeof(home));
     home[sizeof(home) - 1] = 0;
     homelen = strlen(home);
-    if (home[homelen - 1] != '/' && homelen < sizeof(home) - 1)
+    if (homelen == 0 || home[homelen - 1] != '/' && homelen < sizeof(home) - 1)
     {
       strcat(home, "/");
       ++homelen;
