aboutsummaryrefslogtreecommitdiff
path: root/locale/programs
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-29 08:35:47 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-29 08:35:47 +0000
commit6770573aa3190c539932fd0bd56e9b64f95065a5 (patch)
treeb617c1c2237ba5ac7c4ad4e4a05ba4b756060e66 /locale/programs
parent0d54f746e2bff98ede1626e83439789c72232ddc (diff)
downloadglibc-6770573aa3190c539932fd0bd56e9b64f95065a5.tar
glibc-6770573aa3190c539932fd0bd56e9b64f95065a5.tar.gz
glibc-6770573aa3190c539932fd0bd56e9b64f95065a5.tar.bz2
glibc-6770573aa3190c539932fd0bd56e9b64f95065a5.zip
Update.
* locale/programs/ld-numeric.c (numeric_output): Increment cnt in correct place to avoid uninitialized memory passed to writev.
Diffstat (limited to 'locale/programs')
-rw-r--r--locale/programs/ld-numeric.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c
index 37951c8442..017c41fdc2 100644
--- a/locale/programs/ld-numeric.c
+++ b/locale/programs/ld-numeric.c
@@ -104,15 +104,6 @@ numeric_finish (struct localedef_t *locale, struct charmap_t *charmap)
}
}
-#define TEST_ELEM(cat, default) \
- if (numeric->cat == NULL && ! be_quiet && ! nothing) \
- error (0, 0, _("%s: field `%s' not defined"), "LC_NUMERIC", #cat); \
- if (numeric->cat##_wc == L'\0') \
- numeric->cat##_wc = default
-
- TEST_ELEM (decimal_point, L'.');
- TEST_ELEM (thousands_sep, L'\0');
-
/* The decimal point must not be empty. This is not said explicitly
in POSIX but ANSI C (ISO/IEC 9899) says in 4.4.2.1 it has to be
!= "". */
@@ -129,6 +120,8 @@ numeric_finish (struct localedef_t *locale, struct charmap_t *charmap)
%s: value for field `%s' must not be the empty string"),
"LC_NUMERIC", "decimal_point");
}
+ if (numeric->decimal_point_wc == L'\0')
+ numeric->decimal_point_wc = L'.';
if (numeric->grouping_len == 0 && ! be_quiet && ! nothing)
error (0, 0, _("%s: field `%s' not defined"), "LC_NUMERIC", "grouping");
@@ -168,6 +161,7 @@ numeric_output (struct localedef_t *locale, struct charmap_t *charmap,
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = numeric->grouping;
iov[cnt].iov_len = numeric->grouping_len;
+ ++cnt;
idx[cnt - 2] = iov[0].iov_len + iov[1].iov_len;
iov[cnt].iov_base = (void *) &numeric->decimal_point_wc;
@@ -176,8 +170,7 @@ numeric_output (struct localedef_t *locale, struct charmap_t *charmap,
idx[cnt - 2] = idx[cnt - 3] + iov[cnt - 1].iov_len;
iov[cnt].iov_base = (void *) &numeric->thousands_sep_wc;
- iov[cnt].iov_len = sizeof (uint32_t);;
- ++cnt;
+ iov[cnt].iov_len = sizeof (uint32_t);
assert (cnt + 1 == 2 + _NL_ITEM_INDEX (_NL_NUM_LC_NUMERIC));