From 0e57eec1851cb02f60b1f8abfc9ffa291fa9ecae Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 27 Jan 1999 07:41:15 +0000 Subject: [PATCH] * libltdl/ltdl.c (find_file): fix endless loop condition (find_module): filename allocation was off by 1 --- ChangeLog | 3 +++ libltdl/ltdl.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a42eb6e9e..73083ce17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 1999-01-27 Alexandre Oliva + * 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 diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index a611f2b70..0e63cce09 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -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 -- 2.47.3