From: Gary V. Vaughan Date: Thu, 16 Aug 2001 00:48:52 +0000 (+0000) Subject: * libltdl/ltdl.c (argz_create_sep): Don't forget to include the X-Git-Tag: release-1-4d~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63ad459714792f323df72e87e4715ba8d7f69979;p=thirdparty%2Flibtool.git * libltdl/ltdl.c (argz_create_sep): Don't forget to include the terminating '0' when counting argz_len. (argz_create_sep): When canonicalizing argz, don't forget to copy the terminating '0', incase canonicalization has shortened argz. (argz_stringify): Don't covert the final '0' to a separator. --- diff --git a/ChangeLog b/ChangeLog index c7221f9d5..cdf4d61a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-08-16 Gary V. Vaughan + + * libltdl/ltdl.c (argz_create_sep): Don't forget to include the + terminating '\0' when counting argz_len. + (argz_create_sep): When canonicalizing argz, don't forget to copy + the terminating '\0', incase canonicalization has shortened argz. + (argz_stringify): Don't covert the final '\0' to a separator. + 2001-08-15 Gary V. Vaughan * libltdl/ltdl.c (lt_dlhandle_next): Now we can loop through all diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index ac6f23c5d..55dbc2e44 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -451,13 +451,13 @@ argz_create_sep (str, delim, pargz, pargz_len) /* Make a copy of STR, but replacing each occurence of DELIM with '\0'. */ - argz_len = LT_STRLEN (str); + argz_len = 1+ LT_STRLEN (str); if (argz_len) { const char *p; char *q; - argz = LT_DLMALLOC (char, 1+ argz_len); + argz = LT_DLMALLOC (char, argz_len); if (!argz) return ENOMEM; @@ -475,6 +475,8 @@ argz_create_sep (str, delim, pargz, pargz_len) else *q++ = *p; } + /* Copy terminating LT_EOS_CHAR. */ + *q = *p; } /* If ARGZ_LEN has shrunk to nothing, release ARGZ's memory. */ @@ -613,7 +615,8 @@ argz_stringify (argz, argz_len, sep) if (sep) { - while (--argz_len >= 0) + --argz_len; /* don't stringify the terminating EOS */ + while (--argz_len > 0) { if (argz[argz_len] == LT_EOS_CHAR) argz[argz_len] = sep;