Skip to content

Commit 9d2cc3c

Browse files
committed
Applied updates and addition boundary checks for corrupted data
1 parent c7468e3 commit 9d2cc3c

8 files changed

+182
-16
lines changed

Diff for: configure.ac

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AC_PREREQ( 2.59 )
22

33
AC_INIT(
44
[libevt],
5-
[20180125],
5+
[20180317],
66
[joachim.metz@gmail.com])
77

88
AC_CONFIG_SRCDIR(
@@ -48,6 +48,12 @@ AX_COMMON_CHECK_ENABLE_WINAPI
4848
dnl Check if wide character type should be enabled
4949
AX_COMMON_CHECK_ENABLE_WIDE_CHARACTER_TYPE
5050

51+
dnl Check if verbose output should be enabled
52+
AX_COMMON_CHECK_ENABLE_VERBOSE_OUTPUT
53+
54+
dnl Check if debug output should be enabled
55+
AX_COMMON_CHECK_ENABLE_DEBUG_OUTPUT
56+
5157
dnl Check for type definitions
5258
AX_TYPES_CHECK_LOCAL
5359

@@ -146,12 +152,6 @@ AX_LIBCDIRECTORY_CHECK_ENABLE
146152
dnl Check if evttools required headers and functions are available
147153
AX_EVTTOOLS_CHECK_LOCAL
148154

149-
dnl Check if libevt should be build with verbose output
150-
AX_COMMON_CHECK_ENABLE_VERBOSE_OUTPUT
151-
152-
dnl Check if libevt should be build with debug output
153-
AX_COMMON_CHECK_ENABLE_DEBUG_OUTPUT
154-
155155
dnl Check if tests required headers and functions are available
156156
AX_TESTS_CHECK_LOCAL
157157

Diff for: libevt.nuspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<package >
33
<metadata>
44
<id>libevt</id>
5-
<version>20180125</version>
5+
<version>20180317</version>
66
<authors>Joachim Metz</authors>
77
<owners>joachimmetz</owners>
88
<licenseUrl>https://raw.githubusercontent.com/libyal/libevt/master/COPYING</licenseUrl>
99
<projectUrl>https://github.com/libyal/libevt</projectUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1111
<title>libevt</title>
1212
<description>Library to access the Windows Event Log (EVT) format</description>
13-
<releaseNotes>Release of libevt 20180125</releaseNotes>
13+
<releaseNotes>Release of libevt 20180317</releaseNotes>
1414
<copyright>Copyright (C) 2011-2018</copyright>
1515
<tags>native</tags>
1616
</metadata>

Diff for: libevt/libevt_libfvalue.h

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#if defined( HAVE_LOCAL_LIBFVALUE )
3030

3131
#include <libfvalue_codepage.h>
32+
#include <libfvalue_data_handle.h>
3233
#include <libfvalue_definitions.h>
3334
#include <libfvalue_floating_point.h>
3435
#include <libfvalue_integer.h>

Diff for: libevt/libevt_record_values.c

+34-1
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,17 @@ int libevt_record_values_read_event(
11571157
}
11581158
if( user_sid_size != 0 )
11591159
{
1160+
if( user_sid_size > ( ( record_data_size - 4 ) - user_sid_offset ) )
1161+
{
1162+
libcerror_error_set(
1163+
error,
1164+
LIBCERROR_ERROR_DOMAIN_RUNTIME,
1165+
LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
1166+
"%s: user SID data size value out of bounds.",
1167+
function );
1168+
1169+
goto on_error;
1170+
}
11601171
if( libfvalue_value_type_initialize(
11611172
&( record_values->user_security_identifier ),
11621173
LIBFVALUE_VALUE_TYPE_NT_SECURITY_IDENTIFIER,
@@ -1218,6 +1229,17 @@ int libevt_record_values_read_event(
12181229
}
12191230
if( strings_size != 0 )
12201231
{
1232+
if( strings_size > ( ( record_data_size - 4 ) - strings_offset ) )
1233+
{
1234+
libcerror_error_set(
1235+
error,
1236+
LIBCERROR_ERROR_DOMAIN_RUNTIME,
1237+
LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
1238+
"%s: strings size value out of bounds.",
1239+
function );
1240+
1241+
goto on_error;
1242+
}
12211243
#if defined( HAVE_DEBUG_OUTPUT )
12221244
if( libcnotify_verbose != 0 )
12231245
{
@@ -1285,14 +1307,25 @@ int libevt_record_values_read_event(
12851307
}
12861308
if( data_size != 0 )
12871309
{
1310+
if( data_size > ( ( record_data_size - 4 ) - record_data_offset ) )
1311+
{
1312+
libcerror_error_set(
1313+
error,
1314+
LIBCERROR_ERROR_DOMAIN_RUNTIME,
1315+
LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
1316+
"%s: data size value out of bounds.",
1317+
function );
1318+
1319+
goto on_error;
1320+
}
12881321
#if defined( HAVE_DEBUG_OUTPUT )
12891322
if( libcnotify_verbose != 0 )
12901323
{
12911324
libcnotify_printf(
12921325
"%s: data:\n",
12931326
function );
12941327
libcnotify_print_data(
1295-
&( record_data[ data_offset ] ),
1328+
&( record_data[ record_data_offset ] ),
12961329
(size_t) data_size,
12971330
LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA );
12981331
}

Diff for: m4/libcdata.m4

+43-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl Checks for libcdata or required headers and functions
22
dnl
3-
dnl Version: 20170904
3+
dnl Version: 20180316
44

55
dnl Function to detect if libcdata is available
66
dnl ac_libcdata_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l<library> arguments
@@ -123,6 +123,48 @@ AC_DEFUN([AX_LIBCDATA_CHECK_LIB],
123123
[ac_cv_libcdata_dummy=yes],
124124
[ac_cv_libcdata=no])
125125
126+
dnl Balanced tree functions
127+
AC_CHECK_LIB(
128+
cdata,
129+
libfdata_btree_initialize,
130+
[ac_cv_libcdata_dummy=yes],
131+
[ac_cv_libcdata=no])
132+
AC_CHECK_LIB(
133+
cdata,
134+
libcdata_btree_free,
135+
[ac_cv_libcdata_dummy=yes],
136+
[ac_cv_libcdata=no])
137+
AC_CHECK_LIB(
138+
cdata,
139+
libcdata_btree_get_number_of_values,
140+
[ac_cv_libcdata_dummy=yes],
141+
[ac_cv_libcdata=no])
142+
AC_CHECK_LIB(
143+
cdata,
144+
libcdata_btree_get_value_by_index,
145+
[ac_cv_libcdata_dummy=yes],
146+
[ac_cv_libcdata=no])
147+
AC_CHECK_LIB(
148+
cdata,
149+
libcdata_btree_get_value_by_value,
150+
[ac_cv_libcdata_dummy=yes],
151+
[ac_cv_libcdata=no])
152+
AC_CHECK_LIB(
153+
cdata,
154+
libcdata_btree_insert_value,
155+
[ac_cv_libcdata_dummy=yes],
156+
[ac_cv_libcdata=no])
157+
AC_CHECK_LIB(
158+
cdata,
159+
libcdata_btree_replace_value,
160+
[ac_cv_libcdata_dummy=yes],
161+
[ac_cv_libcdata=no])
162+
AC_CHECK_LIB(
163+
cdata,
164+
libcdata_btree_remove_value,
165+
[ac_cv_libcdata_dummy=yes],
166+
[ac_cv_libcdata=no])
167+
126168
dnl List functions
127169
AC_CHECK_LIB(
128170
cdata,

Diff for: m4/libcsplit.m4

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl Checks for libcsplit or required headers and functions
22
dnl
3-
dnl Version: 20170903
3+
dnl Version: 20180217
44

55
dnl Function to detect if libcsplit is available
66
dnl ac_libcsplit_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l<library> arguments
@@ -111,7 +111,7 @@ AC_DEFUN([AX_LIBCSPLIT_CHECK_LIB],
111111
AS_IF(
112112
[test "x$ac_cv_enable_wide_character_type" != xno],
113113
[AC_CHECK_LIB(
114-
csplit,
114+
csplit,
115115
libcsplit_wide_string_split,
116116
[ac_cv_libcsplit_dummy=yes],
117117
[ac_cv_libcsplit=no])

Diff for: m4/libfdata.m4

+71-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl Functions for libfdata
22
dnl
3-
dnl Version: 20170905
3+
dnl Version: 20180316
44

55
dnl Function to detect if libfdata is available
66
dnl ac_libfdata_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l<library> arguments
@@ -49,7 +49,76 @@ AC_DEFUN([AX_LIBFDATA_CHECK_LIB],
4949
[ac_cv_libfdata=no])
5050
5151
dnl Area functions
52-
dnl TODO: add functions
52+
AC_CHECK_LIB(
53+
fdata,
54+
libfdata_area_initialize,
55+
[ac_cv_libfdata_dummy=yes],
56+
[ac_cv_libfdata=no])
57+
AC_CHECK_LIB(
58+
fdata,
59+
libfdata_area_free,
60+
[ac_cv_libfdata_dummy=yes],
61+
[ac_cv_libfdata=no])
62+
AC_CHECK_LIB(
63+
fdata,
64+
libfdata_area_clone,
65+
[ac_cv_libfdata_dummy=yes],
66+
[ac_cv_libfdata=no])
67+
AC_CHECK_LIB(
68+
fdata,
69+
libfdata_area_empty,
70+
[ac_cv_libfdata_dummy=yes],
71+
[ac_cv_libfdata=no])
72+
AC_CHECK_LIB(
73+
fdata,
74+
libfdata_area_resize,
75+
[ac_cv_libfdata_dummy=yes],
76+
[ac_cv_libfdata=no])
77+
AC_CHECK_LIB(
78+
fdata,
79+
libfdata_area_get_number_of_segments,
80+
[ac_cv_libfdata_dummy=yes],
81+
[ac_cv_libfdata=no])
82+
AC_CHECK_LIB(
83+
fdata,
84+
libfdata_area_get_segment_by_index,
85+
[ac_cv_libfdata_dummy=yes],
86+
[ac_cv_libfdata=no])
87+
AC_CHECK_LIB(
88+
fdata,
89+
libfdata_area_set_segment_by_index,
90+
[ac_cv_libfdata_dummy=yes],
91+
[ac_cv_libfdata=no])
92+
AC_CHECK_LIB(
93+
fdata,
94+
libfdata_area_prepend_segment,
95+
[ac_cv_libfdata_dummy=yes],
96+
[ac_cv_libfdata=no])
97+
AC_CHECK_LIB(
98+
fdata,
99+
libfdata_area_append_segment,
100+
[ac_cv_libfdata_dummy=yes],
101+
[ac_cv_libfdata=no])
102+
AC_CHECK_LIB(
103+
fdata,
104+
libfdata_area_get_element_data_size,
105+
[ac_cv_libfdata_dummy=yes],
106+
[ac_cv_libfdata=no])
107+
AC_CHECK_LIB(
108+
fdata,
109+
libfdata_area_get_element_value_at_offset,
110+
[ac_cv_libfdata_dummy=yes],
111+
[ac_cv_libfdata=no])
112+
AC_CHECK_LIB(
113+
fdata,
114+
libfdata_area_set_element_value_at_offset,
115+
[ac_cv_libfdata_dummy=yes],
116+
[ac_cv_libfdata=no])
117+
AC_CHECK_LIB(
118+
fdata,
119+
libfdata_area_get_size,
120+
[ac_cv_libfdata_dummy=yes],
121+
[ac_cv_libfdata=no])
53122
54123
dnl Balanced tree functions
55124
dnl TODO: add functions

Diff for: runtests.sh

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# Script that runs the tests
33
#
4-
# Version: 20171210
4+
# Version: 20180214
55

66
EXIT_SUCCESS=0;
77
EXIT_FAILURE=1;
@@ -201,6 +201,14 @@ echo "${CONFIGURE_HELP}" | grep -- '--enable-wide-character-type' > /dev/null;
201201

202202
HAVE_ENABLE_WIDE_CHARACTER_TYPE=$?;
203203

204+
echo "${CONFIGURE_HELP}" | grep -- '--enable-verbose-output' > /dev/null;
205+
206+
HAVE_ENABLE_VERBOSE_OUTPUT=$?;
207+
208+
echo "${CONFIGURE_HELP}" | grep -- '--enable-debug-output' > /dev/null;
209+
210+
HAVE_ENABLE_DEBUG_OUTPUT=$?;
211+
204212
echo "${CONFIGURE_HELP}" | grep -- '--with-zlib' > /dev/null;
205213

206214
HAVE_WITH_ZLIB=$?;
@@ -230,6 +238,19 @@ then
230238
exit ${EXIT_FAILURE};
231239
fi
232240

241+
if test ${HAVE_ENABLE_VERBOSE_OUTPUT} -eq 0 && test ${HAVE_ENABLE_DEBUG_OUTPUT} -eq 0;
242+
then
243+
# Test "./configure && make && make check" with verbose and debug output.
244+
245+
run_configure_make_check "--enable-verbose-output --enable-debug-output";
246+
RESULT=$?;
247+
248+
if test ${RESULT} -ne ${EXIT_SUCCESS};
249+
then
250+
exit ${EXIT_FAILURE};
251+
fi
252+
fi
253+
233254
if test ${HAVE_WITH_ZLIB} -eq 0;
234255
then
235256
# Test "./configure && make && make check" with fallback zlib implementation.

0 commit comments

Comments
 (0)