mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-06 14:36:58 +02:00
Fix undersized result buffer in pset_quoted_string().
The malloc request was 1 byte too small for the worst-case output. This seems relatively unlikely to cause any problems in practice, as the worst case only occurs if the input string contains no characters other than single-quote or newline, and even then malloc alignment padding would probably save the day. But it's definitely a bug. David Rowley
This commit is contained in:
parent
859e2b9dd4
commit
c53a82b99d
@ -2603,7 +2603,7 @@ pset_bool_string(bool val)
|
||||
static char *
|
||||
pset_quoted_string(const char *str)
|
||||
{
|
||||
char *ret = pg_malloc(strlen(str) * 2 + 2);
|
||||
char *ret = pg_malloc(strlen(str) * 2 + 3);
|
||||
char *r = ret;
|
||||
|
||||
*r++ = '\'';
|
||||
|
Loading…
Reference in New Issue
Block a user