Skip to content

Commit f0547c1

Browse files
authored
Merge branch 'sleuthkit:develop-4.14' into develop-4.14
2 parents d994a25 + 7e6d7c4 commit f0547c1

75 files changed

Lines changed: 969 additions & 471 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-unix.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
compiler: "gcc"
3131
runner: "macos-15"
3232
configure_opts: "--with-libewf --enable-java"
33-
make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror"
33+
# make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror"
3434
codecov: "yes"
3535
prefix: "CODECOV"
3636
address_sanitizer: "yes"
@@ -43,7 +43,7 @@ jobs:
4343
compiler: "gcc"
4444
runner: "ubuntu-24.04"
4545
configure_opts: "--with-libewf --with-libqcow --with-libvhdi --with-libvmdk --enable-java"
46-
make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror"
46+
# make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror"
4747
codecov: "no"
4848
prefix:
4949
address_sanitizer: "yes"
@@ -57,7 +57,7 @@ jobs:
5757
compiler: "clang"
5858
runner: "ubuntu-24.04"
5959
configure_opts: "--with-libewf --with-libqcow --with-libvhdi --with-libvmdk --enable-java CC=clang CXX=clang++"
60-
make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror"
60+
# make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror"
6161
codecov: "no"
6262
prefix: ""
6363
address_sanitizer: "yes"
@@ -175,7 +175,7 @@ jobs:
175175
run: |
176176
sudo dpkg --add-architecture i386
177177
sudo apt update
178-
sudo apt install autoconf automake libtool make pkg-config mingw-w64 mingw-w64-tools libz-mingw-w64-dev wine32 wine64 wget libpcre3-dev
178+
sudo apt install autoconf automake libtool make pkg-config mingw-w64 mingw-w64-tools libz-mingw-w64-dev wine32 wine64 wget libpcre3-dev
179179
sudo update-alternatives --set ${{ matrix.arch }}-w64-mingw32-g++ /usr/bin/${{ matrix.arch }}-w64-mingw32-g++-posix
180180
# This is not working; also requires mingw-w64-x86_64-libgnurx
181181
# echo === installing libmagic for mingw ===

.github/workflows/compile-windows.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
targetplatform: [x86, x64]
18-
runs-on: windows-2019
18+
runs-on: windows-2025
1919

2020
env:
2121
TSK_HOME: "${{ github.workspace }}"
@@ -42,6 +42,11 @@ jobs:
4242
choco install nuget.commandline
4343
choco install ant --ignore-dependencies
4444
45+
- name: Size of drives
46+
run: |
47+
Get-CimInstance -Class Win32_LogicalDisk | Select-Object DeviceID, @{Name="Size(GB)";Expression={[Math]::Round($_.Size / 1GB, 2)}}, @{Name="FreeSpace(GB)";Expression={[Math]::Round($_.FreeSpace / 1GB, 2)}}, @{Name="FreeSpace(%)";Expression={[Math]::Round(($_.FreeSpace / $_.Size) * 100, 2)}} | Format-Table -AutoSize
48+
49+
4550
- name: Set up JDK 17
4651
uses: actions/setup-java@v3
4752
with:

bindings/java/jni/auto_db_java.cpp

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ TskAutoDbJava::addPoolInfoAndVS(const TSK_POOL_INFO *pool_info, int64_t parObjId
294294
poolObjIdj, TSK_VS_TYPE_APFS, pool_info->img_offset, (uint64_t)pool_info->block_size);
295295
objId = (int64_t)objIdj;
296296

297+
if (objId < 0) {
298+
return TSK_ERR;
299+
}
300+
297301
saveObjectInfo(objId, poolObjId, TSK_DB_OBJECT_TYPE_VS);
298302
return TSK_OK;
299303
}
@@ -671,13 +675,14 @@ TskAutoDbJava::addFile(TSK_FS_FILE* fs_file,
671675
// See github issue #756 on why initsize and not size.
672676
// - The data is not compressed
673677
if ((fs_attr != NULL)
678+
&& (fs_file->meta != NULL)
674679
&& ((strlen(name) > 0) && (!TSK_FS_ISDOT(name)))
675680
&& (!(fs_file->meta->flags & TSK_FS_META_FLAG_COMP))
676681
&& (fs_attr->flags & TSK_FS_ATTR_NONRES)
677682
&& (fs_attr->nrd.allocsize > fs_attr->nrd.initsize)) {
678-
strncat(name, "-slack", 6);
683+
strncat(name, "-slack", nlen - strlen(name) - 1);
679684
if (strlen(extension) > 0) {
680-
strncat(extension, "-slack", 6);
685+
strncat(extension, "-slack", sizeof(extension) - strlen(extension) - 1);
681686
}
682687
jstring slackNamej;
683688
if (createJString(name, slackNamej) != TSK_OK) {
@@ -1098,6 +1103,13 @@ TskAutoDbJava::addImageDetails(const char* deviceId)
10981103

10991104
for (int i = 0; i < m_img_info->num_img; i++) {
11001105
char * img2 = (char*)tsk_malloc(1024 * sizeof(char));
1106+
if (img2 == NULL) {
1107+
for (int j = 0; j < i; j++) {
1108+
free(img_ptrs[j]);
1109+
}
1110+
free(img_ptrs);
1111+
return 1;
1112+
}
11011113
UTF8 *ptr8;
11021114
UTF16 *ptr16;
11031115

@@ -1112,11 +1124,16 @@ TskAutoDbJava::addImageDetails(const char* deviceId)
11121124
tsk_error_reset();
11131125
tsk_error_set_errno(TSK_ERR_AUTO_UNICODE);
11141126
tsk_error_set_errstr("Error converting image to UTF-8\n");
1127+
free(img2);
1128+
for (int j = 0; j < i; j++) {
1129+
free(img_ptrs[j]);
1130+
}
1131+
free(img_ptrs);
11151132
return 1;
11161133
}
11171134
img_ptrs[i] = img2;
11181135
}
1119-
#else
1136+
#else
11201137
img_ptrs = m_img_info->images;
11211138
#endif
11221139

@@ -1417,9 +1434,12 @@ uint8_t
14171434
}
14181435

14191436
if (m_imageWriterEnabled) {
1420-
tsk_img_writer_create(m_img_info, m_imageWriterPath);
1437+
if (tsk_img_writer_create(m_img_info, m_imageWriterPath)) {
1438+
registerError();
1439+
return 1;
1440+
}
14211441
}
1422-
1442+
14231443
if (m_addFileSystems) {
14241444
return addFilesInImgToDb();
14251445
} else {
@@ -1497,7 +1517,10 @@ uint8_t
14971517
return 1;
14981518
}
14991519
if (m_imageWriterEnabled) {
1500-
tsk_img_writer_create(m_img_info, m_imageWriterPath);
1520+
if (tsk_img_writer_create(m_img_info, m_imageWriterPath)) {
1521+
registerError();
1522+
return 1;
1523+
}
15011524
}
15021525

15031526
if (m_addFileSystems) {
@@ -1682,7 +1705,8 @@ TSK_WALK_RET_ENUM TskAutoDbJava::fsWalkUnallocBlocksCb(const TSK_FS_BLOCK *a_blo
16821705
TskAutoDbJava & tskAutoDbJava = unallocBlockWlkTrack->tskAutoDbJava;
16831706
if (tskAutoDbJava.addUnallocBlockFile(tskAutoDbJava.m_curUnallocDirId,
16841707
unallocBlockWlkTrack->fsObjId, unallocBlockWlkTrack->size, unallocBlockWlkTrack->ranges, fileObjId, tskAutoDbJava.m_curImgId) == TSK_ERR) {
1685-
// @@@ Handle error -> Don't have access to registerError() though...
1708+
tskAutoDbJava.registerError();
1709+
return TSK_WALK_STOP;
16861710
}
16871711

16881712
// reset
@@ -1748,17 +1772,19 @@ TSK_RETVAL_ENUM TskAutoDbJava::addFsInfoUnalloc(const TSK_DB_FS_INFO & dbFsInfo)
17481772
return TSK_OK;
17491773
}
17501774

1751-
// handle creation of the last range
1752-
// make range inclusive from curBlockStart to prevBlock
1753-
const uint64_t byteStart = unallocBlockWlkTrack.curRangeStart * fsInfo->block_size + fsInfo->offset;
1754-
const uint64_t byteLen = (1 + unallocBlockWlkTrack.prevBlock - unallocBlockWlkTrack.curRangeStart) * fsInfo->block_size;
1755-
unallocBlockWlkTrack.ranges.push_back(TSK_DB_FILE_LAYOUT_RANGE(byteStart, byteLen, unallocBlockWlkTrack.nextSequenceNo++));
1756-
int64_t fileObjId = 0;
1775+
// handle creation of the last range (only if the walk visited at least one block)
1776+
if (!unallocBlockWlkTrack.isStart) {
1777+
// make range inclusive from curBlockStart to prevBlock
1778+
const uint64_t byteStart = unallocBlockWlkTrack.curRangeStart * fsInfo->block_size + fsInfo->offset;
1779+
const uint64_t byteLen = (1 + unallocBlockWlkTrack.prevBlock - unallocBlockWlkTrack.curRangeStart) * fsInfo->block_size;
1780+
unallocBlockWlkTrack.ranges.push_back(TSK_DB_FILE_LAYOUT_RANGE(byteStart, byteLen, unallocBlockWlkTrack.nextSequenceNo++));
1781+
int64_t fileObjId = 0;
17571782

1758-
if (addUnallocBlockFile(m_curUnallocDirId, dbFsInfo.objId, unallocBlockWlkTrack.size, unallocBlockWlkTrack.ranges, fileObjId, m_curImgId) == TSK_ERR) {
1759-
registerError();
1760-
tsk_fs_close(fsInfo);
1761-
return TSK_ERR;
1783+
if (addUnallocBlockFile(m_curUnallocDirId, dbFsInfo.objId, unallocBlockWlkTrack.size, unallocBlockWlkTrack.ranges, fileObjId, m_curImgId) == TSK_ERR) {
1784+
registerError();
1785+
tsk_fs_close(fsInfo);
1786+
return TSK_ERR;
1787+
}
17621788
}
17631789

17641790
//cleanup
@@ -1941,11 +1967,7 @@ TSK_RETVAL_ENUM TskAutoDbJava::addUnallocImageSpaceToDb() {
19411967
return TSK_ERR;
19421968
}
19431969
else {
1944-
TSK_DB_FILE_LAYOUT_RANGE tempRange(0, imgSize, 0);
19451970
//add unalloc block file for the entire image
1946-
vector<TSK_DB_FILE_LAYOUT_RANGE> ranges;
1947-
ranges.push_back(tempRange);
1948-
int64_t fileObjId = 0;
19491971
if (TSK_ERR == addUnallocBlockFileInChunks(0, imgSize, m_curImgId, m_curImgId)) {
19501972
return TSK_ERR;
19511973
}

0 commit comments

Comments
 (0)