Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
bbfed6b8
Commit
bbfed6b8
authored
May 16, 2016
by
somdoron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
problem: memory issues, access uninitiailized memory and leak
parent
c4d0146f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
socket_base.cpp
src/socket_base.cpp
+1
-0
udp_engine.cpp
src/udp_engine.cpp
+18
-3
udp_engine.hpp
src/udp_engine.hpp
+1
-1
No files found.
src/socket_base.cpp
View file @
bbfed6b8
...
...
@@ -941,6 +941,7 @@ int zmq::socket_base_t::connect (const char *addr_)
if
(
protocol
==
"udp"
)
{
if
(
options
.
type
!=
ZMQ_RADIO
)
{
errno
=
ENOCOMPATPROTO
;
LIBZMQ_DELETE
(
paddr
);
EXIT_MUTEX
();
return
-
1
;
}
...
...
src/udp_engine.cpp
View file @
bbfed6b8
...
...
@@ -180,16 +180,31 @@ void zmq::udp_engine_t::sockaddr_to_msg (zmq::msg_t *msg, sockaddr_in* addr)
strcat
(
address
,
port
);
}
int
zmq
::
udp_engine_t
::
resolve_raw_address
(
char
*
name_
,
in
t
length_
)
int
zmq
::
udp_engine_t
::
resolve_raw_address
(
char
*
name_
,
size_
t
length_
)
{
const
char
*
delimiter
=
strrchr
(
name_
,
':'
);
memset
(
&
raw_address
,
0
,
sizeof
raw_address
);
const
char
*
delimiter
=
NULL
;
// Find delimiter, cannot use memrchr as it is not supported on windows
if
(
length_
!=
0
)
{
int
chars_left
=
length_
;
char
*
current_char
=
name_
+
length_
;
do
{
if
(
*
(
--
current_char
)
==
':'
)
{
delimiter
=
current_char
;
break
;
}
}
while
(
--
chars_left
!=
0
);
}
if
(
!
delimiter
)
{
errno
=
EINVAL
;
return
-
1
;
}
std
::
string
addr_str
(
name_
,
delimiter
-
name_
);
std
::
string
port_str
(
delimiter
+
1
);
std
::
string
port_str
(
delimiter
+
1
,
name_
+
length_
-
delimiter
-
1
);
// Parse the port number (0 is not a valid port).
uint16_t
port
=
(
uint16_t
)
atoi
(
port_str
.
c_str
());
...
...
src/udp_engine.hpp
View file @
bbfed6b8
...
...
@@ -46,7 +46,7 @@ namespace zmq
private
:
int
resolve_raw_address
(
char
*
addr_
,
in
t
length_
);
int
resolve_raw_address
(
char
*
addr_
,
size_
t
length_
);
void
sockaddr_to_msg
(
zmq
::
msg_t
*
msg
,
sockaddr_in
*
addr
);
bool
plugged
;
...
...
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