From owner-svn-src-all@FreeBSD.ORG Wed Jul 17 08:41:45 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 423047EE for ; Wed, 17 Jul 2013 08:41:45 +0000 (UTC) (envelope-from mailer-daemon@vniz.net) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by mx1.freebsd.org (Postfix) with ESMTP id BEAAAD3C for ; Wed, 17 Jul 2013 08:41:44 +0000 (UTC) Received: by mail-la0-f48.google.com with SMTP id lx15so1275803lab.7 for ; Wed, 17 Jul 2013 01:41:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:openpgp:content-type :content-transfer-encoding:x-gm-message-state; bh=YhpaggDKqZsmynfZNgx0YvqRRMcVuyrB2+gM7+5ph3w=; b=FCSOKoVoD9+IWr90fAG1mJX2CDurpcIyDsNDB9JL1yeI96LR2ZTwzM5D/Cm8crvl6D tbyAQsYrKYi84TFZz0pxJAvX5UGkNdl3ONjORFthn5Go8QwM18634qV5eNH3tt39CP+1 mRv0RMGF28PqpXqFu7G14hDjlGp119pcDau3VheJSQ+q9kTwLrESEwoonpgZlWb2WQH6 ZHH8enDEXxPwvcrrzA1t6vSo36V4H7OBzJBFXvSVgVVs82IVCLIrkUGaxfIEAMauufTx kSMjM0CMhjG4cWt48R1EgE/8yMrOljkDih3N0cXun4/u6EoVhyiF63OhxkW5io8tBeW8 Nafw== X-Received: by 10.112.19.162 with SMTP id g2mr2834231lbe.9.1374050497757; Wed, 17 Jul 2013 01:41:37 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id am8sm1991956lac.1.2013.07.17.01.41.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Jul 2013 01:41:37 -0700 (PDT) Message-ID: <51E658BD.9020700@freebsd.org> Date: Wed, 17 Jul 2013 12:41:33 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Andriy Gapon Subject: Re: svn commit: r253380 - head/lib/libc/stdlib References: <201307160726.r6G7QlwE045679@svn.freebsd.org> <51E61950.5090206@freebsd.org> <51E62219.1090006@freebsd.org> <51E62B37.8080900@freebsd.org> <51E6576C.6010000@FreeBSD.org> In-Reply-To: <51E6576C.6010000@FreeBSD.org> OpenPGP: id=964474DD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnwrVRy6iT4nNRxGkYwTohTl4oMgaUvVwc8YJMe7kW4i2ae2taivWiGVSbCL4eJZWeCzI4i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jul 2013 08:41:45 -0000 On 17.07.2013 12:35, Andriy Gapon wrote: >>>>> - env = stpcpy(envVars[envNdx].name, name); >>>>> + env = stpncpy(envVars[envNdx].name, name, nameLen); >>>>> if ((envVars[envNdx].name)[nameLen] != '=') >>>>> env = stpcpy(env, "="); >> Microoptimized: >> >> env = stpncpy(envVars[envNdx].name, name, nameLen); >> *env++ = '='; >> > > In fact, I think that the currently committed code is not functionally broken, > just weird. No. The bad thing is that current code increments "env" pointer unpredictable (depending on junk). And the value of variable is written to that "env" pointer later will be off by one sometimes. -- http://ache.vniz.net/ bitcoin:1G6ugdNY6e5jx1GVnAU2ntj2NEfmjKG85r