From nobody Wed Oct 12 15:59:41 2022 X-Original-To: dev-commits-src-main@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 4MncmF2zc4z4ffBp; Wed, 12 Oct 2022 15:59:41 +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 4MncmF2SNJz3Lxy; Wed, 12 Oct 2022 15:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665590381; 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=d1zrjlVj5B/aPN8T8TITI4o/E5X9UDbBav3emjNE/ss=; b=Fv1rEMWHfioF31iLKuAO08HZuTimxLCnNC4eadS0ZF8Jry382W8+0r9lFJ/SHySdDjNq/Y umJHM6uinH9D3ix71okG9LRIgEiuuBtwnQJx5H3swvhsPZ9lIdxkokVpxgomtHbLvN15TK YvjRFkF9j64Yds35Aq7nTkpFfXp1ZbCAFK25dEtpbDhAsaBx1/B1i/tP6be/HeUZSEJZ2I lDIOVzoOjLlmlSnau8nxCONI3IPNJzgv+faZeYJ3/aKWonE8sj7yqXgcGdJU8fYjeHnErt 1wsrf9YOBkRnomu6rvBYgNEFrZ522G1rZezYek7qGuYwAxMpkwMUzI+uq49uLA== 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 4MncmF1Vzvz1MDD; Wed, 12 Oct 2022 15:59:41 +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 29CFxfvC044931; Wed, 12 Oct 2022 15:59:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29CFxf3P044930; Wed, 12 Oct 2022 15:59:41 GMT (envelope-from git) Date: Wed, 12 Oct 2022 15:59:41 GMT Message-Id: <202210121559.29CFxf3P044930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 169487223143 - main - dma: restore addition of newline when missing from input List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 169487223143b1232ec4686b720b028af8d6d42b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665590381; 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=d1zrjlVj5B/aPN8T8TITI4o/E5X9UDbBav3emjNE/ss=; b=qrLjG22k1zw24mpREUJBWm71VTz058jZ9IfDjjyatu/VOuaEJgthsuakuo96t3kHHvHq6h S4YcKCWfeF5pgz2av3XRM7ROe6lv7pdlxhvLBtFV4jlfhtA2j8cpC5LdKRJxaqVSaJ1WIT WjRX8H3lWAkP1YLHMzBnnYpiR4PRU+RjJ/boVYemRjXr8HbFsiqUk0C2sn5su3VFDpoWtx NKhMickJhxYr8sW9GNb5k5Eo0nPWvQxuiI/kunDY7dhLG2WY0YIrsryC5g/e7HQCQ/TLLu UbpmgLWs3N86qvRJQtTKlw0D8/KylnsRmsY569JAIgdBqbe6T3i32nrwRCw72A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665590381; a=rsa-sha256; cv=none; b=LVIT9ZAxWN31B538irSZ3lv5wwq8Y7qHM7HdH3Prrkm2BUk/8W1RFHFZvNyOvvV5LVYdaP opt7+ghKk9IBwstTJFlm6XAUGby6T9nzDTkky9/ueKzW/jSKI+GE+aG5jmKXj1Rs7fRa/F DveZUI3K73jLAmy5V86vdKvQiRPM3BxrObFYzbxFSU0ydxLh32RuQuloVeAi/4wSzDhwq2 F8QBJsRqu02dgq8gXjWUp/wMNQQeA/uGYifCgCrWhep/mvJNyCiAlDsm3fGwQyLh8uUYWJ CH0D4Epg4D1LHrAJn2+2rbBlwQ+fSwpn7SKMs1HMxtzrJWd4p+l2uMBmnO8K1Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=169487223143b1232ec4686b720b028af8d6d42b commit 169487223143b1232ec4686b720b028af8d6d42b Author: Ed Maste AuthorDate: 2022-09-27 19:19:19 +0000 Commit: Ed Maste CommitDate: 2022-10-12 15:59:01 +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 --- 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) {