Page MenuHomeFreeBSD

D58496.id.diff
No OneTemporary

D58496.id.diff

diff --git a/usr.bin/localedef/messages.c b/usr.bin/localedef/messages.c
--- a/usr.bin/localedef/messages.c
+++ b/usr.bin/localedef/messages.c
@@ -85,12 +85,15 @@
dump_messages(void)
{
FILE *f;
- char *ptr;
+ char *yesstr, *nostr, *ptr;
+
+ yesstr = nostr = NULL;
if (msgs.yesstr == NULL) {
warn("missing field 'yesstr'");
msgs.yesstr = "";
}
+
if (msgs.nostr == NULL) {
warn("missing field 'nostr'");
msgs.nostr = "";
@@ -100,20 +103,39 @@
* CLDR likes to add : separated lists for yesstr and nostr.
* Legacy Solaris code does not seem to grok this. Fix it.
*/
- if ((ptr = strchr(msgs.yesstr, ':')) != NULL)
+
+ yesstr = strdup(msgs.yesstr);
+ if (yesstr == NULL) {
+ perror("strdup");
+ goto end;
+ }
+ ptr = strchr(yesstr, ':');
+ if (ptr != NULL)
*ptr = 0;
- if ((ptr = strchr(msgs.nostr, ':')) != NULL)
+
+ nostr = strdup(msgs.nostr);
+ if (nostr == NULL) {
+ perror("strdup");
+ goto end;
+ }
+
+ ptr = strchr(nostr, ':');
+ if (ptr != NULL)
*ptr = 0;
if ((f = open_category()) == NULL) {
- return;
+ goto end;
}
if ((putl_category(msgs.yesexpr, f) == EOF) ||
(putl_category(msgs.noexpr, f) == EOF) ||
- (putl_category(msgs.yesstr, f) == EOF) ||
- (putl_category(msgs.nostr, f) == EOF)) {
- return;
+ (putl_category(yesstr, f) == EOF) ||
+ (putl_category(nostr, f) == EOF)) {
+ goto end;
}
close_category(f);
+
+end:
+ free(yesstr);
+ free(nostr);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Sep 2, 7:30 AM (7 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37376293
Default Alt Text
D58496.id.diff (1 KB)

Event Timeline