From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id E4AF628BF for ; Wed, 27 Apr 2016 16:36:16 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id a17so18871014wme.0 for ; Wed, 27 Apr 2016 07:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=7Tm9kt6o8c1bfoMPddh5kRX0R0F9c2XViOEz2RxbFUw=; b=EYhxDAQKjKYch5RoPoHlN7fZ5xCfSAOxa+0C+ASOk4WDzYNrWNgmuJdXSyup/UkQS+ HfNa5Zr8owGY6IdXNoeIlhKPhWtL310sy09ktjPyDo1wMACG9S4dOWP1QVPS+6i100/A 4352sZrHl1Hhu561slcD336uWcDB7Awl6c01POLF0mj75thWhTvG0XqX0Gjd8tTAXCMx rDUebvWfjpuQw8RNfcq5qphdi8duLDPKHzyZ2Tn5N59kKdzXLwugmOyUJtMRR1487aMH A57Ls0GwYgmG9riE5aHS0vCtaqBqlt/9te5A3emiZqJqUeFkD9WhV3iRNo83IXnFzLxR ypXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding; bh=7Tm9kt6o8c1bfoMPddh5kRX0R0F9c2XViOEz2RxbFUw=; b=AOkIv2Z+eTIoFhXCfA8XybSJAqwPkxeTd3hAGYiHsbNA7ZvxMt0yX014O1LKbLnxXz hZschwPTgkNA8pv07qz7SIjYWR9aMde3YAozyvQedwgmCQdrkg2KPPovC8KA7efIN4dj QXI6Rin3IKhwcxb3BY1q8mat0eU+OonI3Gv743kcSqbABbh9uM5MxM8gBDiKbJZZpCs8 9sVEfoMimmxlq78Sqe9kTifvXiLnZ9vPehAKvbd94gCJtpQMfBaeUskMGrIDom3/TGLu fLsihAtOIo8DYwoVSfpkJ8fRAQbcb+RT4hqww9n8q5xP7pzrIyMm2rup02ffmFR+muSq I+FA== X-Gm-Message-State: AOPr4FWmHUvFf92YZrNVPuaaD3Ni7iqrdxrE0p61H0TxZlpKWnmHvKLPul1bEA7hyhdPDJul X-Received: by 10.28.24.195 with SMTP id 186mr10376563wmy.30.1461767776784; Wed, 27 Apr 2016 07:36:16 -0700 (PDT) Received: from xps13.localnet (51.111.75.86.rev.sfr.net. [86.75.111.51]) by smtp.gmail.com with ESMTPSA id u192sm29718716wmd.11.2016.04.27.07.36.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Apr 2016 07:36:15 -0700 (PDT) From: Thomas Monjalon To: Daniel Mrzyglod Cc: dev@dpdk.org, alan.carew@intel.com Date: Wed, 27 Apr 2016 16:36:14 +0200 Message-ID: <2816928.LRtXO1Vhg3@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <1460473986-3816-1-git-send-email-danielx.t.mrzyglod@intel.com> References: <1460473986-3816-1-git-send-email-danielx.t.mrzyglod@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] examples/vm_power_manager: buffer not null terminated X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 14:36:17 -0000 2016-04-12 17:13, Daniel Mrzyglod: > CID30691: > If the buffer is treated as a null terminated string in later operations, > a buffer overflow or over-read may occur. [...] > --- a/examples/vm_power_manager/channel_manager.c > +++ b/examples/vm_power_manager/channel_manager.c > - strncpy(new_domain->name, vm_name, sizeof(new_domain->name)); > + strncat(new_domain->name, vm_name, sizeof(new_domain->name) - > + strlen(new_domain->name) - 1); It looks to be a copy paste of a ready-to-use replacement of strncpy. Why not just do new_domain->name[sizeof(new_domain->name) - 1] = 0 ?