Skip to content

Commit 9711fa0

Browse files
committed
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
1 parent a4523c5 commit 9711fa0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/bin/psql/command.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2711,7 +2711,7 @@ pset_bool_string(bool val)
27112711
static char *
27122712
pset_quoted_string(const char *str)
27132713
{
2714-
char *ret = pg_malloc(strlen(str) * 2 + 2);
2714+
char *ret = pg_malloc(strlen(str) * 2 + 3);
27152715
char *r = ret;
27162716

27172717
*r++ = '\'';

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy