Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
df7ba781
authored
9 years ago
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mtapi_network_c: buffer pop operations set values to zero on failure
parent
55a04f15
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
mtapi_network_c/src/embb_mtapi_network_buffer.c
+4
-0
No files found.
mtapi_network_c/src/embb_mtapi_network_buffer.c
View file @
df7ba781
...
...
@@ -107,6 +107,7 @@ int embb_mtapi_network_buffer_pop_front_int8(
embb_mtapi_network_buffer_t
*
that
,
int8_t
*
value
)
{
if
(
that
->
position
+
1
>
that
->
size
)
{
*
value
=
0
;
return
0
;
}
memcpy
(
value
,
that
->
data
+
that
->
position
,
1
);
...
...
@@ -118,6 +119,7 @@ int embb_mtapi_network_buffer_pop_front_int16(
embb_mtapi_network_buffer_t
*
that
,
int16_t
*
value
)
{
if
(
that
->
position
+
2
>
that
->
size
)
{
*
value
=
0
;
return
0
;
}
memcpy
(
value
,
that
->
data
+
that
->
position
,
2
);
...
...
@@ -129,6 +131,7 @@ int embb_mtapi_network_buffer_pop_front_int32(
embb_mtapi_network_buffer_t
*
that
,
int32_t
*
value
)
{
if
(
that
->
position
+
4
>
that
->
size
)
{
*
value
=
0
;
return
0
;
}
memcpy
(
value
,
that
->
data
+
that
->
position
,
4
);
...
...
@@ -141,6 +144,7 @@ int embb_mtapi_network_buffer_pop_front_rawdata(
int32_t
size
,
void
*
rawdata
)
{
if
(
that
->
position
+
size
>
that
->
size
)
{
memset
(
rawdata
,
0
,
(
size_t
)
size
);
return
0
;
}
memcpy
(
rawdata
,
that
->
data
+
that
->
position
,
(
size_t
)
size
);
...
...
This diff is collapsed.
Click to expand it.
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