Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sleuthkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Sleuthkit
Commits
2f0a62ff
Commit
2f0a62ff
authored
7 years ago
by
Brian Carrier
Browse files
Options
Downloads
Patches
Plain Diff
Added comments and catch exception of vector can't be resized
parent
a8364cdf
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
rejistry++/src/ByteBuffer.cpp
+16
-1
16 additions, 1 deletion
rejistry++/src/ByteBuffer.cpp
rejistry++/src/RegistryByteBuffer.cpp
+4
-1
4 additions, 1 deletion
rejistry++/src/RegistryByteBuffer.cpp
rejistry++/src/RegistryHiveBuffer.cpp
+4
-0
4 additions, 0 deletions
rejistry++/src/RegistryHiveBuffer.cpp
with
24 additions
and
2 deletions
rejistry++/src/ByteBuffer.cpp
+
16
−
1
View file @
2f0a62ff
...
...
@@ -36,10 +36,18 @@ namespace Rejistry {
_buffer
.
resize
(
capacity
);
}
/**
* Makes a copy of the passed in buffer.
* @throws RegistryParseException if memory can't be allocated
*/
ByteBuffer
::
ByteBuffer
(
const
uint8_t
*
buf
,
const
uint32_t
length
)
:
Buffer
(
length
)
{
initializeBuffer
(
buf
,
length
);
}
/**
* Makes a copy of the passed in buffer.
* @throws RegistryParseException if memory can't be allocated
*/
ByteBuffer
::
ByteBuffer
(
const
ByteArray
&
buf
,
const
uint32_t
length
)
:
Buffer
(
length
)
{
if
(
buf
.
size
()
>
0
)
{
initializeBuffer
(
&
buf
[
0
],
length
);
...
...
@@ -47,7 +55,14 @@ namespace Rejistry {
}
void
ByteBuffer
::
initializeBuffer
(
const
uint8_t
*
buf
,
const
uint32_t
length
)
{
_buffer
.
resize
(
length
);
try
{
_buffer
.
resize
(
length
);
}
catch
(
std
::
bad_alloc
&
e
)
{
throw
RegistryParseException
(
"Cannot allocate memory for registry byte buffer."
);
}
if
(
buf
!=
NULL
)
{
memcpy
(
&
_buffer
[
0
],
buf
,
length
);
}
...
...
This diff is collapsed.
Click to expand it.
rejistry++/src/RegistryByteBuffer.cpp
+
4
−
1
View file @
2f0a62ff
...
...
@@ -39,7 +39,10 @@
namespace
Rejistry
{
std
::
wstring_convert
<
std
::
codecvt_utf16
<
wchar_t
,
0x10ffff
,
std
::
little_endian
>
,
wchar_t
>
conv
;
/**
* Does NOT make a copy of the passed in buffer, but will free the memory when deleted
*/
RegistryByteBuffer
::
RegistryByteBuffer
(
ByteBuffer
*
buffer
)
{
if
(
buffer
==
NULL
)
{
throw
std
::
invalid_argument
(
"Buffer must not be null."
);
...
...
This diff is collapsed.
Click to expand it.
rejistry++/src/RegistryHiveBuffer.cpp
+
4
−
0
View file @
2f0a62ff
...
...
@@ -31,6 +31,10 @@
namespace
Rejistry
{
/**
* Makes a copy of the passed in buffer.
* @throws RegistryParseException if memory can't be allocated
*/
RegistryHiveBuffer
::
RegistryHiveBuffer
(
const
uint8_t
*
buffer
,
const
uint32_t
size
)
{
_buffer
=
new
RegistryByteBuffer
(
new
ByteBuffer
(
buffer
,
size
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment