Bug#419529: closed by Mike Hommey <glandium at debian.org> (Bug#419529: fixed in nss 3.11.7-1)

Samuel Thibault samuel.thibault at ens-lyon.org
Sun Jul 1 18:48:51 UTC 2007


reopen 419529
thanks

Hi,

There is still an occurence of MAXPATHLEN, see attached patch for fixing
it into a unlimited length loop.

Samuel
-------------- next part --------------
--- 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);


More information about the pkg-mozilla-maintainers mailing list