pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthias Apitz <guru@unixarea.de>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16200: ESQL/C FETCH of CHAR data delivers to much data for UTF-8
Date: Fri, 10 Jan 2020 12:55:39 +0100
Message-ID: <20200110115539.GA426730@sh4-5.1blu.de> (raw)


The following change solves our problem:

postgresql-11.4/src/interfaces/ecpg> diff ecpglib/data.c ecpglib/data.c.orig          
527,531c527
<                                                       /* guru@unixarea.de: strncpy() only varcharsize-1 */
<                                                       strncpy(str, pval, varcharsize-1);
<                                                       /* guru@unixarea.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@unixarea.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!





Message-ID: <20200110115539.GA426730@sh4-5.1blu.de>
Permalink:  ../20200110115539.GA426730@sh4-5.1blu.de/
Also on:    postgresql.org/message-id/20200110115539.GA426730@sh4-5.1blu.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: guru@unixarea.de
  Subject: Re: BUG #16200: ESQL/C FETCH of CHAR data delivers to much data for UTF-8
  In-Reply-To: <20200110115539.GA426730@sh4-5.1blu.de>
  References: <20200110115539.GA426730@sh4-5.1blu.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox