Skip to content

Commit

Permalink
Borland C++: fix out-of-bounds read in tvwrite.cpp
Browse files Browse the repository at this point in the history
I found this while investigating #22, but I doubt this is the cause of that issue, since the disassebly points out to a write instruction.
  • Loading branch information
magiblot committed Dec 24, 2020
1 parent c8046e2 commit 631050d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions source/tvision/tvwrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,10 @@ void TVWrite::copyShort( ushort *dst, const ushort *src )
{
#define loByte(w) (((uchar *)&w)[0])
#define hiByte(w) (((uchar *)&w)[1])
ushort ColorChar;
hiByte(ColorChar) = shadowAttr;
for (i = 0; i < Count - X; ++i)
{
loByte(ColorChar) = src[i];
hiByte(ColorChar) = applyShadow(src[i + 1]);
dst[i] = ColorChar;
loByte(dst[i]) = loByte(src[i]);
hiByte(dst[i]) = applyShadow(hiByte(src[i]));
}
#undef loByte
#undef hiByte
Expand Down

0 comments on commit 631050d

Please sign in to comment.