From: Gary V. Vaughan Date: Fri, 6 Apr 2001 00:16:05 +0000 (+0000) Subject: * libltdl/ltdl.c (lt_dlopen): When reading the .la file, X-Git-Tag: multi-language-merge-point~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b24be60adeaad6bb72eef7ac72a2b25456e9f548;p=thirdparty%2Flibtool.git * 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 --- diff --git a/ChangeLog b/ChangeLog index 303bf3269..5804e4d72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2001-04-05 Gary V. Vaughan + * 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 + * NEWS (1.3d) Removed bogus ltconfig reference. 2001-03-23 Robert Boehne diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index ee7cc3f02..0855af3a4 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -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;