From owner-freebsd-hackers@FreeBSD.ORG Mon May 2 14:58:44 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DCBA106566B for ; Mon, 2 May 2011 14:58:44 +0000 (UTC) (envelope-from rs@bytecamp.net) Received: from mail.bytecamp.net (mail.bytecamp.net [212.204.60.9]) by mx1.freebsd.org (Postfix) with ESMTP id 7C0EE8FC14 for ; Mon, 2 May 2011 14:58:42 +0000 (UTC) Received: (qmail 55026 invoked by uid 89); 2 May 2011 16:58:42 +0200 Received: from stella.bytecamp.net (HELO ?212.204.60.37?) (rs%bytecamp.net@212.204.60.37) by mail.bytecamp.net with CAMELLIA256-SHA encrypted SMTP; 2 May 2011 16:58:42 +0200 Message-ID: <4DBEC6A1.40302@bytecamp.net> Date: Mon, 02 May 2011 16:58:41 +0200 From: Robert Schulze Organization: bytecamp GmbH User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4DBEAAD5.7040906@bytecamp.net> <4DBEBC7A.60607@bytecamp.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [LIBC] Modfied Version of sscanf X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 May 2011 14:58:44 -0000 Hi, Am 02.05.2011 16:41, schrieb Artem Belevich: > >> if(ptr&& (ptr=strstr(ptr," HTTP/1.1"))) /* find end of res */ > > Contrary to the comment in the code you're not checking for "HTTP/1.1" > at the end but you're checking for it *anywhere* in the string. While > it will occur at the end of valid input string, nobody said it can't > occur in the middle, too. Original requirement was saying "surrounded > by GET and HTTP/1.1". good catch :-) The additional test for end-of-string should be an exercise for the OP. Reading the code of should clarify things, too. With kind regards, Robert Schulze