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
ec23aeb5
Commit
ec23aeb5
authored
Jul 14, 2011
by
Owen Rudge
Committed by
Alexandre Julliard
Jul 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemapi: Escape subject and body before building mailto URL.
parent
a6a7bceb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
4 deletions
+42
-4
sendmail.c
dlls/winemapi/sendmail.c
+42
-4
No files found.
dlls/winemapi/sendmail.c
View file @
ec23aeb5
...
...
@@ -38,6 +38,37 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
winemapi
);
/* Escapes a string for use in mailto: URL */
static
char
*
escape_string
(
char
*
in
,
char
*
empty_string
)
{
HRESULT
res
;
DWORD
size
;
char
*
escaped
=
NULL
;
if
(
!
in
)
return
empty_string
;
size
=
1
;
res
=
UrlEscapeA
(
in
,
empty_string
,
&
size
,
URL_ESCAPE_PERCENT
|
URL_ESCAPE_SEGMENT_ONLY
);
if
(
res
==
E_POINTER
)
{
escaped
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
escaped
)
return
in
;
/* If for some reason UrlEscape fails, just send the original text */
if
(
UrlEscapeA
(
in
,
escaped
,
&
size
,
URL_ESCAPE_PERCENT
|
URL_ESCAPE_SEGMENT_ONLY
)
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
escaped
);
escaped
=
in
;
}
}
return
escaped
?
escaped
:
empty_string
;
}
/**************************************************************************
* MAPISendMail
*
...
...
@@ -62,8 +93,8 @@ ULONG WINAPI MAPISendMail(LHANDLE session, ULONG_PTR uiparam,
unsigned
int
i
,
to_count
=
0
,
cc_count
=
0
,
bcc_count
=
0
;
unsigned
int
to_size
=
0
,
cc_size
=
0
,
bcc_size
=
0
,
subj_size
,
body_size
;
char
*
to
=
NULL
,
*
cc
=
NULL
,
*
bcc
=
NULL
;
const
char
*
address
,
*
subject
,
*
body
;
char
*
to
=
NULL
,
*
cc
=
NULL
,
*
bcc
=
NULL
,
*
subject
=
NULL
,
*
body
=
NULL
;
const
char
*
address
;
static
const
char
format
[]
=
"mailto:
\"
%s
\"
?subject=
\"
%s
\"
&cc=
\"
%s
\"
&bcc=
\"
%s
\"
&body=
\"
%s
\"
"
;
static
const
char
smtp
[]
=
"smtp:"
;
...
...
@@ -126,8 +157,9 @@ ULONG WINAPI MAPISendMail(LHANDLE session, ULONG_PTR uiparam,
if
(
message
->
nFileCount
)
FIXME
(
"Ignoring attachments
\n
"
);
subject
=
message
->
lpszSubject
?
message
->
lpszSubject
:
""
;
body
=
message
->
lpszNoteText
?
message
->
lpszNoteText
:
""
;
/* Escape subject and body */
subject
=
escape_string
(
message
->
lpszSubject
,
empty_string
);
body
=
escape_string
(
message
->
lpszNoteText
,
empty_string
);
TRACE
(
"Subject: %s
\n
"
,
debugstr_a
(
subject
));
TRACE
(
"Body: %s
\n
"
,
debugstr_a
(
body
));
...
...
@@ -245,6 +277,12 @@ exit:
HeapFree
(
GetProcessHeap
(),
0
,
mailto
);
HeapFree
(
GetProcessHeap
(),
0
,
escape
);
if
(
subject
!=
empty_string
)
HeapFree
(
GetProcessHeap
(),
0
,
subject
);
if
(
body
!=
empty_string
)
HeapFree
(
GetProcessHeap
(),
0
,
body
);
return
ret
;
}
...
...
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