From 6943786b5c1fe76ea05a3a810512bd6777883710 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 29 Nov 2021 10:29:40 +0100 Subject: [PATCH] Avoid undefined behaviour when copying part of structure * src/dispnew.c (copy_row_except_pointers): Don't use address of subobject as starting point. --- src/dispnew.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dispnew.c b/src/dispnew.c index f3f110a8f27..a976bf94c5e 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -1034,7 +1034,7 @@ copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) { enum { off = offsetof (struct glyph_row, x) }; - memcpy (&to->x, &from->x, sizeof *to - off); + memcpy ((char *) to + off, (char *) from + off, sizeof *to - off); } -- 2.39.2