On Fri, Aug 09, 2019 at 11:35:46PM +0200, Stefan Sperling wrote:
> @@ -496,7 +496,8 @@ ed_patch_lines(struct rcs_lines *dlines, struct rcs_li
> if (lp == NULL)
> errx(1, "ed_patch_lines");
>
> - if (!memcmp(lp->l_line, ".", 1))
> + if (lp->l_len >= 2 &&
> + !memcmp(lp->l_line, ".", lp->l_len - 2))
> break;
>
> TAILQ_REMOVE(&(plines->l_lines), lp, l_list);
Actually, the above memcpy call is not such a great idea.
This diff is simpler and also fixes the problem:
diff e875c3a0682a8180b4f2b861af260412eca02c28 /usr/src
blob - 16cc1b29ff5f7ecd37951b7e464496f0f0b9d6fa
file + usr.bin/rcs/diff3.c
--- usr.bin/rcs/diff3.c
+++ usr.bin/rcs/diff3.c
@@ -496,7 +496,7 @@ ed_patch_lines(struct rcs_lines *dlines, struct rcs_li
if (lp == NULL)
errx(1, "ed_patch_lines");
- if (!memcmp(lp->l_line, ".", 1))
+ if (lp->l_len == 2 && lp->l_line[0] == '.')
break;
TAILQ_REMOVE(&(plines->l_lines), lp, l_list);