diff options
Diffstat (limited to 'gdb/charset.c')
-rw-r--r-- | gdb/charset.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/charset.c b/gdb/charset.c index fadd232..8a9b5ad 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -167,6 +167,7 @@ iconv (iconv_t utf_flag, const char **inbuf, size_t *inbytesleft, /* In all other cases we simply copy input bytes to the output. */ size_t amt = *inbytesleft; + if (amt > *outbytesleft) amt = *outbytesleft; memcpy (*outbuf, *inbuf, amt); @@ -312,6 +313,7 @@ validate (struct gdbarch *gdbarch) const char *host_cset = host_charset (); const char *target_cset = target_charset (gdbarch); const char *target_wide_cset = target_wide_charset_name; + if (!strcmp (target_wide_cset, "auto")) target_wide_cset = gdbarch_auto_wide_charset (gdbarch); @@ -634,10 +636,10 @@ wchar_iterate (struct wchar_iterator *iter, size_t orig_in = iter->bytes; size_t out_avail = out_request * sizeof (gdb_wchar_t); size_t num; - size_t r = iconv (iter->desc, (ICONV_CONST char **) &iter->input, &iter->bytes, &outptr, &out_avail); + if (r == (size_t) -1) { switch (errno) |