Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E04234762AA; Fri, 24 Jan 2003 12:56:45 -0500 (EST) Received: from sabre.velocet.net (sabre.velocet.net [216.138.209.205]) by postgresql.org (Postfix) with ESMTP id E3707476FE6; Fri, 24 Jan 2003 12:22:38 -0500 (EST) Received: from stark.dyndns.tv (H162.C233.tor.velocet.net [216.138.233.162]) by sabre.velocet.net (Postfix) with ESMTP id B467813820A; Fri, 24 Jan 2003 12:22:43 -0500 (EST) Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) id 18c7XO-0006lO-00; Fri, 24 Jan 2003 12:22:42 -0500 To: "Nigel J. Andrews" Cc: pgsql-general@postgresql.org, pgsql-interfaces@postgresql.org Subject: Re: More PHP DB abstraction layer stuff References: In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 24 Jan 2003 12:22:42 -0500 Message-ID: <87k7gupin1.fsf@stark.dyndns.tv> Lines: 17 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/1034 X-Sequence-Number: 36155 "Nigel J. Andrews" writes: > One thing that always gets me is why people think quoting the ' in a string is > a security feature when they don't allow for someone giving \' in the > string. On the other hand I'm never sure how to protect against such 'odd > number of escapes' attacks. Anyone got any clues? Does PQescape do it? That just means you have to escape \ as well as '. But the best way to deal with this is to use placeholders and prepared queries and provide the data out of band. This completely sidesteps the issue and guarantees you can't get it wrong by mistake ever. Mixing user-provided data with program code is a recipe for security holes. -- greg