From patchwork Fri Dec 27 03:56:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 182470 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp2499912ild; Thu, 26 Dec 2019 19:58:02 -0800 (PST) X-Google-Smtp-Source: APXvYqzyNRc0B7lfDGYBB/wLJ39ENZSfMX8sMomtbpzvcxQXd1/KdmjKtgS6CgmeaSdQqdLxF+K8 X-Received: by 2002:a63:d411:: with SMTP id a17mr54805286pgh.333.1577419082640; Thu, 26 Dec 2019 19:58:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577419082; cv=none; d=google.com; s=arc-20160816; b=zKYCBrU2m2Y5fFUWoXU0eTNB4qKZ1/iK/vrZSqetJJZzmd7woZnM7StKbuao+ZaS8w RpMU+YZ/QcVKZ3lGIkTEqsxvPl0TIG9Jezx4Ppz8kv015PyVQM37qNGyrekgm7mdCkDJ PoscR50P/QSHxA5t681FKd5hZt7q91Ul8TwE1W4kD8EXevUjoIBMyRfszTFOsoCCvkMX 5/j0hEEUtVHnxeNt/AKFQlsu9BO/FX0zvFDZbZycsknRCmJegGOqiHSzdUeSHkQD7gE+ ZvnbunP3yWMz7M4PtsD7L7dd0g5xlfbafhEFhw3skbyn+2hdL1+8mVAzrDtoJRtsr/CO tjvg== 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 :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:delivered-to; bh=rQYwRVqC4ysrERNmcFzt+Qq5JRHVy+iATE1CEeEKbpA=; b=y6ZEZGoXKytlDiPyoKvJnqd1pE0TnRiw18v9WE787FjvjCwWiT0mf/uhc0H7TgcttB jUCqaNqJS9CZXm+62miCNc5G2j/Xf4I7Y4o9KmDd4AOK1EifOdREU74OwgS6zhNammsd CaXq4Toeb/Gi3eSUKWdE7vvWmo4YY4NXN5NZ37omAukW7seIR9G9RVwiXKtohWzaI/I6 v4avsmZWjlNlax3rpF4vVWlymdtHaYXDUPuZgL9YOu9ssDAjhakRxfDRSqL4RmUVJI9b 5bE4Nlpn+dhnbKQjAnxWBnRTkAuBF2rnl+80iOc9Q8bWetzl65vCbyf0CexiqcnuCGnC MdfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=gZtbgrBC; 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 b10si29623221plk.205.2019.12.26.19.58.02; Thu, 26 Dec 2019 19:58:02 -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=gZtbgrBC; 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 7B9DD7D3B7; Fri, 27 Dec 2019 03:57:45 +0000 (UTC) X-Original-To: openembedded-devel@lists.openembedded.org Delivered-To: openembedded-devel@lists.openembedded.org Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by mail.openembedded.org (Postfix) with ESMTP id 8464F7CE27 for ; Fri, 27 Dec 2019 03:56:49 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id k197so13822620pga.10 for ; Thu, 26 Dec 2019 19:56:51 -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=O1RucZ4wIoQ0yH+H3Z0YoveiZXao/sSqMh0E0Utuat0=; b=gZtbgrBCEL3l92UWyIpce7tT9OnFAP6E+TGc2uRavKUsmFi7qpiQ2X9E7twbqqHpij GHA6f+a+Roqe7bYB+Kyrm/no0RPGYT8lOZNGxsJRtuIAUDfyv2d4feY9stjKsTgTaEWr SZ7tK6BaqsWDFNXjmZupBmp3e2NT4h8Kiwpnibs1ojMh1Fkbs02HJhJjLEspNF0H6MQP yx/tjE38m0A9HCTA181vC4oBRCagb3rLu4yLsfo+IWjOwCKyztvtykWhKRudOU5/Ay+y SQc9waYE0+emars6ZBsLJs/HJmOo+qhyQKiCS9KvemsLwqFFgCZXAHNK0TK4YHqpWw+z cxnw== 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=O1RucZ4wIoQ0yH+H3Z0YoveiZXao/sSqMh0E0Utuat0=; b=lbmQn0YfBK0vBVAZOwui4s4GQDdiDKBeQEi7alEXsuGvuufP9BHp1RVq81PFa9Go4N UjUvulV0YezTL4jYFh/6BCohG3ohpHqmoIAzJ6MlO3IbMYsOF/xiihqb8C7iaP3n8UQu AIHM9OjERPUOwHBLhXWfdCckBUzOtSN8s+2KBDKtz/Vhb0wP9Xm/x4yKrKMXo/czoPg4 H4Ym1MCIAVNWqPO6K3F9RNnHPesdYEgnO7khfea2ej6H4HQ/RQMFyUtjfts9ErRwNeCM xtPUGBnQV7InPvMp8/ds78pEd4+cRkw5HzWK2C3WfNapc4Pe7s2ejBrNudoiSTc5lv7i 4ewg== X-Gm-Message-State: APjAAAWwvuDgatlAOwUnVJJ8kduz3ZxkT+SzNZNc78ksia6J5Pi6Rfw3 c6yy1UoznsXUG22DQT9qJdoRcNlQ4Q4= X-Received: by 2002:aa7:961b:: with SMTP id q27mr52749030pfg.23.1577419010359; Thu, 26 Dec 2019 19:56:50 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9200:4e0::2f83]) by smtp.gmail.com with ESMTPSA id r30sm36673613pfl.162.2019.12.26.19.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2019 19:56:49 -0800 (PST) From: Khem Raj To: openembedded-devel@lists.openembedded.org Date: Thu, 26 Dec 2019 19:56:39 -0800 Message-Id: <20191227035639.303716-5-raj.khem@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191227035639.303716-1-raj.khem@gmail.com> References: <20191227035639.303716-1-raj.khem@gmail.com> MIME-Version: 1.0 Subject: [oe] [meta-networking][PATCH 5/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 --- .../ippool/ippool/strncpy-truncation.patch | 35 +++++++++++++++++++ .../recipes-daemons/ippool/ippool_1.3.bb | 1 + 2 files changed, 36 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..28cad001db --- /dev/null +++ b/meta-networking/recipes-daemons/ippool/ippool/strncpy-truncation.patch @@ -0,0 +1,35 @@ +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 +@@ -261,6 +261,11 @@ static void cli_rl_display_wrapped_text( + if (left_margin == 0) { + left_margin = 3; + } ++ ++ if (left_margin >= strlen(text_buf)) { ++ left_margin = strlen(text_buf); ++ } ++ + 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"