2000-01-25  Ulrich Drepper  <drepper@cygnus.com>

	* string/argz-stringify.c: Handle case of missing \0 at the end of
	the given argz.
This commit is contained in:
Ulrich Drepper 2000-01-26 01:34:13 +00:00
parent 488fb3c736
commit f00ebd7f81
2 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2000-01-25 Ulrich Drepper <drepper@cygnus.com>
* string/argz-stringify.c: Handle case of missing \0 at the end of
the given argz.
2000-01-24 Ulrich Drepper <drepper@cygnus.com> 2000-01-24 Ulrich Drepper <drepper@cygnus.com>
* nscd/hstcache.c: Don't count in mapped IPv6 addresses in total * nscd/hstcache.c: Don't count in mapped IPv6 addresses in total

View File

@ -1,5 +1,5 @@
/* Routines for dealing with '\0' separated arg vectors. /* Routines for dealing with '\0' separated arg vectors.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu> Written by Miles Bader <miles@gnu.ai.mit.edu>
@ -26,13 +26,16 @@
void void
__argz_stringify (char *argz, size_t len, int sep) __argz_stringify (char *argz, size_t len, int sep)
{ {
while (len > 0) if (len > 0)
{ do
size_t part_len = strlen (argz); {
argz += part_len; size_t part_len = strnlen (argz, len);
len -= part_len + 1; argz += part_len;
if (len > 0) len -= part_len;
if (len == 0)
break;
*argz++ = sep; *argz++ = sep;
} }
while (--len > 0);
} }
weak_alias (__argz_stringify, argz_stringify) weak_alias (__argz_stringify, argz_stringify)