Skip to content

Commit c53a82b

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 859e2b9 commit c53a82b

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
@@ -2603,7 +2603,7 @@ pset_bool_string(bool val)
26032603
static char *
26042604
pset_quoted_string(const char *str)
26052605
{
2606-
char *ret = pg_malloc(strlen(str) * 2 + 2);
2606+
char *ret = pg_malloc(strlen(str) * 2 + 3);
26072607
char *r = ret;
26082608

26092609
*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