Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/35307/?format=api
http://patches.dpdk.org/api/patches/35307/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180220160559.1143-1-remy.horton@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20180220160559.1143-1-remy.horton@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180220160559.1143-1-remy.horton@intel.com", "date": "2018-02-20T16:05:59", "name": "[dpdk-dev,v2] metrics: fix potential missing NULL termination", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "24c9842e3537c99a23197cc3ffbb447e0da71fe7", "submitter": { "id": 326, "url": "http://patches.dpdk.org/api/people/326/?format=api", "name": "Remy Horton", "email": "remy.horton@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180220160559.1143-1-remy.horton@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/35307/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/35307/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id F24C61B168;\n\tTue, 20 Feb 2018 17:06:03 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 542961B022\n\tfor <dev@dpdk.org>; Tue, 20 Feb 2018 17:06:02 +0100 (CET)", "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t20 Feb 2018 08:06:01 -0800", "from rhorton-mobl1.ger.corp.intel.com (HELO FC23.ir.intel.com)\n\t([163.33.231.16])\n\tby fmsmga007.fm.intel.com with ESMTP; 20 Feb 2018 08:06:00 -0800" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.46,540,1511856000\"; d=\"scan'208\";a=\"18970706\"", "From": "Remy Horton <remy.horton@intel.com>", "To": "dev@dpdk.org", "Date": "Tue, 20 Feb 2018 16:05:59 +0000", "Message-Id": "<20180220160559.1143-1-remy.horton@intel.com>", "X-Mailer": "git-send-email 2.9.5", "In-Reply-To": "<20180220145001.18442-1-remy.horton@intel.com>", "Subject": "[dpdk-dev] [PATCH v2] metrics: fix potential missing NULL\n\ttermination", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Fixes a potential memory overrun detected by Coverity.\nThis overrun cannot currently happen in practice because\nrte_metrics_reg_names() explicitly forces the last name\ncharacter to be a NULL terminator. This patch adds the\nsame enforcement to rte_metrics_get_names() in order to\ncorrect the warning, as well as using snprintf instead\nof strncpy to copy name strings.\n\nCoverity issue: 143434\nFixes: 349950ddb9c5 (\"metrics: add information metrics library\")\nFixes: 710cab6f675a (\"metrics: fix out of bound access\")\n\nSigned-off-by: Remy Horton <remy.horton@intel.com>\n\n--\nChanges in v2\n* Replace strncpy with snprintf\n---\n lib/librte_metrics/rte_metrics.c | 12 +++++-------\n 1 file changed, 5 insertions(+), 7 deletions(-)", "diff": "diff --git a/lib/librte_metrics/rte_metrics.c b/lib/librte_metrics/rte_metrics.c\nindex 556ae1b..b0f5450 100644\n--- a/lib/librte_metrics/rte_metrics.c\n+++ b/lib/librte_metrics/rte_metrics.c\n@@ -113,10 +113,8 @@ rte_metrics_reg_names(const char * const *names, uint16_t cnt_names)\n \n \tfor (idx_name = 0; idx_name < cnt_names; idx_name++) {\n \t\tentry = &stats->metadata[idx_name + stats->cnt_stats];\n-\t\tstrncpy(entry->name, names[idx_name],\n-\t\t\tRTE_METRICS_MAX_NAME_LEN);\n-\t\t/* Enforce NULL-termination */\n-\t\tentry->name[RTE_METRICS_MAX_NAME_LEN - 1] = '\\0';\n+\t\tsnprintf(entry->name, RTE_METRICS_MAX_NAME_LEN,\n+\t\t\t\"%s\", names[idx_name]);\n \t\tmemset(entry->value, 0, sizeof(entry->value));\n \t\tentry->idx_next_stat = idx_name + stats->cnt_stats + 1;\n \t}\n@@ -215,9 +213,9 @@ rte_metrics_get_names(struct rte_metric_name *names,\n \t\t\treturn return_value;\n \t\t}\n \t\tfor (idx_name = 0; idx_name < stats->cnt_stats; idx_name++)\n-\t\t\tstrncpy(names[idx_name].name,\n-\t\t\t\tstats->metadata[idx_name].name,\n-\t\t\t\tRTE_METRICS_MAX_NAME_LEN);\n+\t\t\tsnprintf(names[idx_name].name,\n+\t\t\t\tRTE_METRICS_MAX_NAME_LEN,\n+\t\t\t\t\"%s\", stats->metadata[idx_name].name);\n \t}\n \treturn_value = stats->cnt_stats;\n \trte_spinlock_unlock(&stats->lock);\n", "prefixes": [ "dpdk-dev", "v2" ] }{ "id": 35307, "url": "