Re: [PATCH] Fix off-by-one in PQprintTuples() - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: [PATCH] Fix off-by-one in PQprintTuples()
Date
Msg-id 20130120154829.GM16126@tamriel.snowman.net
Whole thread Raw
In response to [PATCH] Fix off-by-one in PQprintTuples()  (Xi Wang <xi.wang@gmail.com>)
Responses Re: [PATCH] Fix off-by-one in PQprintTuples()
List pgsql-hackers
* Xi Wang (xi.wang@gmail.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

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: [PATCH] Fix NULL checking in check_TSCurrentConfig()
Next
From: Tom Lane
Date:
Subject: Re: allowing privileges on untrusted languages