]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.c (lt_dlopen): When reading the .la file,
authorGary V. Vaughan <gary@gnu.org>
Fri, 6 Apr 2001 00:16:05 +0000 (00:16 +0000)
committerGary V. Vaughan <gary@gnu.org>
Fri, 6 Apr 2001 00:16:05 +0000 (00:16 +0000)
reallocate the line buffer size if the line overflows the
original buffer.
Reported by Nick Hudson <skrll@netbsd.org>

ChangeLog
libltdl/ltdl.c

index 303bf32696907c1c4bb2580d815d1045cc2dec8a..5804e4d723abc802f000072f679b6df8a2420c7b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2001-04-05  Gary V. Vaughan  <gvv@techie.com>
 
+       * libltdl/ltdl.c (lt_dlopen):  When reading the .la file,
+       reallocate the line buffer size if the line overflows the
+       original buffer.
+       Reported by Nick Hudson <skrll@netbsd.org>
+
        * NEWS (1.3d) Removed bogus ltconfig reference.
 
 2001-03-23  Robert Boehne  <rboehne@ricardo-us.com>
index ee7cc3f022c9d3da0db158504b3c10480514ff6f..0855af3a4031d30ac98096576f7c4a47bbe898f4 100644 (file)
@@ -2121,7 +2121,8 @@ lt_dlopen (filename)
        goto cleanup;
       }
 
-    line = LT_DLMALLOC (char, LT_FILENAME_MAX);
+    line_len = LT_FILENAME_MAX;
+    line = LT_DLMALLOC (char, line_len);
     if (!line)
       {
        fclose (file);
@@ -2133,11 +2134,24 @@ lt_dlopen (filename)
     /* read the .la file */
     while (!feof(file))
       {
-       if (!fgets (line, LT_FILENAME_MAX, file))
+       if (!fgets (line, line_len, file))
          {
            break;
          }
 
+
+       /* Handle the case where we occasionally need to read a line 
+          that is longer than the initial buffer size.  */
+       while (line[strlen(line) -1] != '\n')
+         {
+           line = LT_DLREALLOC (char, line, line_len *2);
+           if (!fgets (&line[line_len -1], line_len +1, file))
+             {
+               break;
+             }
+           line_len *= 2;
+         }
+
        if (line[0] == '\n' || line[0] == '#')
          {
            continue;