Re: appendStringInfoString() micro-opt

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: appendStringInfoString() micro-opt
Date: 2004-01-31 05:42:19
Message-ID: 27366.1075527739@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Neil Conway <neilc(at)samurai(dot)com> writes:
> It occurred to me that there is a potential security problem with code
> like:

> char *my_str;
> my_str = read_from_an_untrusted_source();
> appendStringInfo(buf, my_str);

> If my_str contains any formatting characters, this crashes the
> backend. I'm not sure if there are any actual exploitable instances of
> this in the backend, but the above unsafe coding practise is fairly
> common.

It is? I thought I'd gone around and checked for that. If you see any
remaining cases then I'd say they are must-fix items.

regards, tom lane

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2004-01-31 16:52:42 Re: [PATCHES] v7.4.1 text_position() patch
Previous Message Neil Conway 2004-01-31 05:10:47 Re: appendStringInfoString() micro-opt