Avoid undefined behaviour when copying part of structure
* src/dispnew.c (copy_row_except_pointers): Don't use address of
subobject as starting point.
(cherry picked from commit 6943786b5c)
This commit is contained in:
committed by
Eli Zaretskii
parent
c4daff9cf8
commit
de9d27f679
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user