Null-terminate the output buffer of LZ4Stream_gets
authorTomas Vondra <tomas.vondra@postgresql.org>
Wed, 17 May 2023 14:35:17 +0000 (16:35 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Wed, 17 May 2023 14:35:30 +0000 (16:35 +0200)
commit3c18d90f8907e53c3021fca13ad046133c480e4d
tree20fd76988ae4f52c1669321e4bb81b123314915f
parentd8c3106bb60e4f87be595f241e173ba3c2b7aa2c
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
src/bin/pg_dump/compress_lz4.c