From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26675 invoked by alias); 28 Jan 2015 16:20:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 26620 invoked by uid 89); 28 Jan 2015 16:20:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f176.google.com Received: from mail-ie0-f176.google.com (HELO mail-ie0-f176.google.com) (209.85.223.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 28 Jan 2015 16:20:40 +0000 Received: by mail-ie0-f176.google.com with SMTP id rd18so22691771iec.7 for ; Wed, 28 Jan 2015 08:20:38 -0800 (PST) X-Received: by 10.107.10.214 with SMTP id 83mr4955680iok.16.1422462038493; Wed, 28 Jan 2015 08:20:38 -0800 (PST) Received: from msticlxl57.ims.intel.com (fmdmzpr01-ext.fm.intel.com. [192.55.54.36]) by mx.google.com with ESMTPSA id l29sm2700873iod.31.2015.01.28.08.20.35 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jan 2015 08:20:37 -0800 (PST) Date: Wed, 28 Jan 2015 17:51:00 -0000 From: Ilya Verbin To: Jakub Jelinek Cc: Thomas Schwinge , Kirill Yukhin , gcc-patches@gcc.gnu.org Subject: Re: [PATCH 4/4] OpenMP 4.0 offloading to Intel MIC: non-fallback testing Message-ID: <20150128162030.GB12176@msticlxl57.ims.intel.com> References: <20141021171323.GA47586@msticlxl57.ims.intel.com> <20141030114001.GA34120@msticlxl57.ims.intel.com> <87tx0t0yh5.fsf@kepler.schwinge.homeip.net> <87oaqvzz0n.fsf@kepler.schwinge.homeip.net> <20141222123553.GK1667@tucnak.redhat.com> <20150115185540.GD5706@msticlxl57.ims.intel.com> <20150115185846.GJ1405@tucnak.redhat.com> <20150128160259.GA12176@msticlxl57.ims.intel.com> <20150128161525.GV1746@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150128161525.GV1746@tucnak.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg02502.txt.bz2 On 28 Jan 17:15, Jakub Jelinek wrote: > On Wed, Jan 28, 2015 at 07:02:59PM +0300, Ilya Verbin wrote: > > + = XNEWVEC (char, len + sizeof ("-B" "../" DEFAULT_TARGET_MACHINE > > + "/libgomp/")); > > + sprintf (optional_target_path2, "-B%s/../../../" DEFAULT_TARGET_MACHINE > > + "/libgomp/", current_path); > > This will surely overflow the buffer, won't it? There is space just for > "../" but you put there "/../../../". > > I'd strongly prefer if you rewrote all these XNEWVEC or XRESIZEVEC etc. > + sprintf cases into concat, like > optional_target_path2 = concat ("-B", current_path, > "/../../../" DEFAULT_TARGET_MACHINE > "/libgomp/", NULL); > and similar. That way you avoid all such bugs. The variable 'len' contains sizeof ("/../../"). I agree that this code looks ugly :) I'll rewrite it using concat. -- Ilya