summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Levitte <richard@levitte.org>2014-08-15 01:24:34 +0200
committerJanusz Kozerski <j.kozerski@samsung.com>2014-10-20 15:26:04 +0200
commit2a7b9aad0b24eb04d183364c7be228ddc6cf918a (patch)
treec68fba60d7722df4a2a723626491dbbb5df2080b
parent0f0551a9d82c253004f396c3f18f41dc430fa2a8 (diff)
downloadopenssl-2a7b9aad0b24eb04d183364c7be228ddc6cf918a.tar.gz
openssl-2a7b9aad0b24eb04d183364c7be228ddc6cf918a.tar.bz2
openssl-2a7b9aad0b24eb04d183364c7be228ddc6cf918a.zip
Followup on RT3334 fix: make sure that a directory that's the empty
string returns 0 with errno = ENOENT. Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 360928b7d0f16dde70e26841bbf9e1af727e8b8f)
-rw-r--r--crypto/LPdir_vms.c7
-rw-r--r--crypto/LPdir_win.c6
2 files changed, 12 insertions, 1 deletions
diff --git a/crypto/LPdir_vms.c b/crypto/LPdir_vms.c
index 7613bd2..3582fa6 100644
--- a/crypto/LPdir_vms.c
+++ b/crypto/LPdir_vms.c
@@ -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.
@@ -88,6 +87,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] != '>'
diff --git a/crypto/LPdir_win.c b/crypto/LPdir_win.c
index 5cdcd00..d5b5e2c 100644
--- a/crypto/LPdir_win.c
+++ b/crypto/LPdir_win.c
@@ -66,6 +66,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)
{