From: Dirk Mueller Date: Wed, 15 Aug 2007 21:39:26 +0000 (+0000) Subject: * libltdl/ltdl.c (try_dlopen): Avoid a strlen. When reading .la X-Git-Tag: release-1-5-26~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=58c29bcbcee8b494413e454b17d4928d56cf36fc;p=thirdparty%2Flibtool.git * libltdl/ltdl.c (try_dlopen): Avoid a strlen. When reading .la files, cope with files that are not newline-terminated. --- diff --git a/ChangeLog b/ChangeLog index 1631d9180..555438542 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-08-15 Dirk Mueller (tiny change) + Ralf Wildenhues + + * 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 (tiny change) * libtool.m4 (_LT_AC_LANG_CXX_CONFIG) diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index bd88414df..d449a55fb 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -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;