projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4320180
)
Avoid undefined behaviour when copying part of structure
author
Andreas Schwab
<schwab@linux-m68k.org>
Mon, 29 Nov 2021 09:29:40 +0000
(10:29 +0100)
committer
Andreas Schwab
<schwab@linux-m68k.org>
Mon, 29 Nov 2021 09:30:10 +0000
(10:30 +0100)
* src/dispnew.c (copy_row_except_pointers): Don't use address of
subobject as starting point.
src/dispnew.c
patch
|
blob
|
history
diff --git
a/src/dispnew.c
b/src/dispnew.c
index f3f110a8f27b8e98f42329c6936b05f1a41601ab..a976bf94c5ef8ca1ab1972195ccb0e889e59b1d9 100644
(file)
--- 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);
}