Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
a818b6e8
Commit
a818b6e8
authored
Jun 04, 2018
by
Mouse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue vlm#285 asn_oid_arc_t overflow
parent
ab8eec97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
skeletons/OBJECT_IDENTIFIER.c
skeletons/OBJECT_IDENTIFIER.c
+11
-2
No files found.
skeletons/OBJECT_IDENTIFIER.c
View file @
a818b6e8
...
...
@@ -115,10 +115,14 @@ OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf, size_t arcbuf_len,
return
0
;
}
else
{
asn_oid_arc_t
accum
;
asn_oid_arc_t
upper_limit
=
(
ASN_OID_ARC_MAX
>>
7
);
/* When the value reaches "upper_limit", it can take */
/* at most one more digit. If it exceeds "upper_limit" */
/* but there are more digits - it's an Overflow condition */
/* Gather all bits into the accumulator */
for
(
accum
=
0
;
b
<
arcend
;
b
++
)
{
accum
=
(
accum
<<
7
)
|
(
*
b
&
~
0x80
);
if
((
*
b
&
0x80
)
==
0
)
{
if
((
*
b
&
0x80
)
==
0
)
{
// no more digits
if
(
accum
<=
ASN_OID_ARC_MAX
)
{
*
ret_value
=
accum
;
return
1
+
(
b
-
arcbuf
);
...
...
@@ -126,7 +130,12 @@ OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf, size_t arcbuf_len,
errno
=
ERANGE
;
/* Overflow */
return
-
1
;
}
}
}
else
{
// to make sure we aren't wrapping around
if
(
accum
>
upper_limit
)
{
errno
=
ERANGE
;
/* Overflow */
return
-
1
;
}
}
}
errno
=
EINVAL
;
return
-
1
;
...
...
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