Re: [PATCH] Fix off-by-one in PQprintTuples()

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Xi Wang <xi(dot)wang(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Fix off-by-one in PQprintTuples()
Date: 2013-01-20 15:48:30
Message-ID: 20130120154829.GM16126@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Xi Wang (xi(dot)wang(at)gmail(dot)com) wrote:
> Don't write past the end of tborder; the size is width + 1.

This whole block of code is woefully without any comments. :(

Strictly speaking, it's this:

tborder[i] = '\0';

Which ends up writing past the end of the buffer (which is allocated as
'width + 1'). Perhaps we should also change that to be:

tborder[width] = '\0';

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-01-20 15:53:18 Re: allowing privileges on untrusted languages
Previous Message Stephen Frost 2013-01-20 15:39:53 Re: [PATCH] Fix NULL checking in check_TSCurrentConfig()