pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: hlinnaka@iki.fi
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14468: One byte buffer overlow in quote_literal_cstr()
Date: Fri, 16 Dec 2016 11:43:51 -0300
Message-ID: <20161216144351.apdbuk4je5ywekle@alvherre.pgsql> (raw)
In-Reply-To: <20161216105001.13334.42819@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

hlinnaka@iki.fi wrote:

> Looking at quote_literal_cstr(), it simply doesn't take into account the
> space needed for the NULL terminator, when it allocates the buffer. The fix
> is a straightforward + 1 to the allocation. I'll go and do that shortly, and
> backpatch.

Hm, that's a bit confusing.  I thought the +3 included the terminator,
but what it's actually for is the optional starting E; and the reason
quote_literal doesn't need similar patching it is that there is no
terminator 'cause it produces varlena.  I would think this deserves a
comment ...

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)

Message-ID: <20161216144351.apdbuk4je5ywekle@alvherre.pgsql>
Permalink:  ../20161216144351.apdbuk4je5ywekle@alvherre.pgsql/
Also on:    postgresql.org/message-id/20161216144351.apdbuk4je5ywekle@alvherre.pgsql

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, hlinnaka@iki.fi
  Subject: Re: BUG #14468: One byte buffer overlow in quote_literal_cstr()
  In-Reply-To: <20161216144351.apdbuk4je5ywekle@alvherre.pgsql>

* 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