From patchwork Sat Dec 28 08:07:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 182490 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp3923662ild; Sat, 28 Dec 2019 00:08:20 -0800 (PST) X-Google-Smtp-Source: APXvYqzGNQ8prRMOGLKY7Mg9Y1AARKyqWRNr9FQi6oFYc6bzZd0g1zhlkpKrF/iNMRl8Lbsc7o1r X-Received: by 2002:a17:902:bb8d:: with SMTP id m13mr44787266pls.143.1577520500752; Sat, 28 Dec 2019 00:08:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577520500; cv=none; d=google.com; s=arc-20160816; b=G4mL7aS6SKLeNARBEefIY+ZE/OxKMQZeJhbsx6huKeyDJdmTqnTjQF7gqGI8XNZ/uc u1Jqas9PrSLyvPeeJvXOX135zXV86zp51AWQ4lbY77pO1wpoq8aOZh/ftmwOvMTUfdY0 gD6fwm+lc8jV6R/AgZUGkaItlH7HfVa1sjk9ITy4ZH792lziHY2Blw2HcoHBW6dSKd0r Lu+hGNlyCIxDh0QKchAsROz8tK/9F1e+OHdiY6igmQNOpfrHM7w06laFGTtvxXemrF2j Fobr1qb2BsHY0HDaO2Pa8udKqGWQjDSpXEwv5cGjASxlG5336fEDC4O2h53Yp4nVErFQ UcTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:delivered-to; bh=rt2xk/ATRYYFSrqa7Df4FUYL5DuV3STc5B0nW7Qd6QI=; b=byspxRNbhM7+aMD9DxN1SmPNFPbEFCOt1gaA5QJ3ucFH38W4D7mdiPt5xsx8UzXD6w AklW1CW4h9MAN8BnrA2IiOR9c624kU420es26tPNSwcm0Mm90RZFZhekoK8q39AOqhpO cKDAU4gnegHvINxzw+eLybdy3PZ7tRge22puKAGZS+fTgZLhwcF9KuH6TamyNWmv/556 XyUFnvH9mqsyLfGV4txUszminsjUHxzXyQufIGvswAL6XptS6Q0SopnvLg7y9vSzeM2x /G3yxjeNNjGVTn++eNPV5S/cf3aBgDXS1sh7C/D75s1baR1yo4+cb9jdHk9M4PPZ5qfE hatA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Evg06Wv6; spf=pass (google.com: best guess record for domain of openembedded-devel-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-devel-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id b8si32311598pfd.71.2019.12.28.00.08.20; Sat, 28 Dec 2019 00:08:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-devel-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Evg06Wv6; spf=pass (google.com: best guess record for domain of openembedded-devel-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-devel-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ec2-34-214-78-129.us-west-2.compute.amazonaws.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id C4DA57C873; Sat, 28 Dec 2019 08:08:17 +0000 (UTC) X-Original-To: openembedded-devel@lists.openembedded.org Delivered-To: openembedded-devel@lists.openembedded.org Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by mail.openembedded.org (Postfix) with ESMTP id D62B76004D for ; Sat, 28 Dec 2019 08:07:48 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id x184so15828925pfb.3 for ; Sat, 28 Dec 2019 00:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+RGBaWMGDM8vqP+Twk9VIT+CiLV8vMVB031Rho+zXDw=; b=Evg06Wv6o1B6uWG5cZy2r6Mcj+Dka5TUD1358+AumStSAZVXh8lYtry0Io2BxlVA8u 5Q5MYeNekmmOLg3X5hGJwnG6RVqKqARiX7UtKjGJLYc1m8golMdiPjuDwMQvxmysKl7y OlTlcte7wXuujQBTdDO/4Qh826wWx8vMK80C1+l/4wa24EqyVSYZ/pG6eCAF+5NGWETF O0HnhQeXuQxYb0mNta4nmkC7CM/xTN0wBO/5JFC2mb6DHCkUfzSO9Cz8ZlfWw9h6dIhm 1K0daVhJdyr44LcuMAsBvJ0RjtOR/cwXNlRqca0+KyKygtMDGkS6k2353sa5kf+57tsM VPyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+RGBaWMGDM8vqP+Twk9VIT+CiLV8vMVB031Rho+zXDw=; b=IiCvVmJsQWwT9I4KZwdmYxaP1NZf9N0oC8d6cw6+0OrnAQR7qrt4bhq/eSgyhkrsGX oU7ChCBybiMw7gbMJKi3LA5cTTuqB3ZhYSLtr6Fi3uOOxQ+o/eekH184k46mLYUAN6Pg 0gafHXLr8/ib4K+kFJOmpAGKjqdAvYCcpkDVe31QuMX6DZS7D5NHQA/BblTviAc+8K1t 18wPKdZws8J5JCVQDJcYj5FAOQcISlksmZGPsbvIdyKk5St6Wgcd1rmbymmGq0A4mULP PZk2F1f+lAGpyU2AZED3/7owJ8GzQlJfz6+/TZvmpNaKqQnGC49yFipKOU1M7FKk7SGi aTaQ== X-Gm-Message-State: APjAAAVrar/2tRIr9ZGpOPO8ZCKS+2ZZnHr1J0l7NVPSsv3lm2wMgNXw vmBhONvz4iICkCPxqppFR3zpAIKVdrY= X-Received: by 2002:a62:a209:: with SMTP id m9mr49547969pff.16.1577520469413; Sat, 28 Dec 2019 00:07:49 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9200:4e0::2f83]) by smtp.gmail.com with ESMTPSA id r66sm44135124pfc.74.2019.12.28.00.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2019 00:07:49 -0800 (PST) From: Khem Raj To: openembedded-devel@lists.openembedded.org Date: Sat, 28 Dec 2019 00:07:37 -0800 Message-Id: <20191228080740.63169-2-raj.khem@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191228080740.63169-1-raj.khem@gmail.com> References: <20191228080740.63169-1-raj.khem@gmail.com> MIME-Version: 1.0 Cc: Adrian Bunk Subject: [oe] [meta-networking][PATCH V2 2/5] ippool: Fix strncpy -Wformat-truncation warning X-BeenThere: openembedded-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Using the OpenEmbedded metadata to build Distributions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openembedded-devel-bounces@lists.openembedded.org Errors-To: openembedded-devel-bounces@lists.openembedded.org Signed-off-by: Khem Raj Cc: Adrian Bunk --- .../ippool/ippool/strncpy-truncation.patch | 39 +++++++++++++++++++ .../recipes-daemons/ippool/ippool_1.3.bb | 1 + 2 files changed, 40 insertions(+) create mode 100644 meta-networking/recipes-daemons/ippool/ippool/strncpy-truncation.patch -- 2.24.1 -- _______________________________________________ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel diff --git a/meta-networking/recipes-daemons/ippool/ippool/strncpy-truncation.patch b/meta-networking/recipes-daemons/ippool/ippool/strncpy-truncation.patch new file mode 100644 index 0000000000..01e1da8703 --- /dev/null +++ b/meta-networking/recipes-daemons/ippool/ippool/strncpy-truncation.patch @@ -0,0 +1,39 @@ +Replace strncpy with memcpy + +since the length of data to +be copied has already been determined with strlen(). Replace strncpy() +with memcpy() to address the warning and optimize the code a little. + +| ippool_config.c:112:2: note: 'snprintf' output between 8 and 55 bytes into a destination of size 48 +| 112 | snprintf(prompt, sizeof(prompt), "ippool-%s", server_name); +| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- a/cli/cli_readline.c ++++ b/cli/cli_readline.c +@@ -257,10 +257,15 @@ static void cli_rl_display_wrapped_text( + int pos; + int in_ws; + int i; ++ int bufsize = sizeof(text_buf)/sizeof(text_buf[0]); + + if (left_margin == 0) { + left_margin = 3; + } ++ if (left_margin > bufsize) { ++ left_margin = bufsize; ++ } ++ + if (right_margin == 0) { + right_margin = 78;; + } +@@ -271,7 +276,7 @@ static void cli_rl_display_wrapped_text( + /* First copy the text heading to the buffer and add a "-", accounting for + * the specified left margin. + */ +- strncpy(&text_buf[0], text1, left_margin - 3); ++ memcpy(&text_buf[0], text1, left_margin - 3); + for (pos = strlen(text1); pos < left_margin - 3; pos++) { + text_buf[pos] = ' '; + } diff --git a/meta-networking/recipes-daemons/ippool/ippool_1.3.bb b/meta-networking/recipes-daemons/ippool/ippool_1.3.bb index 6fa46904b3..3554e688ab 100644 --- a/meta-networking/recipes-daemons/ippool/ippool_1.3.bb +++ b/meta-networking/recipes-daemons/ippool/ippool_1.3.bb @@ -26,6 +26,7 @@ SRC_URI = "https://sourceforge.net/projects/openl2tp/files/${BPN}/${PV}/${BPN}-$ file://0003-cli-Mark-return-of-strtol-as-long-int.patch \ file://0002-link-with-libtirpc.patch \ file://0003-musl-fixes.patch \ + file://strncpy-truncation.patch \ " LIC_FILES_CHKSUM = "file://LICENSE;md5=4c59283b82fc2b166455e0fc23c71c6f"