pgsql: Null-terminate the output buffer of LZ4Stream_gets
pgsql: Null-terminate the output buffer of LZ4Stream_gets
От:
Tomas Vondra <tomas.vondra@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 Reported-by: Alexander Lakhin 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(-)
Re: pgsql: Null-terminate the output buffer of LZ4Stream_gets
От:
Thom Brown <thom@linux.com>
Дата:
On Wed, 17 May 2023 at 15:38, Tomas Vondra 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 > Reported-by: Alexander Lakhin > 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