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

ChangeLog
libltdl/ltdl.c

index f8ed662d4008f94cfe8f4a3a51044b4ffe9ab4ab..9ceb6604838799339021efdc7914b3ef4975d9c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-08-15  Dirk Mueller  <dmueller@suse.de>  (tiny change)
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * libltdl/ltdl.c (parse_dotla_file): 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)
 
        * libltdl/m4/libtool.m4 (_LT_COMPILER_PIC, _LT_LANG_CXX_CONFIG)
index 41e9f07996a08ee93aeb529cc796c3c521635fc0..75c7a6e55b0f7b1a14560507fd5a0006ada0a1ba 100644 (file)
@@ -1017,14 +1017,16 @@ parse_dotla_file(FILE *file, char **dlname, char **libdir, char **deplibs,
 
   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 = REALLOC (char, line, line_len *2);
          if (!line)
@@ -1033,6 +1035,7 @@ parse_dotla_file(FILE *file, char **dlname, char **libdir, char **deplibs,
              ++errors;
              goto cleanup;
            }
+         line[line_len * 2 - 2] = '\0';
          if (!fgets (&line[line_len -1], (int) line_len +1, file))
            {
              break;