From nobody Wed Oct 19 01:04:22 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MsXYy5ZVvz4gJbp; Wed, 19 Oct 2022 01:04:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MsXYy4J4Sz3S28; Wed, 19 Oct 2022 01:04:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666141462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QA5xAS9/m/iuf/84tVLsK0fH3Sx8r5DHdCCzF/arqNY=; b=yhbnC832Ij0OrunpipZAWEzAcGhZSOnHXxIPF1UBT/vN5OrvlcsC1dn32s9sbznt/sEJNt rPrNX2m9OOkNpfV3vT3sqpRQ1slvjO5UFybbCrNYjSKGmLNArCmJpyV0yICL5xA6WuJ8f9 8TqU64J36+7a30RfnZlp2FpIDBlgVwcbT5px5BYSLr4JJd4jyHkgwPG/Isv5U8wBx6V6PN DsygOWKNe2DDkd+sq3CWhFPAFUptkswIKWtvecLFatnYhuCH210NedO8icMsOGeBEs+mGq yTO1dj3Jd9wQOhi/BkIpbNWu9CRqsahW+FMpRK9O+yscpWvlPO/laaIAQIDSjw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MsXYy3LqFzMRg; Wed, 19 Oct 2022 01:04:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29J14MVf013457; Wed, 19 Oct 2022 01:04:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29J14McX013456; Wed, 19 Oct 2022 01:04:22 GMT (envelope-from git) Date: Wed, 19 Oct 2022 01:04:22 GMT Message-Id: <202210190104.29J14McX013456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: bd3d597a6bc0 - stable/13 - dma: restore addition of newline when missing from input List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bd3d597a6bc0e35273669cfd7a99b3a5b437d92a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666141462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QA5xAS9/m/iuf/84tVLsK0fH3Sx8r5DHdCCzF/arqNY=; b=DzIUltw5HkP9feaxI0pOWighOUz04YKbA1EBS0V8uwryIvHQioJZMnL9Ws+gDq8a0v9xq2 DpMyhaOFiC+AzlBZXjxKUXWlRr28xcJp0DTbqfYnnDTY2/L3Dzq7ScwS+l3NciFb+OYMoB dLyKqbtF0ZdOhI5KWycYWguIhl/K3u9O2QCFxt4D6WL+A8uLDCRDZ/9qySyBx1+Uv/SCbG XMNowEpRK64rupZbbTQQH5C6PXdFaRgdyTNNs9SHJ1RNVDcvmQlR9CvwOXD/PmXCQ9YGq4 BUKJnjNUtqi+2oBHFkiaJJHZNosa5d5BoqvKMPxVypIzmeMxJ3siGCpY5eQN4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666141462; a=rsa-sha256; cv=none; b=AQt6RLGyYjnr5sPEEzzLYMdCAE3t1rvlluYImBIR2crm8gsHCJq1ExE4II4EOtzXBLPYoe EVGFHTRtDfBogLZRh4simB3vO7jH+JAlpD1C89ewD4wBYMI+2XpovLJIRqmyDPF5UNpfh1 ws0EbIphHpiOOLsRzxZBtp4uoD4S9pXrtjTbP2hGEtF5UXNcp6nHVNYWtddU0HJ8bg3pUi XCAqq7uIvyMAgHig34fW+AudUZ4KvoDWOK0bdY88vhEGT+NCbFKM8JZsgrZmS17X5VDRRX OOuprs3KAQ1++AxTbLLGuf89JrSJJ8uHC8gOietlJopn32w5mLN5kxfPrhlsDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=bd3d597a6bc0e35273669cfd7a99b3a5b437d92a commit bd3d597a6bc0e35273669cfd7a99b3a5b437d92a Author: Ed Maste AuthorDate: 2022-09-27 19:19:19 +0000 Commit: Ed Maste CommitDate: 2022-10-19 01:03:55 +0000 dma: restore addition of newline when missing from input If input mail does not have a newline on the last line dma must add one. This was broken by the addition of long-line splitting, with the switch from strlen(line) to linelen returned by getline(). PR: 266629 Reviewed by: bapt, Mikko Lehto Tested by: Mikko Lehto MFC after: 1 week Fixes: b0b2d05fd060 ("Split body of mails not respecting...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36763 (cherry picked from commit 169487223143b1232ec4686b720b028af8d6d42b) --- contrib/dma/mail.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/dma/mail.c b/contrib/dma/mail.c index 9641818b8814..aa8d51c28d56 100644 --- a/contrib/dma/mail.c +++ b/contrib/dma/mail.c @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -418,8 +419,14 @@ readmail(struct queue *queue, int nodot, int recp_from_header) * If we fix it, it better be the last line of * the file. */ - line[linelen] = '\n'; - line[linelen + 1] = 0; + if ((size_t)linelen + 1 > linecap) { + line = realloc(line, linelen + 2); + if (line == NULL) + errlogx(EX_SOFTWARE, "realloc"); + linecap = malloc_usable_size(line); + } + line[linelen++] = '\n'; + line[linelen] = 0; had_last_line = 1; } if (!had_first_line) {