Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4bddbe8b
Commit
4bddbe8b
authored
Apr 02, 2003
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Apr 02, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix buffer overflow in datetime.
parent
9e3772f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
datetime.c
dlls/comctl32/datetime.c
+9
-8
No files found.
dlls/comctl32/datetime.c
View file @
4bddbe8b
...
...
@@ -356,7 +356,7 @@ DATETIME_SetFormatW (HWND hwnd, WPARAM wParam, LPARAM lParam)
static
void
DATETIME_ReturnTxt
(
DATETIME_INFO
*
infoPtr
,
int
count
,
char
*
result
)
DATETIME_ReturnTxt
(
DATETIME_INFO
*
infoPtr
,
int
count
,
char
*
result
,
int
resultSize
)
{
SYSTEMTIME
date
=
infoPtr
->
date
;
int
spec
;
...
...
@@ -375,7 +375,9 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result)
if
(
spec
&
DT_STRING
)
{
int
txtlen
=
infoPtr
->
buflen
[
count
];
strncpy
(
result
,
infoPtr
->
textbuf
+
(
spec
&~
DT_STRING
),
txtlen
);
if
(
txtlen
>
resultSize
)
txtlen
=
resultSize
-
1
;
memcpy
(
result
,
infoPtr
->
textbuf
+
(
spec
&~
DT_STRING
),
txtlen
);
result
[
txtlen
]
=
0
;
TRACE
(
"arg%d=%x->[%s]
\n
"
,
count
,
infoPtr
->
fieldspec
[
count
],
result
);
return
;
...
...
@@ -399,8 +401,7 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result)
break
;
case
FULLDAY
:
GetLocaleInfoA
(
LOCALE_USER_DEFAULT
,
LOCALE_SDAYNAME1
+
(
date
.
wDayOfWeek
+
6
)
%
7
,
buffer
,
sizeof
(
buffer
));
strcpy
(
result
,
buffer
);
result
,
resultSize
);
break
;
case
ONEDIGIT12HOUR
:
if
(
date
.
wHour
>
12
)
...
...
@@ -440,12 +441,12 @@ DATETIME_ReturnTxt (DATETIME_INFO *infoPtr, int count, char *result)
break
;
case
THREECHARMONTH
:
GetLocaleInfoA
(
GetSystemDefaultLCID
(),
LOCALE_SMONTHNAME1
+
date
.
wMonth
-
1
,
buffer
,
sizeof
(
buffer
));
buffer
,
sizeof
(
buffer
));
sprintf
(
result
,
"%.3s"
,
buffer
);
break
;
case
FULLMONTH
:
GetLocaleInfoA
(
GetSystemDefaultLCID
(),
LOCALE_SMONTHNAME1
+
date
.
wMonth
-
1
,
result
,
sizeof
(
result
)
);
result
,
resultSize
);
break
;
case
ONELETTERAMPM
:
if
(
date
.
wHour
<
12
)
...
...
@@ -764,7 +765,7 @@ static void DATETIME_Refresh (HWND hwnd, HDC hdc)
HFONT
oldFont
;
oldFont
=
SelectObject
(
hdc
,
infoPtr
->
hFont
);
DATETIME_ReturnTxt
(
infoPtr
,
0
,
txt
);
DATETIME_ReturnTxt
(
infoPtr
,
0
,
txt
,
sizeof
(
txt
)
);
GetTextExtentPoint32A
(
hdc
,
txt
,
strlen
(
txt
),
&
size
);
rcDraw
->
bottom
=
size
.
cy
+
2
;
...
...
@@ -773,7 +774,7 @@ static void DATETIME_Refresh (HWND hwnd, HDC hdc)
prevright
=
checkbox
->
right
;
for
(
i
=
0
;
i
<
infoPtr
->
nrFields
;
i
++
)
{
DATETIME_ReturnTxt
(
infoPtr
,
i
,
txt
);
DATETIME_ReturnTxt
(
infoPtr
,
i
,
txt
,
sizeof
(
txt
)
);
GetTextExtentPoint32A
(
hdc
,
txt
,
strlen
(
txt
),
&
size
);
field
=
&
infoPtr
->
fieldRect
[
i
];
field
->
left
=
prevright
;
...
...
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