]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Followup on RT3334 fix: make sure that a directory that's the empty
authorRichard Levitte <richard@levitte.org>
Thu, 14 Aug 2014 23:24:34 +0000 (01:24 +0200)
committerRichard Levitte <levitte@openssl.org>
Wed, 3 Sep 2014 20:26:24 +0000 (22:26 +0200)
string returns 0 with errno = ENOENT.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 360928b7d0f16dde70e26841bbf9e1af727e8b8f)

crypto/LPdir_vms.c
crypto/LPdir_win.c

index 85b427a623b6728c77e69e5b8826349ac8cd7d69..d3ea7ff10a3093c4e90e036b304134d570ee8a30 100644 (file)
@@ -1,4 +1,3 @@
-/* $LP: LPlib/source/LPdir_vms.c,v 1.20 2004/08/26 13:36:05 _cvs_levitte Exp $ */
 /*
  * Copyright (c) 2004, Richard Levitte <richard@levitte.org>
  * All rights reserved.
@@ -82,6 +81,12 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
       size_t filespeclen = strlen(directory);
       char *filespec = NULL;
 
+      if (filespeclen == 0)
+       {
+         errno = ENOENT;
+         return 0;
+       }
+
       /* MUST be a VMS directory specification!  Let's estimate if it is. */
       if (directory[filespeclen-1] != ']'
          && directory[filespeclen-1] != '>'
index 8f7050f1e59e106844d02b6b5a23e315809ec55e..a202bcddf5094aa36149c0d55dbad06cc3dcddf2 100644 (file)
@@ -68,6 +68,12 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory)
       char *extdirbuf = NULL;
       size_t dirlen = strlen (directory);
 
+      if (dirlen == 0)
+       {
+         errno = ENOENT;
+         return 0;
+       }
+
       *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX));
       if (*ctx == NULL)
        {