pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Null-terminate the output buffer of LZ4Stream_gets
2+ messages / 2 participants
[nested] [flat]

* pgsql: Null-terminate the output buffer of LZ4Stream_gets
@ 2023-05-17 14:37 Tomas Vondra <tomas.vondra@postgresql.org>
  2023-05-17 14:58 ` Re: pgsql: Null-terminate the output buffer of LZ4Stream_gets Thom Brown <thom@linux.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Tomas Vondra @ 2023-05-17 14:37 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Null-terminate the output buffer of LZ4Stream_gets

LZ4Stream_gets did not null-terminate its output buffer. The callers expected
the buffer to be null-terminated and passed it around to functions such as
sscanf with unintended consequences.

Author: Georgios Kokolatos <gkokolatos@pm.me>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/94ae9bca-5ebb-1e68-bb7b-4f32e89fefbe@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3c18d90f8907e53c3021fca13ad046133c480e4d

Modified Files
--------------
src/bin/pg_dump/compress_lz4.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: Null-terminate the output buffer of LZ4Stream_gets
  2023-05-17 14:37 pgsql: Null-terminate the output buffer of LZ4Stream_gets Tomas Vondra <tomas.vondra@postgresql.org>
@ 2023-05-17 14:58 ` Thom Brown <thom@linux.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Thom Brown @ 2023-05-17 14:58 UTC (permalink / raw)
  To: Tomas Vondra <tomas.vondra@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

On Wed, 17 May 2023 at 15:38, Tomas Vondra <tomas.vondra@postgresql.org> wrote:
>
> Null-terminate the output buffer of LZ4Stream_gets
>
> LZ4Stream_gets did not null-terminate its output buffer. The callers expected
> the buffer to be null-terminated and passed it around to functions such as
> sscanf with unintended consequences.
>
> Author: Georgios Kokolatos <gkokolatos@pm.me>
> Reported-by: Alexander Lakhin <exclusion@gmail.com>
> Discussion: https://postgr.es/m/94ae9bca-5ebb-1e68-bb7b-4f32e89fefbe@gmail.com
>
> Branch
> ------
> master
>
> Details
> -------
> https://git.postgresql.org/pg/commitdiff/3c18d90f8907e53c3021fca13ad046133c480e4d
>
> Modified Files
> --------------
> src/bin/pg_dump/compress_lz4.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
Forgive the noise, but how is ptr[ret - 1] = '\0' not overwriting the
last character?

Thom





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-05-17 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 14:37 pgsql: Null-terminate the output buffer of LZ4Stream_gets Tomas Vondra <tomas.vondra@postgresql.org>
2023-05-17 14:58 ` Thom Brown <thom@linux.com>

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