]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.c (try_dlopen): Avoid a strlen. When reading .la
authorDirk Mueller <dmueller@suse.de>
Wed, 15 Aug 2007 21:39:26 +0000 (21:39 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 15 Aug 2007 21:39:26 +0000 (21:39 +0000)
files, cope with files that are not newline-terminated.

ChangeLog
libltdl/ltdl.c

index 1631d91801b804a901b77c3048b70308bc5a19d7..555438542a8e6fca91e0bee31b95409995ce3bfc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-08-15  Dirk Mueller  <dmueller@suse.de>  (tiny change)
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * libltdl/ltdl.c (try_dlopen): Avoid a strlen.  When reading .la
+       files, cope with files that are not newline-terminated.
+
 2007-08-05  Tilman Koschnick  <til@subnetz.org>  (tiny change)
 
        * libtool.m4 (_LT_AC_LANG_CXX_CONFIG)
index bd88414df5384ca1591db00a7c7f25c7017e8f62..d449a55fb71dea641efa41966fb3251f6b985d61 100644 (file)
@@ -3249,16 +3249,19 @@ try_dlopen (phandle, filename)
       /* read the .la file */
       while (!feof (file))
        {
+         line[line_len-2] = '\0';
          if (!fgets (line, (int) 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[LT_STRLEN(line) -1] != '\n') && (!feof (file)))
+            that is longer than the initial buffer size.
+            Behave even if the file contains NUL bytes due to corruption. */
+         while (line[line_len-2] != '\0' && line[line_len-2] != '\n' && !feof (file))
            {
              line = LT_DLREALLOC (char, line, line_len *2);
+             line[line_len*2 - 2] = '\0';
              if (!fgets (&line[line_len -1], (int) line_len +1, file))
                {
                  break;