<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/mailinfo.c, branch v2.40.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.40.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.40.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-10-03T16:05:07Z</updated>
<entry>
<title>mailinfo -b: fix an out of bounds access</title>
<updated>2022-10-03T16:05:07Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2022-10-03T09:23:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3ef1494685dea925d4e98ed06d9ea3fb5b3ecb89'/>
<id>urn:sha1:3ef1494685dea925d4e98ed06d9ea3fb5b3ecb89</id>
<content type='text'>
To remove bracketed strings containing "PATCH" from the subject line
cleanup_subject() scans the subject for the opening bracket using an
offset from the beginning of the line. It then searches for the
closing bracket with strchr(). To calculate the length of the
bracketed string it unfortunately adds rather than subtracts the
offset from the result of strchr(). This leads to an out of bounds
access in memmem() when looking to see if the brackets contain
"PATCH".

We have tests that trigger this bug that were added in ae52d57f0b
(t5100: add some more mailinfo tests, 2017-05-31). The commit message
mentions that they are marked test_expect_failure as they trigger an
assertion in strbuf_splice(). While it is reassuring that
strbuf_splice() detects the problem and dies in retrospect that should
perhaps have warranted a little more investigation. The bug was
introduced by 17635fc900 (mailinfo: -b option keeps [bracketed]
strings that is not a [PATCH] marker, 2009-07-15). I think the reason
it has survived so long is that '-b' is not a popular option and
without it the offset is always zero.

This was found by the address sanitizer while I was cleaning up the
test_todo idea in [1].

[1] https://lore.kernel.org/git/db558292-2783-3270-4824-43757822a389@gmail.com/

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tree-wide: apply equals-null.cocci</title>
<updated>2022-05-02T16:50:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-05-02T16:50:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=afe8a9070bc62db9cfde1e30147178c40d391d93'/>
<id>urn:sha1:afe8a9070bc62db9cfde1e30147178c40d391d93</id>
<content type='text'>
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ar/mailinfo-memcmp-to-skip-prefix'</title>
<updated>2021-07-08T20:15:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-07-08T20:15:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c08e112b437b3112a05d1245cbb723d910ff8455'/>
<id>urn:sha1:c08e112b437b3112a05d1245cbb723d910ff8455</id>
<content type='text'>
Code clean-up.

* ar/mailinfo-memcmp-to-skip-prefix:
  mailinfo: use starts_with() when checking scissors
</content>
</entry>
<entry>
<title>Merge branch 'ef/mailinfo-short-name'</title>
<updated>2021-06-10T03:04:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-06-10T03:04:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=26b25e03b204548d08fd6a284f24c65ef2cbcba0'/>
<id>urn:sha1:26b25e03b204548d08fd6a284f24c65ef2cbcba0</id>
<content type='text'>
We historically rejected a very short string as an author name
while accepting a patch e-mail, which has been loosened.

* ef/mailinfo-short-name:
  mailinfo: don't discard names under 3 characters
</content>
</entry>
<entry>
<title>mailinfo: use starts_with() when checking scissors</title>
<updated>2021-06-09T02:13:07Z</updated>
<author>
<name>Andrei Rybak</name>
<email>rybak.a.v@gmail.com</email>
</author>
<published>2021-06-08T20:48:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4184cbd635140e83c5f0d57c377eec93a9b6eedf'/>
<id>urn:sha1:4184cbd635140e83c5f0d57c377eec93a9b6eedf</id>
<content type='text'>
Existing checks for scissors characters using memcmp(3) never read past
the end of the line, because all substrings we are interested in are two
characters long, and the outer loop guarantees we have at least one
character.  So at most we will look at the NUL.

However, this is too subtle and may lead to bugs in code which copies
this behavior without realizing substring length requirement.  So use
starts_with() instead, which will stop at NUL regardless of the length
of the prefix.  Remove extra pair of parentheses while we are here.

Helped-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Andrei Rybak &lt;rybak.a.v@gmail.com&gt;
Acked-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mailinfo: don't discard names under 3 characters</title>
<updated>2021-05-16T22:35:43Z</updated>
<author>
<name>edef</name>
<email>edef@edef.eu</email>
</author>
<published>2021-05-16T15:07:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=72ee47ceebc7d3ddbd31942b28f9fe47f00b0540'/>
<id>urn:sha1:72ee47ceebc7d3ddbd31942b28f9fe47f00b0540</id>
<content type='text'>
I sometimes receive patches from people with short mononyms, and in my
cultural environment these are not uncommon. To my dismay, git-am
currently discards their names, and replaces them with their email
addresses.

Link: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
Signed-off-by: edef &lt;edef@edef.eu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'dd/mailinfo-quoted-cr'</title>
<updated>2021-05-16T12:05:23Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-05-16T12:05:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=483932a3d8dae23207de8ec8683a5236ef3098d9'/>
<id>urn:sha1:483932a3d8dae23207de8ec8683a5236ef3098d9</id>
<content type='text'>
"git mailinfo" (hence "git am") learned the "--quoted-cr" option to
control how lines ending with CRLF wrapped in base64 or qp are
handled.

* dd/mailinfo-quoted-cr:
  am: learn to process quoted lines that ends with CRLF
  mailinfo: allow stripping quoted CR without warning
  mailinfo: allow squelching quoted CRLF warning
  mailinfo: warn if CRLF found in decoded base64/QP email
  mailinfo: stop parsing options manually
  mailinfo: load default metainfo_charset lazily
</content>
</entry>
<entry>
<title>mailinfo: allow stripping quoted CR without warning</title>
<updated>2021-05-10T06:06:22Z</updated>
<author>
<name>Đoàn Trần Công Danh</name>
<email>congdanhqx@gmail.com</email>
</author>
<published>2021-05-09T17:12:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=133a4fda59e7e68be13191082e14be32143bd61b'/>
<id>urn:sha1:133a4fda59e7e68be13191082e14be32143bd61b</id>
<content type='text'>
In previous changes, we've turned on warning for quoted CR in base64 or
quoted-printable email messages. Some projects see those quoted CR a lot,
they know that it happens most of the time, and they find it's desirable
to always strip those CR.

Those projects in question usually fall back to use other tools to handle
patches when receive such patches.

Let's help those projects handle those patches by stripping those
excessive CR.

Signed-off-by: Đoàn Trần Công Danh &lt;congdanhqx@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mailinfo: allow squelching quoted CRLF warning</title>
<updated>2021-05-10T06:06:22Z</updated>
<author>
<name>Đoàn Trần Công Danh</name>
<email>congdanhqx@gmail.com</email>
</author>
<published>2021-05-09T17:12:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f1aa29944320e51441e5b5e32591e69f2fa74de2'/>
<id>urn:sha1:f1aa29944320e51441e5b5e32591e69f2fa74de2</id>
<content type='text'>
In previous change, Git starts to warn for quoted CRLF in decoded
base64/QP email. Despite those warnings are usually helpful,
quoted CRLF could be part of some users' workflow.

Let's give them an option to turn off the warning completely.

Signed-off-by: Đoàn Trần Công Danh &lt;congdanhqx@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>mailinfo: warn if CRLF found in decoded base64/QP email</title>
<updated>2021-05-10T06:06:22Z</updated>
<author>
<name>Đoàn Trần Công Danh</name>
<email>congdanhqx@gmail.com</email>
</author>
<published>2021-05-09T17:12:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0b689562cafc05b1a36bdea3d025c9ecdf2514bd'/>
<id>urn:sha1:0b689562cafc05b1a36bdea3d025c9ecdf2514bd</id>
<content type='text'>
When SMTP servers receive 8-bit email messages, possibly with only
LF as line ending, some of them decide to change said LF to CRLF.

Some mailing list softwares, when receive 8-bit email messages,
decide to encode those messages in base64 or quoted-printable.

If an email is transfered through above mail servers, then distributed
by such mailing list softwares, the recipients will receive an email
contains a patch mungled with CRLF encoded inside another encoding.

Thus, such CR (in CRLF) couldn't be dropped by "mailsplit".
Hence, the mailed patch couldn't be applied cleanly.
Such accidents have been observed in the wild [1].

Instead of silently rejecting those messages, let's give our users
some warnings if such CR (as part of CRLF) is found.

[1]: https://nmbug.notmuchmail.org/nmweb/show/m2lf9ejegj.fsf%40guru.guru-group.fi

Signed-off-by: Đoàn Trần Công Danh &lt;congdanhqx@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
