From 5d003c95923bce6c630e7c37873d667d0c273d0f Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Thu, 13 Dec 2001 17:34:52 +0000 Subject: [PATCH] * i387-nat.c (i387_fill_fxsave): Change type of ``val'' from char to short so that we don't memcpy() beyond the end of this buffer. Also, change shift value used in computing val to account for the fact that only eight bits are used. --- gdb/ChangeLog | 7 +++++++ gdb/i387-nat.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3e112592ddd..1ea3b1b990b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2001-12-13 Kevin Buettner + + * i387-nat.c (i387_fill_fxsave): Change type of ``val'' from char + to short so that we don't memcpy() beyond the end of this buffer. + Also, change shift value used in computing val to account for the + fact that only eight bits are used. + 2001-12-13 Corinna Vinschen * Makefile.in: Add support for xstormy16. diff --git a/gdb/i387-nat.c b/gdb/i387-nat.c index b15184e5d51..f792336d382 100644 --- a/gdb/i387-nat.c +++ b/gdb/i387-nat.c @@ -270,7 +270,7 @@ i387_fill_fxsave (char *fxsave, int regnum) { /* Converting back is much easier. */ - unsigned char val = 0; + unsigned short val = 0; unsigned short ftag; int fpreg; @@ -281,7 +281,7 @@ i387_fill_fxsave (char *fxsave, int regnum) int tag = (ftag >> (fpreg * 2)) & 3; if (tag != 3) - val |= (1 << (fpreg * 2)); + val |= (1 << fpreg); } memcpy (FXSAVE_ADDR (fxsave, i), &val, 2); -- 2.30.2