Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Archive
ekiga
Commits
7d098072
Commit
7d098072
authored
Oct 20, 2012
by
Eugen Dedu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate UTF-8 strings before showing them
Closes bug #653009.
parent
b4dcd4a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
14 deletions
+31
-14
lib/engine/components/opal/opal-call.cpp
lib/engine/components/opal/opal-call.cpp
+31
-14
No files found.
lib/engine/components/opal/opal-call.cpp
View file @
7d098072
...
...
@@ -260,7 +260,7 @@ const std::string
Opal
::
Call
::
get_duration
()
const
{
std
::
stringstream
duration
;
if
(
start_time
.
IsValid
()
&&
IsEstablished
())
{
PTimeInterval
t
=
PTime
()
-
start_time
;
...
...
@@ -274,26 +274,39 @@ Opal::Call::get_duration () const
}
time_t
time_t
Opal
::
Call
::
get_start_time
()
const
{
return
start_time
.
GetTimeInSeconds
();
}
bool
bool
Opal
::
Call
::
is_outgoing
()
const
{
return
outgoing
;
}
// if the parameter is not valid utf8, remove from it all the chars
// after the first invalid utf8 char, so that it becomes valid utf8
static
void
make_valid_utf8
(
string
&
str
)
{
const
char
*
pos
;
if
(
!
g_utf8_validate
(
str
.
c_str
(),
-
1
,
&
pos
))
{
PTRACE
(
4
,
"Ekiga
\t
Trimming invalid UTF-8 string: "
<<
str
.
c_str
());
str
=
str
.
substr
(
0
,
pos
-
str
.
c_str
()).
append
(
"..."
);
}
}
void
Opal
::
Call
::
parse_info
(
OpalConnection
&
connection
)
{
char
start_special_chars
[]
=
"$"
;
char
end_special_chars
[]
=
"([;="
;
std
::
string
l_party_name
;
std
::
string
r_party_name
;
std
::
string
app
;
...
...
@@ -315,7 +328,11 @@ Opal::Call::parse_info (OpalConnection & connection)
remote_party_name
=
r_party_name
;
if
(
!
app
.
empty
())
remote_application
=
app
;
make_valid_utf8
(
remote_party_name
);
make_valid_utf8
(
remote_application
);
make_valid_utf8
(
remote_uri
);
strip_special_chars
(
remote_party_name
,
end_special_chars
,
false
);
strip_special_chars
(
remote_application
,
end_special_chars
,
false
);
strip_special_chars
(
remote_uri
,
end_special_chars
,
false
);
...
...
@@ -329,7 +346,7 @@ Opal::Call::parse_info (OpalConnection & connection)
PBoolean
Opal
::
Call
::
OnEstablished
(
OpalConnection
&
connection
)
{
RTP_Session
*
session
=
NULL
;
RTP_Session
*
session
=
NULL
;
OpalMediaStreamPtr
stream
;
NoAnswerTimer
.
Stop
(
false
);
...
...
@@ -347,7 +364,7 @@ Opal::Call::OnEstablished (OpalConnection & connection)
session
=
PDownCast
(
OpalRTPConnection
,
&
connection
)
->
GetSession
(
stream
->
GetSessionID
());
if
(
session
)
{
session
->
SetIgnorePayloadTypeChanges
(
TRUE
);
session
->
SetRxStatisticsInterval
(
50
);
session
->
SetTxStatisticsInterval
(
50
);
...
...
@@ -355,7 +372,7 @@ Opal::Call::OnEstablished (OpalConnection & connection)
}
stream
=
connection
.
GetMediaStream
(
OpalMediaType
::
Video
(),
false
);
if
(
stream
!=
NULL
)
{
if
(
stream
!=
NULL
)
{
session
=
PDownCast
(
OpalRTPConnection
,
&
connection
)
->
GetSession
(
stream
->
GetSessionID
());
if
(
session
)
{
...
...
@@ -366,12 +383,12 @@ Opal::Call::OnEstablished (OpalConnection & connection)
}
}
}
return
OpalCall
::
OnEstablished
(
connection
);
}
void
void
Opal
::
Call
::
OnReleased
(
OpalConnection
&
connection
)
{
parse_info
(
connection
);
...
...
@@ -510,7 +527,7 @@ Opal::Call::OnSetUp (OpalConnection & connection)
new
CallSetup
(
*
this
,
connection
);
return
true
;
return
true
;
}
...
...
@@ -524,9 +541,9 @@ Opal::Call::OnAlerting (OpalConnection & connection)
}
void
Opal
::
Call
::
OnHold
(
OpalConnection
&
/*connection*/
,
bool
/*from_remote*/
,
void
Opal
::
Call
::
OnHold
(
OpalConnection
&
/*connection*/
,
bool
/*from_remote*/
,
bool
on_hold
)
{
if
(
on_hold
)
...
...
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