* 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.
This commit is contained in:
Gary V. Vaughan 2001-08-16 00:48:52 +00:00
parent 196a286bc6
commit 63ad459714
2 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2001-08-16 Gary V. Vaughan <gary@gnu.org>
* 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 <gary@gnu.org>
* libltdl/ltdl.c (lt_dlhandle_next): Now we can loop through all

View File

@ -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;