pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: mengfanjun <meng_fan_jun@foxmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Call pstrdup() of palloc.h will change source string, please help!
Date: Sat, 04 Jun 2022 13:05:29 -0400
Message-ID: <574740.1654362329@sss.pgh.pa.us> (raw)
In-Reply-To: <tencent_755B695BF291AADC410AF2D15D2114B36206@qq.com>
References: <tencent_755B695BF291AADC410AF2D15D2114B36206@qq.com>

"=?ISO-8859-1?B?bWVuZ2Zhbmp1bg==?=" <meng_fan_jun@foxmail.com> writes:
> pstrdup() will change source "system_time( stt , ett )" to "system_time( stt " and return "system_time( stt " when it is called in ValidateForeignTableOptions() and CStoreGetOptions().

That claim is not very credible.  I'm not sure where the bug is in this
code, but the chance that it's in pstrdup is frankly zero.

According to the man page for strsep(), that function modifies the string
pointed to by its first argument.  I suspect you're failing to account
for that.  I'm also suspicious of the "// trim" code, which will misbehave
for a zero-length token.

			regards, tom lane





view thread (2+ messages)

Message-ID: <574740.1654362329@sss.pgh.pa.us>
Permalink:  ../574740.1654362329@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/574740.1654362329@sss.pgh.pa.us

 · 

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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, meng_fan_jun@foxmail.com
  Subject: Re: Call pstrdup() of palloc.h will change source string, please help!
  In-Reply-To: <574740.1654362329@sss.pgh.pa.us>
  References: <tencent_755B695BF291AADC410AF2D15D2114B36206@qq.com> <574740.1654362329@sss.pgh.pa.us>

* 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