summaryrefslogtreecommitdiff
path: root/iconv/gconv_open.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconv/gconv_open.c')
-rw-r--r--iconv/gconv_open.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c
index 831794fc22..d7e0191cca 100644
--- a/iconv/gconv_open.c
+++ b/iconv/gconv_open.c
@@ -71,14 +71,16 @@ __gconv_open (const char *toset, const char *fromset, gconv_t *handle)
/* Allocate the buffer. */
if (!data[cnt].is_last)
{
- data[cnt].outbuf =
- (char *) malloc (GCONV_NCHAR_GOAL
- * steps[cnt].max_needed_to);
+ size_t size = (GCONV_NCHAR_GOAL
+ * steps[cnt].max_needed_to);
+
+ data[cnt].outbuf = (char *) malloc (size);
if (data[cnt].outbuf == NULL)
{
res = GCONV_NOMEM;
break;
}
+ data[cnt].outbufend = data[cnt].outbuf + size;
}
}
}