aboutsummaryrefslogtreecommitdiff
path: root/iconv/skeleton.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconv/skeleton.c')
-rw-r--r--iconv/skeleton.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index 1dc642e..1a38b51 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -795,11 +795,13 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
# else
/* Make sure the remaining bytes fit into the state objects
buffer. */
- assert (inend - *inptrp < 4);
+ size_t cnt_after = inend - *inptrp;
+ assert (cnt_after <= sizeof (data->__statep->__value.__wchb));
size_t cnt;
- for (cnt = 0; *inptrp < inend; ++cnt)
- data->__statep->__value.__wchb[cnt] = *(*inptrp)++;
+ for (cnt = 0; cnt < cnt_after; ++cnt)
+ data->__statep->__value.__wchb[cnt] = (*inptrp)[cnt];
+ *inptrp = inend;
data->__statep->__count &= ~7;
data->__statep->__count |= cnt;
# endif