get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/136886/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 136886,
    "url": "https://patches.dpdk.org/api/patches/136886/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20240220035840.32978-3-fengchengwen@huawei.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20240220035840.32978-3-fengchengwen@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240220035840.32978-3-fengchengwen@huawei.com",
    "date": "2024-02-20T03:58:38",
    "name": "[2/4] cfgfile: support verify name and value",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "14f00d1feeae0ea6518dfd49ac4d3175d069a66b",
    "submitter": {
        "id": 2146,
        "url": "https://patches.dpdk.org/api/people/2146/?format=api",
        "name": "fengchengwen",
        "email": "fengchengwen@huawei.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20240220035840.32978-3-fengchengwen@huawei.com/mbox/",
    "series": [
        {
            "id": 31143,
            "url": "https://patches.dpdk.org/api/series/31143/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=31143",
            "date": "2024-02-20T03:58:36",
            "name": "cfgfile: enhance error detecting",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/31143/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/136886/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/136886/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 9D59243AD8;\n\tTue, 20 Feb 2024 05:00:28 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 083E4406BC;\n\tTue, 20 Feb 2024 05:00:13 +0100 (CET)",
            "from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191])\n by mails.dpdk.org (Postfix) with ESMTP id B40684067E\n for <dev@dpdk.org>; Tue, 20 Feb 2024 05:00:11 +0100 (CET)",
            "from mail.maildlp.com (unknown [172.19.163.17])\n by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Tf5CW0jLlz1FL5M;\n Tue, 20 Feb 2024 11:55:19 +0800 (CST)",
            "from dggpeml500024.china.huawei.com (unknown [7.185.36.10])\n by mail.maildlp.com (Postfix) with ESMTPS id 8A2EA1A0172;\n Tue, 20 Feb 2024 12:00:05 +0800 (CST)",
            "from localhost.localdomain (10.50.165.33) by\n dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.35; Tue, 20 Feb 2024 12:00:05 +0800"
        ],
        "From": "Chengwen Feng <fengchengwen@huawei.com>",
        "To": "<thomas@monjalon.net>",
        "CC": "<dev@dpdk.org>, <cristian.dumitrescu@intel.com>",
        "Subject": "[PATCH 2/4] cfgfile: support verify name and value",
        "Date": "Tue, 20 Feb 2024 03:58:38 +0000",
        "Message-ID": "<20240220035840.32978-3-fengchengwen@huawei.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20240220035840.32978-1-fengchengwen@huawei.com>",
        "References": "<20240220035840.32978-1-fengchengwen@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.50.165.33]",
        "X-ClientProxiedBy": "dggems705-chm.china.huawei.com (10.3.19.182) To\n dggpeml500024.china.huawei.com (7.185.36.10)",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This patch supports verify section's name, entry's name and entry's\nvalue validity.\n\nCc: stable@dpdk.org\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n lib/cfgfile/rte_cfgfile.c | 17 +++++++++++++++++\n 1 file changed, 17 insertions(+)",
    "diff": "diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c\nindex d7aa38b56f..6f8f46a406 100644\n--- a/lib/cfgfile/rte_cfgfile.c\n+++ b/lib/cfgfile/rte_cfgfile.c\n@@ -105,6 +105,16 @@ static int\n _add_entry(struct rte_cfgfile_section *section, const char *entryname,\n \t\tconst char *entryvalue)\n {\n+\tint name_len, value_len;\n+\n+\tname_len = strlen(entryname);\n+\tvalue_len = strlen(entryvalue);\n+\tif (name_len == 0 || name_len >= CFG_NAME_LEN || value_len >= CFG_VALUE_LEN) {\n+\t\tCFG_LOG(ERR, \"invalid entry name %s or value %s in section %s\",\n+\t\t\tentryname, entryvalue, section->name);\n+\t\treturn -EINVAL;\n+\t}\n+\n \t/* resize entry structure if we don't have room for more entries */\n \tif (section->num_entries == section->allocated_entries) {\n \t\tstruct rte_cfgfile_entry *n_entries = realloc(\n@@ -322,6 +332,7 @@ rte_cfgfile_create(int flags)\n int\n rte_cfgfile_add_section(struct rte_cfgfile *cfg, const char *sectionname)\n {\n+\tint len;\n \tint i;\n \n \tif (cfg == NULL)\n@@ -330,6 +341,12 @@ rte_cfgfile_add_section(struct rte_cfgfile *cfg, const char *sectionname)\n \tif (sectionname == NULL)\n \t\treturn -EINVAL;\n \n+\tlen = strlen(sectionname);\n+\tif (len == 0 || len >= CFG_NAME_LEN) {\n+\t\tCFG_LOG(ERR, \"invalid section name %s\", sectionname);\n+\t\treturn -EINVAL;\n+\t}\n+\n \t/* resize overall struct if we don't have room for more\tsections */\n \tif (cfg->num_sections == cfg->allocated_sections) {\n \n",
    "prefixes": [
        "2/4"
    ]
}