pgsql: Avoid unnecessary use of strncpy in a couple of places in ecpg.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid unnecessary use of strncpy in a couple of places in ecpg.
Date: 2018-06-16 18:59:01
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid unnecessary use of strncpy in a couple of places in ecpg.

Use of strncpy with a length limit based on the source, rather than
the destination, is non-idiomatic and draws warnings from gcc 8.
Replace with memcpy, which does exactly the same thing in these cases,
but with less chance for confusion.

Backpatch to all supported branches.

Discussion: https://postgr.es/m/[email protected]

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8c924855456eff392391eba49cb02ae581a12898

Modified Files
--------------
src/interfaces/ecpg/ecpglib/descriptor.c | 2 +-
src/interfaces/ecpg/pgtypeslib/common.c | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-06-16 19:34:30 pgsql: Use -Wno-format-truncation and -Wno-stringop-truncation, if avai
Previous Message Tom Lane 2018-06-16 18:11:19 pgsql: Fix some minor error-checking oversights in ParseFuncOrColumn().