Hi,

Samuel Thibault, le Sun 01 Jul 2007 20:48:51 +0200, a écrit :
> reopen 419529
> thanks
> 
> There is still an occurence of MAXPATHLEN, see attached patch for fixing
> it into a unlimited length loop.

Could you please apply that patch?  I've tested it, it does really work,
and is needed for the nss package to build on hurd-i386 (and unblock a
big bunch of other packages just waiting for this).

Samuel
--- mozilla/security/nss/cmd/shlibsign/shlibsign.c.orig 2007-07-01 
18:24:59.795073000 +0000
+++ mozilla/security/nss/cmd/shlibsign/shlibsign.c      2007-07-01 
18:33:55.544039000 +0000
@@ -164,7 +164,6 @@
 #ifdef USES_LINKS
     int ret;
     struct stat stat_buf;
-    char link_buf[MAXPATHLEN+1];
     char *link_file = NULL;
 #endif
 
@@ -271,10 +270,22 @@
     }
     if (S_ISLNK(stat_buf.st_mode)) {
        char *dirpath,*dirend;
-       ret = readlink(input_file, link_buf, sizeof(link_buf) - 1);
-       if (ret < 0) {
-          perror(input_file);
-          goto loser;
+       char *link_buf = NULL;
+       size_t size = 64;
+       while (1) {
+           link_buf = realloc(link_buf, size);
+           if (!link_buf) {
+              perror(input_file);
+              goto loser;
+           }
+           ret = readlink(input_file, link_buf, size - 1);
+           if (ret < 0) {
+              perror(input_file);
+              goto loser;
+           }
+           if (ret < size - 1)
+               break;
+           size *= 2;
        }
        link_buf[ret] = 0;
        link_file = mkoutput(input_file);

Reply via email to