Re: BUG #16200: ESQL/C FETCH of CHAR data delivers to much data for UTF-8

From: Matthias Apitz <guru(at)unixarea(dot)de>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16200: ESQL/C FETCH of CHAR data delivers to much data for UTF-8
Date: 2020-01-10 11:55:39
Message-ID: 20200110115539.GA426730@sh4-5.1blu.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following change solves our problem:

postgresql-11.4/src/interfaces/ecpg> diff ecpglib/data.c ecpglib/data.c.orig
527,531c527
< /* guru(at)unixarea(dot)de: strncpy() only varcharsize-1 */
< strncpy(str, pval, varcharsize-1);
< /* guru(at)unixarea(dot)de: and terminate the string */
< str[varcharsize - 1] = '\0';
< ecpg_log("DEBUG ESQL/C: result [%s] len %d\n", str, strlen(str));
---
> strncpy(str, pval, varcharsize);

--
Matthias Apitz, ✉ guru(at)unixarea(dot)de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!

Browse pgsql-bugs by date

  From Date Subject
Next Message Mahendra Singh Thalor 2020-01-10 12:24:21 Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema
Previous Message Etsuro Fujita 2020-01-10 11:20:43 Re: BUG #16201: Second column in Range Partition is scanning all the partitions