From patchwork Mon May 3 14:17:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1473214 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::538; helo=mail-ed1-x538.google.com; envelope-from=swupdate+bncbd2zdgn6sekrbzmlyccamgqesocus6i@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=SWQkEB1U; dkim-atps=neutral Received: from mail-ed1-x538.google.com (mail-ed1-x538.google.com [IPv6:2a00:1450:4864:20::538]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FYlRL2H8tz9sCD for ; Tue, 4 May 2021 00:17:15 +1000 (AEST) Received: by mail-ed1-x538.google.com with SMTP id i2-20020a0564020542b02903875c5e7a00sf4596817edx.6 for ; Mon, 03 May 2021 07:17:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1620051430; cv=pass; d=google.com; s=arc-20160816; b=DbEGRv/AJ9TqJlquopgHTxfGioRa+ZBA5Nx5EgTOYbYmHPPMY9UvRLsrcX6j0bMo3j ptyr4EI0ygufH0nwncySmu+gYE24hh5rkS9bvqCXYvVqPHa0bBkJSVBVrTBh2F1Lth0/ Aeci4kWbAa917ZFmvv6U125lAat2VVpfDJmPT5Skp251sX+HSXW4kQzSgHMgP/SM/G++ krMd1NCMpjVAuellvaK6wDVN75KWFZbUUZvSBRe6hm5SvZXxsCZ/TqPKccbEXhlusSZz A4CP5jfltLQcLM8IpcusQflliwVKo3OWBjM+nVyKtcEx83l/rDOBT43M1NlF5aJueSsB Dt6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=MPfRi5C4uLuxcR1hMJNeU7yPafy8gAQb6IxDNmuDolE=; b=Xs8nzSvhrO4+GrMolsa8GXoh74yTBtCoD1FE1s7qQV6KkfWb9RQGtYoyAlqQHAcWk2 EZtehxtk1dyoZYuQ5icf6i2KHu7mTCj4Ac1vhz8BdLX3uHMJF/1+aCFREwa8v19uJ5Ax ViZIkcQu/uDaiK98xKdrzkU2MW0Ymgriw2x0mDRyFvxIpo8SWB27cHBYWnB6fSfFBKZb YUCHPHvUuKpM76l4naZnwe+myxkPkw9eSOskB79LfoUrdTPMWBMrMksrI9WbzkOIQr2H IJDPASeT4sjG6AOuWccGzmZMz2paRiuQtbWYnTk7/u75pYPzm0pCwfzqw/8q53QweQq7 Pffg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of stefano.babic@babic.homelinux.org) smtp.mailfrom=stefano.babic@babic.homelinux.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=MPfRi5C4uLuxcR1hMJNeU7yPafy8gAQb6IxDNmuDolE=; b=SWQkEB1UKDXlwYEKJJTa1PGh4V3XvKE8jxE/9zgCimXuY8/88TumI8Q0GCVe7tl9oT 85nUnCptpqLMy5xqi8Psk+kPgdPjDTWSUMq7e8fLATXrfLwwgn/fDZUgIuqUQBDQGxdD N7A5uClisULgvlui4Tn0LmTRgfFIlag5/zJg4QERtYnAukhNP59l+Zi/bRpOlSK1Whff DpKrpxUsxYdkN8raDr4uYFH7ezl7vGLDOOiUCG7l47YWWdJII3WhfF/Oc0FodXH37Quw vV0ImlPHh4Zej+BYXZ5ED4/MoBn5V/rl/s9vOKgn0oG6ADk80Xekw7q64KgGaln4eoTz wmcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=MPfRi5C4uLuxcR1hMJNeU7yPafy8gAQb6IxDNmuDolE=; b=PcNrMKC4X+61fmqTqBIJq48Kx1wbPXVPcRBe8EBR8TzklIT8GxNEzLuoWngtzlBJYQ hNMugjv8vJ2ums7UKLjnPbIaZOCPtsceIySHLBN95rBdqil0MvOL4PsCI3V2XmGRfYdA pYqZBrC5VV1401Df7ifaJb4BJEKbjmQNfn0X9ZOGUjm2c/WUJV9rimPIHllhWEfmXTS4 /oWx+N/ghUAc5SWPul+GdWXfq6+VMZ/7dDaqba+r0r/tA8aq3R5atEnHYeQ5uYAN6f19 GCGD9S19tZCnzoWodcWhUxV/PJHuQTOUFT6sCeuYpEIJzdzESdjpJODeOcO7kY9DrifS bS1Q== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM532yBAlxpPi4sQ9hIcZXMoi/A2lJO8Q9aXrFtoNwOMsEjVFxkvtL zywKdyt8GriNLw4/kUdIQsw= X-Google-Smtp-Source: ABdhPJyflS/s05W8vUj1+W7vMQPUR/gR0GC27z3c8LxkGgSB/KAYS5IDDM8aDbH1Ng6AVdBFj2U3yA== X-Received: by 2002:a05:6402:1c0d:: with SMTP id ck13mr20186304edb.170.1620051430040; Mon, 03 May 2021 07:17:10 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a50:fa90:: with SMTP id w16ls1712489edr.1.gmail; Mon, 03 May 2021 07:17:09 -0700 (PDT) X-Received: by 2002:a50:ed0c:: with SMTP id j12mr20269246eds.12.1620051429233; Mon, 03 May 2021 07:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620051429; cv=none; d=google.com; s=arc-20160816; b=T1VrTMnxyknYEKrzRXn6gCIee3g1IrqFUl+CI+4bE9QtUzXVzSj63pgBKhNe27r1Ps kYwobPNtJbLvVC01U4WrGSjczYgxgJve2BWxa0onnWfybzFxYx3PEG6/pZyd+8jF4vo1 lUwsynFfd4vfOybxmP+ll0eLeppnCjIkXgSqBau/gelOjshMW4/3WH0uP2aUwPb8X94u NLgdqUc0RR/jI1a+AuzUs8YDNGQossIt0ZfgrLJcXRUi33bgHAw4MQc6PZJLJLIwU2zT 6yWgsS+21Pbvas3WOQaS3gOCHrF5e5nsy04SBsYgk9cIY4rAXRZpgOjdcxzXpCmV07dt 7Qow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=Z9RxkhzOhoMDyefmcJusJuDU1pZbT74FU27dK1Pm1as=; b=VU3j1z7x4M01LG027FuBna5Mj/cVwLnVj6eO4zuC7Kw6fudmLKfvH9VkY5rCmzeHkQ sJsipREifKp8O4pbReKzBCTF3uEKSwOuI5XflkbdVhV5nphkBhyUdDUDPkoSrdvpZi4A Y4dy1cXaAj5Zzm/NNKSnSq4lN7JxeBtakFwjiCyBuvIPDokUG/tpfBocREr+D21aYdqs UXlxqsKTAbzKIoffDTk3+3lbL8NA15K6f5nhFnfSr+JlpgnsQ51kyW0da4tx4vKXTHtb FWr62rhtd5Oa+IPojZikhJX0+PhP8q4iHhiMUrxSt5MavIEveeOdPJkQt2FH5VUlsQXt m20g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of stefano.babic@babic.homelinux.org) smtp.mailfrom=stefano.babic@babic.homelinux.org Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id y16si1158086edq.2.2021.05.03.07.17.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 May 2021 07:17:09 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of stefano.babic@babic.homelinux.org) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4FYlR90HhHz1qt4C for ; Mon, 3 May 2021 16:17:09 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4FYlR909phz1qqkP for ; Mon, 3 May 2021 16:17:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id tJznkK-sjk6T for ; Mon, 3 May 2021 16:17:08 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS for ; Mon, 3 May 2021 16:17:08 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id EB06845411E2; Mon, 3 May 2021 16:17:07 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DSgxgW1Oa64N; Mon, 3 May 2021 16:17:05 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.48]) by babic.homelinux.org (Postfix) with ESMTP id 445EE4540D6B; Mon, 3 May 2021 16:17:05 +0200 (CEST) From: stefano.babic@babic.homelinux.org To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] BUG: buffer overflow with semantic version > 50 Date: Mon, 3 May 2021 16:17:03 +0200 Message-Id: <20210503141703.104739-1-stefano.babic@babic.homelinux.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: stefano.babic@babic.homelinux.org X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of stefano.babic@babic.homelinux.org) smtp.mailfrom=stefano.babic@babic.homelinux.org Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , From: Stefano Babic SWUpdate accepts long version string up to SWUPDATE_GENERAL_STRING_SIZE (that is 255 bytes), but the semver library has a fixed buffer that was set to 50, causing a buffer overflow. Set buffer for semver also to SWUPDATE_GENERAL_STRING_SIZE that is the maximum version's length. Signed-off-by: Stefano Babic --- core/semver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/semver.c b/core/semver.c index 763e7a0..67fc786 100644 --- a/core/semver.c +++ b/core/semver.c @@ -10,8 +10,9 @@ #include #include #include "semver.h" +#include "globals.h" -#define SLICE_SIZE 50 +#define SLICE_SIZE SWUPDATE_GENERAL_STRING_SIZE #define DELIMITER "." #define PR_DELIMITER "-" #define MT_DELIMITER "+"