]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.c (find_file): fix endless loop condition
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Wed, 27 Jan 1999 07:41:15 +0000 (07:41 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Wed, 27 Jan 1999 07:41:15 +0000 (07:41 +0000)
(find_module): filename allocation was off by 1

ChangeLog
libltdl/ltdl.c

index a42eb6e9e4c4fa81640789a41abd14be0034217c..73083ce173c2d59da379c7ebe6a5d56916df5636 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 1999-01-27  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
+       * libltdl/ltdl.c (find_file): fix endless loop condition
+       (find_module): filename allocation was off by 1
+
        * libltdl/Makefile.am (distclean-local): renamed from
        distclean-hook, that didn't work
 
index a611f2b700680f4352043951be3734ffa8c01199..0e63cce09ec8dc9699509d97fcfd2a9b0f60e045 100644 (file)
@@ -813,7 +813,7 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
                if (installed && libdir) {
                        int ret;
                        char *filename = (char*)
-                               malloc(strlen(libdir)+1+strlen(dlname));
+                               malloc(strlen(libdir)+1+strlen(dlname)+1);
 
                        if (!filename) {
                                last_error = memory_error;
@@ -832,7 +832,7 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
                        int ret;
                        char *filename = (char*)
                                malloc((dir ? strlen(dir) : 0)
-                                      + strlen(objdir) + strlen(dlname));
+                                      + strlen(objdir) + strlen(dlname) + 1);
                        
                        if (!filename) {
                                last_error = memory_error;
@@ -854,7 +854,7 @@ find_module (handle, dir, libdir, dlname, old_name, installed)
                        int ret;
                        char *filename = (char*)
                                malloc((dir ? strlen(dir) : 0)
-                                      + strlen(dlname));
+                                      + strlen(dlname) + 1);
                        if (dir)
                                strcpy(filename, dir);
                        strcat(filename, dlname);
@@ -880,21 +880,21 @@ find_file (basename, search_path, pdir, handle)
 
        char    *filename = 0;
        int     filenamesize = 0;
-       const char *cur, *next;
+       const char *next = search_path;
        int     lenbase = strlen(basename);
        
-       if (!search_path || !strlen(search_path)) {
+       if (!next || !*next) {
                last_error = file_not_found_error;
                return 0;
        }
-       cur = search_path;
-       while (cur) {
+       while (next) {
                int lendir;
-               
+               const char *cur = next;
+
                next = strchr(cur, ':');
                if (!next)
                        next = cur + strlen(cur);
-               lendir = next - cur + 1;
+               lendir = next - cur;
                if (*next == ':')
                        ++next;
                else