2000-01-29 Ulrich Drepper <drepper@redhat.com>
+ * locale/programs/ld-numeric.c (numeric_output): Increment cnt in
+ correct place to avoid uninitialized memory passed to writev.
+
* locale/programs/ld-monetary.c (STR_ELEM_WC): Fix test for too
long string in definition.Only enable returning wide character
strings if really needed.
}
}
-#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
!= "". */
%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");
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;
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));