]> granicus.if.org Git - postgresql/commit
Fix off-by-one in memory allocation for quote_literal_cstr().
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 16 Dec 2016 10:50:20 +0000 (12:50 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 16 Dec 2016 10:53:27 +0000 (12:53 +0200)
commitc8f8ed5c2d2336a178ba7393a90501ff7d91b42f
tree1ffc4839b85cc3c31cdef1abdf14527fbb19044b
parent2b7d715c0d987c5f5663afe081825ecccd2d8848
Fix off-by-one in memory allocation for quote_literal_cstr().

The calculation didn't take into account the NULL terminator. That lead
to overwriting the palloc'd buffer by one byte, if the input consists
entirely of backslashes. For example "format('%L', E'\\')".

Fixes bug #14468. Backpatch to all supported versions.

Report: https://www.postgresql.org/message-id/20161216105001.13334.42819%40wrigleys.postgresql.org
src/backend/utils/adt/quote.c