From nobody Fri Nov 18 20:59:49 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 4NDTgV1VRmz4hHd7; Fri, 18 Nov 2022 20:59:50 +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 4NDTgV0s7Bz3qVq; Fri, 18 Nov 2022 20:59:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668805190; 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=8tRdxBmRk5RT9krs0QnEU0TmqnXfU815xILo9duBKnY=; b=I3ky3pI/ohE/zVe/f6ZM7wg76o5QJsm5KEO9k1Akal7kf5mRRqp0/X8g5n5c/ntLPY+Xki owLq/nHrqiUaUlWIW814VnJ8aLa8+KAvqDanaPHOCDqL+ddKfolyGpPRmbTjHAjuFT16vv nq9DisGr165JuI/LJXZP+njIvtGo5lbxPNXcNZ4nPlAqesK3qbUZ02NNOX5cMGB2p0Lj94 vkVqxIpIgrnm5Jwgt7TOs+2904mQkdZLcIdvY4NteflCyPB39XLI2u5puE2Kv0K4BsRbd3 ZeKJRkTUqqH1mSG9h2lqhCKkOpaPIO5neUfN44o6neZpZ+dMj8TUEK7nSyRacg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668805190; 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=8tRdxBmRk5RT9krs0QnEU0TmqnXfU815xILo9duBKnY=; b=bJhzWLR2KM/w0Z/sZkI3T6dsbPu75C2OThAWK/nQCOFSmnC2Q5QOkSwU0D4antuIi4AgxI cdsTw4I/juGQDswqrGO1j/6VGsl/59JbgVOXC4hPQnJiRpeTvGAFQkNAc3CjqkwnRFsHgQ dzIPeJQ3BA5IIJ2Lxws06lRQKmO73WjRKtyN3R5oRYqlu4fTOxTIJpQmWw9dyxtX3EC8pu rBt6OqpWjtTx3Eh1Z5rhcyxpJ2D2+epxSoIzufybDXteeW+ny4Ra5YGgREIBPttMymfsQ/ v9EWWUSJdssd5/1KvGIhlFYrFLZBCKgQmBMKK7PGB+M2BaN9IL8zEomK+SNBsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668805190; a=rsa-sha256; cv=none; b=fIWqZJx7C/iiuxpl2tfs+mUJlIt6E8uEyy8WF/jPRP2Cm+cwjtZOATArp1Rnf8Sn99anbq nCSr5sY1oeLMAUe+SrEvmFj73Ln9+oDZfBn4UNLAMgaTS25Wgim7UVXUIrEfXygUaXJqqx W9M8gQoKDk8Ho+oVl/jd0D/S+IFY41CQoofh213AKm164gKwZoYMbUfqE6W9Z7XOMDwB9J dI5hq4gLnyJcZlbABN3lo484qcG4Gyi9f2LGhKc5UU0IaSCM8uqaueOvPjig6j5D6ddaD7 gqFbAY0sOorZ3mh2g49KZM3lOR6sD8EAi0crbta37XtOyJAKfvYZ4VMDpfo+fg== 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 4NDTgT6yx8zKys; Fri, 18 Nov 2022 20:59:49 +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 2AIKxnYO043481; Fri, 18 Nov 2022 20:59:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AIKxnEj043480; Fri, 18 Nov 2022 20:59:49 GMT (envelope-from git) Date: Fri, 18 Nov 2022 20:59:49 GMT Message-Id: <202211182059.2AIKxnEj043480@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: de0b782545f7 - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: de0b782545f725e719f9b3f1ec7f2e6442551086 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=de0b782545f725e719f9b3f1ec7f2e6442551086 commit de0b782545f725e719f9b3f1ec7f2e6442551086 Author: Ed Maste AuthorDate: 2022-09-27 19:19:19 +0000 Commit: Ed Maste CommitDate: 2022-11-18 20:57:45 +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) (cherry picked from commit bd3d597a6bc0e35273669cfd7a99b3a5b437d92a) --- 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) {