From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix ld-time.c
Date: Thu, 11 May 2006 15:04:00 -0000 [thread overview]
Message-ID: <20060511150440.GM4651@sunsite.mff.cuni.cz> (raw)
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 <jakub@redhat.com>
* 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
next reply other threads:[~2006-05-11 15:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-11 15:04 Jakub Jelinek [this message]
2006-05-11 16:48 ` Ulrich Drepper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060511150440.GM4651@sunsite.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).