From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 77A8B1B4A2 for ; Wed, 3 Apr 2019 17:48:02 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id t21so8360046pfe.2 for ; Wed, 03 Apr 2019 08:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=omaDpPzzl9AYCeb91DQGuUFZokYrtNqbnnralI3AIro=; b=g5OWjVvqv4TI7rwnto7ubA5kfjRPYy2WSfnL5/OeChUO4dN0r9GLu9yemFYAy+eO06 /j24/MlcKfuIgKRtlwvBZj35LN+HwDEQccEiULROElK0hiorVmqatAOGRkRzDVsauv9C UY8a+xVgI8a0RC7NcvjgLDM3tSXAjQvq8xb2dTlwiuPXVpHhDJ9I09SZGJwOoguaCfMG UTcZpnU445zUhb77uQ7H9354EbA7kVQKZk2eS19teD29sv8kChJnVWBbS4WR0doPtpyG JEQ9ygtG8K/JOR4UwoCrJlcvDy30Tm8VYl1cqqGPJXxkpFRgJvB4pV8lkZb9Bt1M/TBr U3iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=omaDpPzzl9AYCeb91DQGuUFZokYrtNqbnnralI3AIro=; b=Gw7eeF4oV15teToqCCCNeEG0T6Q3QPiGMFghVpKkrRR9rgjJfDZv97r8yY7z/5bXTG wQm+mXzUqfYflK0dXIult7jFnBeltlcPBojxCdl9LSEVDca91YnuuJGHXCVc7YuY344x Ao5vtLUQUCeUJ9xooPvM33aGF9zEoc8T/Mwsb+p9G9mQZe/d1akXdx0DE5sPrbz2vmdM 42WnTk/FHOQsvdMwxS9E1nm0eZ62tntbNzagdTpVPEhri+p+0LY3MGP65HFylasF854o MDSqulTygUHSSJ6BCz7uGO7/34asT9gVhKVFGABJQ2WKFkRiLfhlWcE8KYSpYfwCZPHF 9S7A== X-Gm-Message-State: APjAAAV6IXzA7RngHPg2Btqb6w/nvoBvkK1S+4H3RUJCD7OptFTFUq7B Cztv3RZnEJD+SfxMDqC5HTBFaQ== X-Google-Smtp-Source: APXvYqy+yG3qO/ffARNY1PFyV0/cqunL954E5mElUxc+kuat1GGV52whBHxusAncJzHa+7m6mhN66Q== X-Received: by 2002:a63:711d:: with SMTP id m29mr351855pgc.109.1554306481539; Wed, 03 Apr 2019 08:48:01 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id i16sm26236886pgk.51.2019.04.03.08.48.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Apr 2019 08:48:01 -0700 (PDT) Date: Wed, 3 Apr 2019 08:47:58 -0700 From: Stephen Hemminger To: Bruce Richardson Cc: dev@dpdk.org, Declan Doherty , stable@dpdk.org Message-ID: <20190403084758.2b7bed7f@shemminger-XPS-13-9360> In-Reply-To: <20190403144505.46234-2-bruce.richardson@intel.com> References: <20190403144505.46234-1-bruce.richardson@intel.com> <20190403144505.46234-2-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/5] net/bonding: fix buffer length when printing strings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Apr 2019 15:48:02 -0000 On Wed, 3 Apr 2019 15:45:01 +0100 Bruce Richardson wrote: > > static void > -arp_op_name(uint16_t arp_op, char *buf) > +arp_op_name(uint16_t arp_op, char *buf, size_t buf_len) > { > switch (arp_op) { > case ARP_OP_REQUEST: > - snprintf(buf, sizeof("ARP Request"), "%s", "ARP Request"); > + snprintf(buf, buf_len, "%s", "ARP Request"); > return; This should be strlcpy not snprintf From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id A8790A0679 for ; Wed, 3 Apr 2019 17:48:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D21421B4AA; Wed, 3 Apr 2019 17:48:03 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 77A8B1B4A2 for ; Wed, 3 Apr 2019 17:48:02 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id t21so8360046pfe.2 for ; Wed, 03 Apr 2019 08:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=omaDpPzzl9AYCeb91DQGuUFZokYrtNqbnnralI3AIro=; b=g5OWjVvqv4TI7rwnto7ubA5kfjRPYy2WSfnL5/OeChUO4dN0r9GLu9yemFYAy+eO06 /j24/MlcKfuIgKRtlwvBZj35LN+HwDEQccEiULROElK0hiorVmqatAOGRkRzDVsauv9C UY8a+xVgI8a0RC7NcvjgLDM3tSXAjQvq8xb2dTlwiuPXVpHhDJ9I09SZGJwOoguaCfMG UTcZpnU445zUhb77uQ7H9354EbA7kVQKZk2eS19teD29sv8kChJnVWBbS4WR0doPtpyG JEQ9ygtG8K/JOR4UwoCrJlcvDy30Tm8VYl1cqqGPJXxkpFRgJvB4pV8lkZb9Bt1M/TBr U3iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=omaDpPzzl9AYCeb91DQGuUFZokYrtNqbnnralI3AIro=; b=Gw7eeF4oV15teToqCCCNeEG0T6Q3QPiGMFghVpKkrRR9rgjJfDZv97r8yY7z/5bXTG wQm+mXzUqfYflK0dXIult7jFnBeltlcPBojxCdl9LSEVDca91YnuuJGHXCVc7YuY344x Ao5vtLUQUCeUJ9xooPvM33aGF9zEoc8T/Mwsb+p9G9mQZe/d1akXdx0DE5sPrbz2vmdM 42WnTk/FHOQsvdMwxS9E1nm0eZ62tntbNzagdTpVPEhri+p+0LY3MGP65HFylasF854o MDSqulTygUHSSJ6BCz7uGO7/34asT9gVhKVFGABJQ2WKFkRiLfhlWcE8KYSpYfwCZPHF 9S7A== X-Gm-Message-State: APjAAAV6IXzA7RngHPg2Btqb6w/nvoBvkK1S+4H3RUJCD7OptFTFUq7B Cztv3RZnEJD+SfxMDqC5HTBFaQ== X-Google-Smtp-Source: APXvYqy+yG3qO/ffARNY1PFyV0/cqunL954E5mElUxc+kuat1GGV52whBHxusAncJzHa+7m6mhN66Q== X-Received: by 2002:a63:711d:: with SMTP id m29mr351855pgc.109.1554306481539; Wed, 03 Apr 2019 08:48:01 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id i16sm26236886pgk.51.2019.04.03.08.48.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Apr 2019 08:48:01 -0700 (PDT) Date: Wed, 3 Apr 2019 08:47:58 -0700 From: Stephen Hemminger To: Bruce Richardson Cc: dev@dpdk.org, Declan Doherty , stable@dpdk.org Message-ID: <20190403084758.2b7bed7f@shemminger-XPS-13-9360> In-Reply-To: <20190403144505.46234-2-bruce.richardson@intel.com> References: <20190403144505.46234-1-bruce.richardson@intel.com> <20190403144505.46234-2-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/5] net/bonding: fix buffer length when printing strings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190403154758.rTKwbroE5KZ5zoBq1uGbOjitkmmj5LGzrtrSZzww3C4@z> On Wed, 3 Apr 2019 15:45:01 +0100 Bruce Richardson wrote: > > static void > -arp_op_name(uint16_t arp_op, char *buf) > +arp_op_name(uint16_t arp_op, char *buf, size_t buf_len) > { > switch (arp_op) { > case ARP_OP_REQUEST: > - snprintf(buf, sizeof("ARP Request"), "%s", "ARP Request"); > + snprintf(buf, buf_len, "%s", "ARP Request"); > return; This should be strlcpy not snprintf