Re: libpq debug log

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: alvherre(at)alvh(dot)no-ip(dot)org
Cc: iwata(dot)aya(at)fujitsu(dot)com, pgsql-hackers(at)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us, robertmhaas(at)gmail(dot)com, pchampion(at)pivotal(dot)io, jdoty(at)pivotal(dot)io, raam(dot)soft(at)gmail(dot)com, nagaura(dot)ryohei(at)fujitsu(dot)com, nagata(at)sraoss(dot)co(dot)jp, peter(dot)eisentraut(at)2ndquadrant(dot)com, horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp, k(dot)jamison(at)fujitsu(dot)com
Subject: Re: libpq debug log
Date: 2020-10-14 01:18:38
Message-ID: 20201014.101838.398904604376569160.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Fri, 9 Oct 2020 11:48:59 -0300, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote in
> > +pqLogMsgString(PGconn *conn, const char *v, int length, PGCommSource commsource)
> > +{
> > + if (length < 0)
> > + length = strlen(v) + 1;
> > +
>
> > pqLogMsgString(conn, str, -1, FROM_*) means actual length may be
> > different from the caller thinks, but the pqLogLineBreak() subtracts
> > that value from the message length rememberd in in logging_message.
> > Anyway AFAICS the patch doesn't use the code path so we should remove
> > the first two lines.
>
> True, +1 for removing it.
>
> > By the way, appendBinaryPQExpBuffer() enlarges its buffer by the size
> > of the exact length of the given data, but appends '\0' at the end of
> > the copied data. Couldn't that leads to an memory overrun?
>
> Doesn't enlargePQExpBuffer() include room for the trailing zero? I
> think it does.

Right. I faintly recall I said the same thing before..

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-10-14 01:29:44 Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.
Previous Message Kyotaro Horiguchi 2020-10-14 01:15:58 Re: Transactions involving multiple postgres foreign servers, take 2