bn/bn_exp.c: constant-time MOD_EXP_CTIME_COPY_FROM_PREBUF.
[openssl.git] / apps / rehash.c
index dbaea1048901c365743783669f86594ec89763ed..38084a247fb854601144a38569a33193afb923a2 100644 (file)
@@ -74,6 +74,9 @@
 # include <openssl/x509.h>
 
 
+# ifndef NAME_MAX
+#  define NAME_MAX 255
+# endif
 # define MAX_COLLISIONS  256
 
 typedef struct hentry_st {
@@ -172,7 +175,7 @@ static int add_entry(enum Type type, unsigned int hash, const char *filename,
         ep = app_malloc(sizeof(*ep), "collision bucket");
         *ep = nilhentry;
         ep->old_id = ~0;
-        ep->filename = BUF_strdup(filename);
+        ep->filename = OPENSSL_strdup(filename);
         if (bp->last_entry)
             bp->last_entry->next = ep;
         if (bp->first_entry == NULL)
@@ -319,7 +322,8 @@ static int do_dir(const char *dirname, enum Hash h)
     }
     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);
@@ -464,7 +468,7 @@ int rehash_main(int argc, char **argv)
         while (*argv)
             errs += do_dir(*argv++, h);
     } else if ((env = getenv("SSL_CERT_DIR")) != NULL) {
-        m = BUF_strdup(env);
+        m = OPENSSL_strdup(env);
         for (e = strtok(m, ":"); e != NULL; e = strtok(NULL, ":"))
             errs += do_dir(e, h);
         OPENSSL_free(m);