git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug Report: Duplicate condition in read_author_script (sequencer.c)
@ 2022-10-03  6:39 Michael V. Scovetta
  2022-10-03  8:45 ` [PATCH] sequencer: detect author name errors in read_author_script() Jeff King
  0 siblings, 1 reply; 11+ messages in thread
From: Michael V. Scovetta @ 2022-10-03  6:39 UTC (permalink / raw)
  To: git

Hello!
I noticed a duplicate condition in the read_author_script function
defined in sequencer.c. I reported this initially to the security
mailing list, but folks there thought it was unlikely to be
interesting from a security perspective, and advised me to report it
here.

In commit 2a7d63a2, sequencer.c:912 looks like:
912  if (name_i == -2)
913      error(_("missing 'GIT_AUTHOR_NAME'"));
914  if (email_i == -2)
915      error(_("missing 'GIT_AUTHOR_EMAIL'"));
916  if (date_i == -2)
917      error(_("missing 'GIT_AUTHOR_DATE'"));
918  if (date_i < 0 || email_i < 0 || date_i < 0 || err)    <-- date_i
is referenced here twice
919      goto finish;

I'm fairly sure that line 918 should be:
918  if (name_i < 0 || email_i < 0 || date_i < 0 || err)

I haven't validated this, but I suspect that if
`rebase-merge/author-script` contained two GIT_AUTHOR_NAME fields,
then name_i would be set to -1 (by the error function), but control
wouldn't flow to finish, but instead to line 920 ( *name =
kv.items[name_i].util; ) where it would attempt to access memory
slightly outside of items' memory space.

I haven't been able to actually trigger the bug, but strongly suspect
I'm just not familiar enough with how rebasing works under the covers.

I can dig into this deeper if you'd like, but it looks like an obvious
typo or copy/paste error. Is this something that a maintainer would be
able to take from here?

Thanks so much!!

Mike

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-10-03 18:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03  6:39 Bug Report: Duplicate condition in read_author_script (sequencer.c) Michael V. Scovetta
2022-10-03  8:45 ` [PATCH] sequencer: detect author name errors in read_author_script() Jeff King
2022-10-03  9:29   ` Phillip Wood
2022-10-03 17:15     ` Jeff King
2022-10-03  9:40   ` Ævar Arnfjörð Bjarmason
2022-10-03 17:27     ` Jeff King
2022-10-03 17:39       ` Jeff King
2022-10-03 18:05         ` Junio C Hamano
2022-10-03 16:34   ` Junio C Hamano
2022-10-03 17:35   ` Jeff King
2022-10-03 18:07     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).