(__gconv_open): Initialize outbufend element.
authordrepper <drepper>
Tue, 21 Apr 1998 18:04:58 +0000 (18:04 +0000)
committerdrepper <drepper>
Tue, 21 Apr 1998 18:04:58 +0000 (18:04 +0000)
iconv/gconv_open.c

index 831794f..d7e0191 100644 (file)
@@ -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;
                    }
                }
            }