* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.19 2009/01/29 19:23:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.20 2009/02/28 18:49:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
CHECK_ENCODING_CONVERSION_ARGS(PG_KOI8R, PG_WIN1251);
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
koi8r2mic(src, buf, len);
mic2win1251(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_WIN1251, PG_KOI8R);
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
win12512mic(src, buf, len);
mic2koi8r(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_KOI8R, PG_WIN866);
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
koi8r2mic(src, buf, len);
mic2win866(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_WIN866, PG_KOI8R);
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
win8662mic(src, buf, len);
mic2koi8r(buf, dest, strlen((char *) buf));
pfree(buf);
* not in KOI8R. As we use MULE_INTERNAL/KOI8R as an intermediary, we
* will fail to convert those characters.
*/
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
win8662mic(src, buf, len);
mic2win1251(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_WIN1251, PG_WIN866);
/* Use mic/KOI8R as intermediary, see comment in win866_to_win1251() */
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
win12512mic(src, buf, len);
mic2win866(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_ISO_8859_5, PG_KOI8R);
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
iso2mic(src, buf, len);
mic2koi8r(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_KOI8R, PG_ISO_8859_5);
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
koi8r2mic(src, buf, len);
mic2iso(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_ISO_8859_5, PG_WIN1251);
/* Use mic/KOI8R as intermediary, see comment in win866_to_win1251() */
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
iso2mic(src, buf, len);
mic2win1251(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_WIN1251, PG_ISO_8859_5);
/* Use mic/KOI8R as intermediary, see comment in win866_to_win1251() */
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
win12512mic(src, buf, len);
mic2iso(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_ISO_8859_5, PG_WIN866);
/* Use mic/KOI8R as intermediary, see comment in win866_to_win1251() */
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
iso2mic(src, buf, len);
mic2win866(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_WIN866, PG_ISO_8859_5);
/* Use mic/KOI8R as intermediary, see comment in win866_to_win1251() */
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
win8662mic(src, buf, len);
mic2iso(buf, dest, strlen((char *) buf));
pfree(buf);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.17 2009/01/29 19:23:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.18 2009/02/28 18:49:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
CHECK_ENCODING_CONVERSION_ARGS(PG_LATIN2, PG_WIN1250);
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
latin22mic(src, buf, len);
mic2win1250(buf, dest, strlen((char *) buf));
pfree(buf);
CHECK_ENCODING_CONVERSION_ARGS(PG_WIN1250, PG_LATIN2);
- buf = palloc(len * ENCODING_GROWTH_RATE);
+ buf = palloc(len * ENCODING_GROWTH_RATE + 1);
win12502mic(src, buf, len);
mic2latin2(buf, dest, strlen((char *) buf));
pfree(buf);