From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7483 invoked by alias); 11 May 2006 15:04:55 -0000 Received: (qmail 7467 invoked by uid 22791); 11 May 2006 15:04:55 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 11 May 2006 15:04:53 +0000 Received: from sunsite.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.1/8.13.1) with ESMTP id k4BF4fah028123; Thu, 11 May 2006 17:04:41 +0200 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.13.1/8.13.1/Submit) id k4BF4fRL028122; Thu, 11 May 2006 17:04:41 +0200 Date: Thu, 11 May 2006 15:04:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Fix ld-time.c Message-ID: <20060511150440.GM4651@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00012.txt.bz2 Hi! wformat and wname fields are used in: iov[2 + cnt].iov_base = (void *) time->era_entries[num].wname; iov[2 + cnt].iov_len = ((wcschr ((wchar_t *) time->era_entries[num].wformat, L'\0') - (wchar_t *) time->era_entries[num].wname + 1) * sizeof (uint32_t)); so, clearly neither should be NULL and both have to be in the same object. The following patch attempts to do whatever we do for narrow name/format (except the verbose warnings), i.e. if at least one of them is unspecified, both are set to empty strings. 2006-05-11 Jakub Jelinek * locale/programs/ld-time.c (time_finish): If wide era name or format aren't provided, set both wname and wformat to L"". --- libc/locale/programs/ld-time.c.jj 2006-05-10 14:03:49.000000000 +0200 +++ libc/locale/programs/ld-time.c 2006-05-11 16:50:11.000000000 +0200 @@ -467,15 +467,22 @@ No definition for %s category found"), " wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */ wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */ wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */ - time->era_entries[idx].wname = (uint32_t *) wstr + 1; if (wstr != NULL) { + time->era_entries[idx].wname = (uint32_t *) wstr + 1; wstr = wcschr (wstr + 1, L':'); /* end name */ - *wstr = L'\0'; - time->era_entries[idx].wformat = (uint32_t *) wstr + 1; + if (wstr != NULL) + { + *wstr = L'\0'; + time->era_entries[idx].wformat = (uint32_t *) wstr + 1; + } + else + time->era_entries[idx].wname = + time->era_entries[idx].wformat = (uint32_t *) L""; } else - time->era_entries[idx].wformat = NULL; + time->era_entries[idx].wname = + time->era_entries[idx].wformat = (uint32_t *) L""; } } Jakub