Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ebc5fe96
Commit
ebc5fe96
authored
Jan 20, 2001
by
Ulrich Czekalla
Committed by
Alexandre Julliard
Jan 20, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent buffer overflow in TEXT_NextLineW.
parent
9086d42d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
text.c
dlls/user/text.c
+7
-3
No files found.
dlls/user/text.c
View file @
ebc5fe96
...
...
@@ -49,7 +49,7 @@ static int prefix_offset;
* str - string to parse into lines.
* count - length of str.
* dest - destination in which to return line.
* len -
length of resultant line in dest in chars
.
* len -
dest buffer size in chars on input, copied length into dest on output
.
* width - maximum width of line in pixels.
* format - format type passed to DrawText.
*
...
...
@@ -70,8 +70,9 @@ static const WCHAR *TEXT_NextLineW( HDC hdc, const WCHAR *str, int *count,
SIZE
size
;
int
lasttab
=
0
;
int
wb_i
=
0
,
wb_j
=
0
,
wb_count
=
0
;
int
maxl
=
*
len
;
while
(
*
count
)
while
(
*
count
&&
j
<
maxl
)
{
switch
(
str
[
i
])
{
...
...
@@ -223,12 +224,13 @@ INT16 WINAPI DrawText16( HDC16 hdc, LPCSTR str, INT16 count, LPRECT16 rect, UINT
/***********************************************************************
* DrawTextExW (USER32.166)
*/
#define MAX_STATIC_BUFFER 1024
INT
WINAPI
DrawTextExW
(
HDC
hdc
,
LPCWSTR
str
,
INT
i_count
,
LPRECT
rect
,
UINT
flags
,
LPDRAWTEXTPARAMS
dtp
)
{
SIZE
size
;
const
WCHAR
*
strPtr
;
static
WCHAR
line
[
1024
];
static
WCHAR
line
[
MAX_STATIC_BUFFER
];
int
len
,
lh
,
count
=
i_count
;
int
prefix_x
=
0
;
int
prefix_end
=
0
;
...
...
@@ -272,6 +274,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPCWSTR str, INT i_count,
do
{
prefix_offset
=
-
1
;
len
=
MAX_STATIC_BUFFER
;
strPtr
=
TEXT_NextLineW
(
hdc
,
strPtr
,
&
count
,
line
,
&
len
,
width
,
flags
);
if
(
prefix_offset
!=
-
1
)
...
...
@@ -339,6 +342,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPCWSTR str, INT i_count,
strncpyW
(
swapStr
+
strlenW
(
swapStr
),
str
,
totalLen
);
}
len
=
MAX_STATIC_BUFFER
;
TEXT_NextLineW
(
hdc
,
swapStr
,
&
count
,
line
,
&
len
,
width
,
flags
);
/* if only the ELLIPSIS will fit, just let it be clipped */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment