From f00ebd7f811ac03665c877846cad3750b0815122 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 26 Jan 2000 01:34:13 +0000 Subject: [PATCH] Update. 2000-01-25 Ulrich Drepper * string/argz-stringify.c: Handle case of missing \0 at the end of the given argz. --- ChangeLog | 5 +++++ string/argz-stringify.c | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a83f18a..3a5559d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-01-25 Ulrich Drepper + + * string/argz-stringify.c: Handle case of missing \0 at the end of + the given argz. + 2000-01-24 Ulrich Drepper * nscd/hstcache.c: Don't count in mapped IPv6 addresses in total diff --git a/string/argz-stringify.c b/string/argz-stringify.c index cd57b98..0bbc807 100644 --- a/string/argz-stringify.c +++ b/string/argz-stringify.c @@ -1,5 +1,5 @@ /* 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. Written by Miles Bader @@ -26,13 +26,16 @@ void __argz_stringify (char *argz, size_t len, int sep) { - while (len > 0) - { - size_t part_len = strlen (argz); - argz += part_len; - len -= part_len + 1; - if (len > 0) + if (len > 0) + do + { + size_t part_len = strnlen (argz, len); + argz += part_len; + len -= part_len; + if (len == 0) + break; *argz++ = sep; - } + } + while (--len > 0); } weak_alias (__argz_stringify, argz_stringify) -- 2.7.4