summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorna195498 <none@none>2006-09-06 12:34:42 -0700
committerna195498 <none@none>2006-09-06 12:34:42 -0700
commitccfce1d8e7219e7616d8df1e8cfca8f97febf5b8 (patch)
tree62ce12c61fc22109525a5e4624e3ed905870cbdf
parentc64027834c5ffc60c557c2b12555e0cd4d30320c (diff)
downloadillumos-gate-ccfce1d8e7219e7616d8df1e8cfca8f97febf5b8.tar.gz
6297074 gmsgfmt may cause SEGV if an entry of the header does not end with "\n"
6419809 msgfmt cmd Makefile fails to remove automatically generated files
-rw-r--r--usr/src/cmd/msgfmt/Makefile9
-rw-r--r--usr/src/cmd/msgfmt/gnu_handle.c20
2 files changed, 15 insertions, 14 deletions
diff --git a/usr/src/cmd/msgfmt/Makefile b/usr/src/cmd/msgfmt/Makefile
index 88d67dfec5..0cd1e997b0 100644
--- a/usr/src/cmd/msgfmt/Makefile
+++ b/usr/src/cmd/msgfmt/Makefile
@@ -2,9 +2,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
@@ -97,7 +96,7 @@ install: all $(ROOTBINPROG) $(ROOTLIBPROG)
clean:
$(RM) $(SOBJS) $(GOBJS) $(YOBJS) $(COBJS) \
$(XOBJS) $(LXOBJS) $(BOBJS) $(LOBJS) \
- $(POFILE) $(POFILES) gnu_po.c y.tab.h
+ $(POFILE) $(POFILES) gnu_po.c y.tab.h xgettext.lx.c
lint: gnu_po.c y.tab.h
$(LINT.c) $(SOBJS:%.o=%.c) $(COBJS:%.o=%.c) $(LDLIBS)
diff --git a/usr/src/cmd/msgfmt/gnu_handle.c b/usr/src/cmd/msgfmt/gnu_handle.c
index 7ff40022e8..44f1086702 100644
--- a/usr/src/cmd/msgfmt/gnu_handle.c
+++ b/usr/src/cmd/msgfmt/gnu_handle.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -430,11 +429,14 @@ handle_message(struct entry *id, struct entry *str)
conv_init(NULL);
} else {
charset += CHARSET_LEN;
- p = charset;
- while ((*p != ' ') && (*p != '\t') &&
- (*p != '\n'))
- p++;
- len = p - charset;
+ p = strpbrk(charset, " \t\n");
+ if (p != NULL) {
+ /* p points to a space, tab or new line char */
+ len = p - charset;
+ } else {
+ /* not found */
+ len = strlen(charset);
+ }
tmp = Xmalloc(len + 1);
(void) memcpy(tmp, charset, len);
*(tmp + len) = '\0';