]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
TEST: Fix path length in test/ossl_store_test.c
authorRichard Levitte <levitte@openssl.org>
Fri, 27 Nov 2020 07:08:08 +0000 (08:08 +0100)
committerRichard Levitte <levitte@openssl.org>
Sat, 28 Nov 2020 20:19:18 +0000 (21:19 +0100)
The URI length was set to 80 chars, but the URI being built up may
need more space, all depending on the paths used to get to the files
that are to be loaded.  If the result needs more than 80 chars, the
test will fail.

Fixed by using PATH_MAX.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13546)

test/ossl_store_test.c

index e1ee8200859e0f25f10dae62c42b58db9311f509..f48c282b2e938898697e56df9b8e357d98e82979 100644 (file)
@@ -7,10 +7,19 @@
  * https://www.openssl.org/source/license.html
  */
 
+#include <limits.h>
 #include <openssl/store.h>
 #include <openssl/ui.h>
 #include "testutil.h"
 
+#ifndef PATH_MAX
+# if defined(_WIN32) && defined(_MAX_PATH)
+#  define PATH_MAX _MAX_PATH
+# else
+#  define PATH_MAX 4096
+# endif
+#endif
+
 typedef enum OPTION_choice {
     OPT_ERR = -1,
     OPT_EOF = 0,
@@ -85,7 +94,7 @@ static int get_params(const char *uri, const char *type)
 static int test_store_get_params(int idx)
 {
     const char *type;
-    char uri[80];
+    char uri[PATH_MAX];
 
     switch(idx) {
 #ifndef OPENSSL_NO_DH