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
0dee636a
Commit
0dee636a
authored
6 years ago
by
U-BASIS\dsmyda
Browse files
Options
Downloads
Patches
Plain Diff
Changed postgressql to a malloc since it is large
parent
3862353b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tsk/auto/auto_db.cpp
+18
-16
18 additions, 16 deletions
tsk/auto/auto_db.cpp
tsk/auto/db_postgresql.cpp
+12
-1
12 additions, 1 deletion
tsk/auto/db_postgresql.cpp
with
30 additions
and
17 deletions
tsk/auto/auto_db.cpp
+
18
−
16
View file @
0dee636a
...
@@ -225,22 +225,24 @@ TskAutoDb::addImageDetails(const char* deviceId)
...
@@ -225,22 +225,24 @@ TskAutoDb::addImageDetails(const char* deviceId)
//Need 1MB for libewf read and extra 100 bytes for header name and formatting
//Need 1MB for libewf read and extra 100 bytes for header name and formatting
const
size_t
buffer_size
=
1024100
;
const
size_t
buffer_size
=
1024100
;
char
*
result
=
(
char
*
)
malloc
(
buffer_size
*
sizeof
(
char
));
char
*
result
=
(
char
*
)
malloc
(
buffer_size
*
sizeof
(
char
));
if
(
result
!=
NULL
)
{
//Populate all of the libewf header values for the acquisition details column
//Populate all of the libewf header values for the acquisition details column
collectionDetails
.
append
(
libewf_read_description
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_description
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_case_number
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_case_number
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_evidence_number
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_evidence_number
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_examiner_name
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_examiner_name
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_notes
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_notes
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_model
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_model
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_serial_number
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_serial_number
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_device_label
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_device_label
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_version
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_version
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_platform
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_platform
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_acquired_date
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_acquired_date
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_system_date
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_system_date
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_acquiry_operating_system
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_acquiry_operating_system
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_acquiry_software_version
(
ewf_info
->
handle
,
result
,
buffer_size
));
collectionDetails
.
append
(
libewf_read_acquiry_software_version
(
ewf_info
->
handle
,
result
,
buffer_size
));
free
(
result
);
}
}
}
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
tsk/auto/db_postgresql.cpp
+
12
−
1
View file @
0dee636a
...
@@ -819,7 +819,13 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
...
@@ -819,7 +819,13 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
{
{
// Add the data source to the tsk_objects table.
// Add the data source to the tsk_objects table.
// We don't use addObject because we're passing in NULL as the parent
// We don't use addObject because we're passing in NULL as the parent
char
stmt
[
10242048
];
char
*
stmt
=
(
char
*
)
malloc
(
10242148
*
sizeof
(
char
));
if
(
stmt
==
NULL
)
{
tsk_error_reset
();
tsk_error_set_errno
(
TSK_ERR_AUTO_DB
);
tsk_error_set_errstr
(
"Malloc for statement string failed."
);
return
1
;
}
int
expectedNumFileds
=
1
;
int
expectedNumFileds
=
1
;
snprintf
(
stmt
,
10242048
,
"INSERT INTO tsk_objects (par_obj_id, type) VALUES (NULL, %d) RETURNING obj_id;"
,
TSK_DB_OBJECT_TYPE_IMG
);
snprintf
(
stmt
,
10242048
,
"INSERT INTO tsk_objects (par_obj_id, type) VALUES (NULL, %d) RETURNING obj_id;"
,
TSK_DB_OBJECT_TYPE_IMG
);
PGresult
*
res
=
get_query_result_set
(
stmt
,
"TskDbPostgreSQL::addObj: Error adding object to row: %s (result code %d)
\n
"
);
PGresult
*
res
=
get_query_result_set
(
stmt
,
"TskDbPostgreSQL::addObj: Error adding object to row: %s (result code %d)
\n
"
);
...
@@ -850,6 +856,7 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
...
@@ -850,6 +856,7 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
PQfreemem
(
md5_sql
);
PQfreemem
(
md5_sql
);
PQfreemem
(
sha1_sql
);
PQfreemem
(
sha1_sql
);
PQfreemem
(
sha256_sql
);
PQfreemem
(
sha256_sql
);
free
(
stmt
);
return
1
;
return
1
;
}
}
snprintf
(
stmt
,
10242048
,
"INSERT INTO tsk_image_info (obj_id, type, ssize, tzone, size, md5, sha1, sha256) VALUES (%"
PRId64
", %d, %"
PRIuOFF
", %s, %"
PRIuOFF
", %s, %s, %s);"
,
snprintf
(
stmt
,
10242048
,
"INSERT INTO tsk_image_info (obj_id, type, ssize, tzone, size, md5, sha1, sha256) VALUES (%"
PRId64
", %d, %"
PRIuOFF
", %s, %"
PRIuOFF
", %s, %s, %s);"
,
...
@@ -860,6 +867,7 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
...
@@ -860,6 +867,7 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
PQfreemem
(
sha1_sql
);
PQfreemem
(
sha1_sql
);
PQfreemem
(
sha256_sql
);
PQfreemem
(
sha256_sql
);
if
(
1
==
ret
)
{
if
(
1
==
ret
)
{
free
(
stmt
);
return
ret
;
return
ret
;
}
}
...
@@ -881,12 +889,14 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
...
@@ -881,12 +889,14 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
char
*
deviceId_sql
=
PQescapeLiteral
(
conn
,
deviceId
.
c_str
(),
strlen
(
deviceIdStr
.
str
().
c_str
()));
char
*
deviceId_sql
=
PQescapeLiteral
(
conn
,
deviceId
.
c_str
(),
strlen
(
deviceIdStr
.
str
().
c_str
()));
if
(
!
isEscapedStringValid
(
deviceId_sql
,
deviceId
.
c_str
(),
"TskDbPostgreSQL::addImageInfo: Unable to escape data source string: %s (Error: %s)
\n
"
))
{
if
(
!
isEscapedStringValid
(
deviceId_sql
,
deviceId
.
c_str
(),
"TskDbPostgreSQL::addImageInfo: Unable to escape data source string: %s (Error: %s)
\n
"
))
{
PQfreemem
(
deviceId_sql
);
PQfreemem
(
deviceId_sql
);
free
(
stmt
);
return
1
;
return
1
;
}
}
char
*
timeZone_sql
=
PQescapeLiteral
(
conn
,
timezone
.
c_str
(),
strlen
(
timezone
.
c_str
()));
char
*
timeZone_sql
=
PQescapeLiteral
(
conn
,
timezone
.
c_str
(),
strlen
(
timezone
.
c_str
()));
if
(
!
isEscapedStringValid
(
timeZone_sql
,
timezone
.
c_str
(),
"TskDbPostgreSQL::addImageInfo: Unable to escape data source string: %s (Error: %s)
\n
"
))
{
if
(
!
isEscapedStringValid
(
timeZone_sql
,
timezone
.
c_str
(),
"TskDbPostgreSQL::addImageInfo: Unable to escape data source string: %s (Error: %s)
\n
"
))
{
PQfreemem
(
deviceId_sql
);
PQfreemem
(
deviceId_sql
);
PQfreemem
(
timeZone_sql
);
PQfreemem
(
timeZone_sql
);
free
(
stmt
);
return
1
;
return
1
;
}
}
snprintf
(
stmt
,
10242048
,
"INSERT INTO data_source_info (obj_id, device_id, time_zone, acquisition_details) VALUES (%"
PRId64
", %s, %s, %s);"
,
snprintf
(
stmt
,
10242048
,
"INSERT INTO data_source_info (obj_id, device_id, time_zone, acquisition_details) VALUES (%"
PRId64
", %s, %s, %s);"
,
...
@@ -894,6 +904,7 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
...
@@ -894,6 +904,7 @@ int TskDbPostgreSQL::addImageInfo(int type, TSK_OFF_T ssize, int64_t & objId, co
ret
=
attempt_exec
(
stmt
,
"Error adding device id to data_source_info table: %s
\n
"
);
ret
=
attempt_exec
(
stmt
,
"Error adding device id to data_source_info table: %s
\n
"
);
PQfreemem
(
deviceId_sql
);
PQfreemem
(
deviceId_sql
);
PQfreemem
(
timeZone_sql
);
PQfreemem
(
timeZone_sql
);
free
(
stmt
);
return
ret
;
return
ret
;
}
}
...
...
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