Avoid null pointer dereference in tovmsspec.
authorCraig A. Berry <craigberry@mac.com>
Thu, 9 Feb 2012 23:33:51 +0000 (17:33 -0600)
committerCraig A. Berry <craigberry@mac.com>
Thu, 9 Feb 2012 23:33:51 +0000 (17:33 -0600)
Before 360732b5267d5, when dirend was either never set at all or
set to NULL, the routine always returned early before executing
the parts that look at dirend.  But after that change it became
possible to dereference a null dirend pointer.  Let's not do that.

vms/vms.c

index 2a989c8..4547a2d 100644 (file)
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -8402,8 +8402,7 @@ static char *int_tovmsspec
           return rslt;
       }
   }
-
-  if (*(dirend+1) == '.') {  /* do we have trailing "/." or "/.." or "/..."? */
+  else if (*(dirend+1) == '.') {  /* do we have trailing "/." or "/.." or "/..."? */
     if (!*(dirend+2)) dirend +=2;
     if (*(dirend+2) == '.' && !*(dirend+3)) dirend += 3;
     if (decc_efs_charset == 0) {