Return-Path: X-Original-To: apmail-qpid-dev-archive@www.apache.org Delivered-To: apmail-qpid-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7D0821036D for ; Wed, 2 Oct 2013 15:28:13 +0000 (UTC) Received: (qmail 61775 invoked by uid 500); 2 Oct 2013 15:28:13 -0000 Delivered-To: apmail-qpid-dev-archive@qpid.apache.org Received: (qmail 61755 invoked by uid 500); 2 Oct 2013 15:28:13 -0000 Mailing-List: contact dev-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list dev@qpid.apache.org Received: (qmail 61739 invoked by uid 99); 2 Oct 2013 15:28:12 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Oct 2013 15:28:12 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 8D0671D33DA; Wed, 2 Oct 2013 15:28:11 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============2316657987716002922==" MIME-Version: 1.0 Subject: Re: Review Request 14442: Check length of error description before assigning to size limited buffer From: "Gordon Sim" To: "Rafael Schloming" Cc: "Chug Rolke" , "Gordon Sim" , "qpid" Date: Wed, 02 Oct 2013 15:28:11 -0000 Message-ID: <20131002152811.28588.13490@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org Auto-Submitted: auto-generated Sender: "Gordon Sim" X-ReviewGroup: qpid X-ReviewRequest-URL: https://reviews.apache.org/r/14442/ X-Sender: "Gordon Sim" References: <20131002131156.28588.69151@reviews.apache.org> In-Reply-To: <20131002131156.28588.69151@reviews.apache.org> Reply-To: "Gordon Sim" --===============2316657987716002922== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit > On Oct. 2, 2013, 1:11 p.m., Chug Rolke wrote: > > /proton/trunk/proton-c/src/transport/transport.c, line 772 > > > > > > In the original code both condition->name and condition->description are vulnerable to buffer overruns. > > > > How about replacing strncat with a function that accepts the length of the destination buffer and applies the proposed fix to all instances? > > > > Windows builds complain of unsafe functions strcat, sprintf, strncpy, strncat, and getenv for precisely the reason exposed by this bug. > > Rafael Schloming wrote: > I'd suggest replacing both name and description with pointers to pn_string_t. The pn_string_t type has been added since the original condition code was written, and is not vulnerable to this sort of buffer overrun thing. It will automatically expand as needed. I'm happy to do this if you want to assign the JIRA to me. I've been piecemeal updating all strings to use pn_string_t as I encounter various issues. Sounds good! The JIRA is assigned to you. - Gordon ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/14442/#review26605 ----------------------------------------------------------- On Oct. 2, 2013, 11:58 a.m., Gordon Sim wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/14442/ > ----------------------------------------------------------- > > (Updated Oct. 2, 2013, 11:58 a.m.) > > > Review request for qpid and Rafael Schloming. > > > Bugs: PROTON-432 > https://issues.apache.org/jira/browse/PROTON-432 > > > Repository: qpid > > > Description > ------- > > If error description is very long it overruns the buffer and causes segfault on processing the corrupted condition information. > > > Diffs > ----- > > /proton/trunk/proton-c/src/transport/transport.c 1527976 > > Diff: https://reviews.apache.org/r/14442/diff/ > > > Testing > ------- > > Fixes my test case. > > python-test, c-object-tests and c-message-tests also pass > proton-jni, proton-java and ruby-unit-test fail for me even on a clean build > > > Thanks, > > Gordon Sim > > --===============2316657987716002922==--