Re: Possible replace of strncpy on xactdesc.c

From: Mario González Troncoso <gonzalemario(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Possible replace of strncpy on xactdesc.c
Date: 2026-07-06 22:31:44
Message-ID: CAFsReFVg--+gp8T_QzKos6aUPZRfOupBz=d=1sHg2wc8KkO_WQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 6 Jul 2026 at 18:26, Mario González Troncoso
<gonzalemario(at)gmail(dot)com> wrote:
>
> On Mon, 6 Jul 2026 at 10:38, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> >
> >
> > As a general rule it's a good idea to replace strncpy with strlcpy.
> >
> > > The other functions that are inside the file already use strlcpy() so
> > > maybe the use of current strncpy() on xactdesc.c is just code that
> > > comes from the refactor itself.
> >
> > It was introduced in 1eb6d6527aae in twophase.c and then moved to xaxtdesc.c in
> > the above mentioned commit.
> >
> > > I'll send a proper patch once some feedback is received but at least
> > > it's compiling and passing local tests.
> >
> > Sounds good, please send a patch.
> >
>
> Great. Sending it now after rebasing from master and passing local
> tests (long live cirrus CI).
>
> I added this to the commitfest as well
> https://commitfest.postgresql.org/patch/6989/
>
> >
>

Hopefully with the patch.

>
> --
> Mario Gonzalez
> EDB: https://www.enterprisedb.com

--
Mario Gonzalez
EDB: https://www.enterprisedb.com

Attachment Content-Type Size
v1-0001-Replace-of-strncpy-on-xactdesc.c.patch text/x-patch 1.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Rachitskiy 2026-07-06 22:41:57 [PATCH] Limit PL/Perl scalar copies to work_mem
Previous Message Michael Paquier 2026-07-06 22:30:32 Re: [PATCH] Don't call ereport(ERROR) from recovery target GUC assign hooks