diff mbox series

[v2,1/4] am: fail if no author line is given in --rebasing mode

Message ID 20190905224833.24913-1-s-beyer@gmx.net (mailing list archive)
State New, archived
Headers show
Series [v2,1/4] am: fail if no author line is given in --rebasing mode | expand

Commit Message

Stephan Beyer Sept. 5, 2019, 10:48 p.m. UTC
This prevents a potential segmentation fault.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
---
 builtin/am.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.23.0.43.g31ebfd7ae6.dirty

Comments

Stephan Beyer Sept. 6, 2019, 12:39 p.m. UTC | #1
Hi,

just to make it also clear in this thread: you can ignore this patch
series in favor of the better patch series by Peff [1] that has found
its way to the mailing list at the same time.

1.
https://public-inbox.org/git/20190905224859.GA28660@sigill.intra.peff.net/

Stephan
diff mbox series

Patch

diff --git a/builtin/am.c b/builtin/am.c
index 1aea657a7f..71da34913c 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1272,7 +1272,8 @@  static void get_commit_info(struct am_state *state, struct commit *commit)
 	buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());

 	ident_line = find_commit_header(buffer, "author", &ident_len);
-
+	if (!ident_line)
+		die(_("no author line"));
 	if (split_ident_line(&id, ident_line, ident_len) < 0)
 		die(_("invalid ident line: %.*s"), (int)ident_len, ident_line);