GH408 follow-on: update buflen
authorAlessandro Ghedini <alessandro@ghedini.me>
Fri, 25 Sep 2015 17:51:27 +0000 (13:51 -0400)
committerRich Salz <rsalz@openssl.org>
Sat, 26 Sep 2015 00:22:27 +0000 (20:22 -0400)
Some builds break, as documented in:
  https://github.com/openssl/openssl/pull/408#issuecomment-142971427
This fixes it.

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
apps/rehash.c

index dbaea1048901c365743783669f86594ec89763ed..e85265d1e6ba758af57a1d25bbc9adec546390af 100644 (file)
@@ -74,6 +74,9 @@
 # include <openssl/x509.h>
 
 
 # include <openssl/x509.h>
 
 
+# ifndef NAME_MAX
+#  define NAME_MAX 255
+# endif
 # define MAX_COLLISIONS  256
 
 typedef struct hentry_st {
 # define MAX_COLLISIONS  256
 
 typedef struct hentry_st {
@@ -319,7 +322,8 @@ static int do_dir(const char *dirname, enum Hash h)
     }
     buflen = strlen(dirname);
     pathsep = (buflen && dirname[buflen - 1] == '/') ? "" : "/";
     }
     buflen = strlen(dirname);
     pathsep = (buflen && dirname[buflen - 1] == '/') ? "" : "/";
-    buf = app_malloc(PATH_MAX, "filename buffer");
+    buflen += NAME_MAX + 1 + 1;
+    buf = app_malloc(buflen, "filename buffer");
 
     if (verbose)
         BIO_printf(bio_out, "Doing %s\n", dirname);
 
     if (verbose)
         BIO_printf(bio_out, "Doing %s\n", dirname);