From 720981169b1939283e906c85eada83415e7944a0 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 2 Jan 2009 19:28:55 +0000 Subject: * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Create temporary state object if no output is written. --- ChangeLog | 3 +++ wcsmbs/wcsnrtombs.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index a7e2db017e..450a5b6092 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-01-02 Ulrich Drepper + * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Create temporary state object + if no output is written. + * version.h: Bump to 2.10 development. * posix/getconf.c: Update copyright year. diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c index 171fc3c227..eead26fb3c 100644 --- a/wcsmbs/wcsnrtombs.c +++ b/wcsmbs/wcsnrtombs.c @@ -77,10 +77,14 @@ __wcsnrtombs (dst, src, nwc, len, ps) /* We have to handle DST == NULL special. */ if (dst == NULL) { + mbstate_t temp_state; unsigned char buf[256]; /* Just an arbitrary value. */ const unsigned char *inbuf = (const unsigned char *) *src; size_t dummy; + temp_state = *data.__statep; + data.__statep = &temp_state; + result = 0; data.__outbufend = buf + sizeof (buf); -- cgit v1.2.3