Hi,

Attached there is a better (working) version of the patch for the reported 
issue. Sorry for the wrong patch sent previously.

Thanks,
-- 
Pino Toscano
--- a/tests/tst-dlopen.c
+++ b/tests/tst-dlopen.c
@@ -15,6 +15,7 @@
 #include <stdio.h>
 #include <limits.h>
 #include <sys/stat.h>
+#include <string.h>
 
 /* Simple program to see if dlopen() would succeed. */
 int main(int argc, char **argv)
@@ -24,22 +25,28 @@
 #else
   int i;
   struct stat st;
-  char buf[PATH_MAX];
+  char *buf;
+  size_t buf_len;
 
   for (i = 1; i < argc; i++) {
     if (dlopen(argv[i], RTLD_NOW)) {
       fprintf(stdout, "dlopen() of \"%s\" succeeded.\n",
               argv[i]);
     } else {
-      snprintf(buf, sizeof(buf), "./%s", argv[i]);
+      buf_len = strlen(argv[i]) + 3;
+      buf = malloc(buf_len);
+      snprintf(buf, buf_len, "./%s", argv[i]);
       if ((stat(buf, &st) == 0) && dlopen(buf, RTLD_NOW)) {
         fprintf(stdout, "dlopen() of \"./%s\" "
                 "succeeded.\n", argv[i]);
       } else {
         fprintf(stdout, "dlopen() of \"%s\" failed: "
                 "%s\n", argv[i], dlerror());
+        free(buf);
         return 1;
       }
+      free(buf);
+      buf = NULL;
     }
   }
   return 0;

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to