diff --git a/.clang-format b/.clang-format index 87ebea09b2..5ae36afdd8 100644 --- a/.clang-format +++ b/.clang-format @@ -2,40 +2,65 @@ Language: Cpp AccessModifierOffset: -2 AlignAfterOpenBracket: Align -AlignConsecutiveMacros: false -AlignConsecutiveAssignments: true -AlignConsecutiveBitFields: false -AlignConsecutiveDeclarations: false +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false AlignEscapedNewlines: Left AlignOperands: Align -AlignTrailingComments: true +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true -AllowShortEnumsOnASingleLine: true AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: Empty -AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: + - __capability BinPackArguments: true BinPackParameters: true +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: false AfterClass: true AfterControlStatement: Never AfterEnum: false + AfterExternBlock: false AfterFunction: true AfterNamespace: true AfterObjCDeclaration: false AfterStruct: false AfterUnion: false - AfterExternBlock: false BeforeCatch: false BeforeElse: false BeforeLambdaBody: false @@ -44,55 +69,75 @@ BraceWrapping: SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true +BreakAfterAttributes: Never +BreakAfterJavaFieldAnnotations: false +BreakArrays: true BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always BreakBeforeBraces: Linux -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false +BreakInheritanceList: BeforeColon BreakStringLiterals: true ColumnLimit: 0 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true -DeriveLineEnding: true DerivePointerAlignment: true DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - foreach - Q_FOREACH - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE IncludeBlocks: Preserve IncludeCategories: - Regex: '^"(llvm|llvm-c|clang|clang-c)/' Priority: 2 SortPriority: 0 + CaseSensitive: false - Regex: '^(<|"(gtest|gmock|isl|json)/)' Priority: 3 SortPriority: 0 + CaseSensitive: false - Regex: '.*' Priority: 1 SortPriority: 0 + CaseSensitive: false IncludeIsMainRegex: '(Test)?$' IncludeIsMainSourceRegex: '' -IndentCaseLabels: true +IndentAccessModifiers: false IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: AfterExternBlock IndentGotoLabels: true IndentPPDirectives: None -IndentExternBlock: AfterExternBlock +IndentRequiresClause: true IndentWidth: 4 IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: Signature +LineEnding: DeriveLF MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 @@ -102,47 +147,78 @@ ObjCBlockIndentWidth: 2 ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: BinPack PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Right +PPIndentWidth: -1 +QualifierAlignment: Leave +ReferenceAlignment: Pointer ReflowComments: true -SortIncludes: false -SortUsingDeclarations: true +RemoveBracesLLVM: false +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SortIncludes: Never +SortJavaStaticImport: Before +SortUsingDeclarations: LexicographicNumeric SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: false +SpacesInAngles: Never SpacesInConditionalStatement: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 SpacesInParentheses: false SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false Standard: Latest +StatementAttributeLikeMacros: + - Q_EMIT StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION TabWidth: 8 -UseCRLF: false UseTab: Never WhitespaceSensitiveMacros: - - STRINGIZE - - PP_STRINGIZE - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE ... diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index d9730b2a80..da037e263c 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -56,10 +56,10 @@ jobs: - check: "win32/compat" exclude: "" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Run clang-format style check for C/C++ programs. - uses: jidicula/clang-format-action@v4.4.1 + uses: jidicula/clang-format-action@v4.13.0 with: - clang-format-version: "14" + clang-format-version: "16" check-path: ${{ matrix.path['check'] }} exclude-regex: ${{ matrix.path['exclude'] }} diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 320885e0bf..22a25a6d9b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -29,17 +29,17 @@ jobs: run: rm /usr/bin/link.exe shell: bash - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Install Build Tools - uses: crazy-max/ghaction-chocolatey@v1 + uses: crazy-max/ghaction-chocolatey@v3 with: args: install wixtoolset - name: Install pytest for easier to read test results run: python3 -m pip install pytest - - uses: lukka/get-cmake@v3.21.2 + - uses: lukka/get-cmake@v3.30.0 # Restore from cache the previously built ports. If cache-miss, download, build vcpkg ports. - name: Restore vcpkg ports from cache or install vcpkg @@ -91,7 +91,7 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Install Build Tools run: brew install bison flex @@ -102,7 +102,7 @@ jobs: - name: Install pytest for easier to read test results run: python3 -m pip install pytest - - uses: lukka/get-cmake@v3.21.2 + - uses: lukka/get-cmake@v3.30.0 - name: Create Build Directory shell: bash @@ -142,7 +142,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Update package listings run: sudo apt-get update @@ -156,7 +156,7 @@ jobs: - name: Install pytest for easier to read test results run: python3 -m pip install pytest - - uses: lukka/get-cmake@v3.21.2 + - uses: lukka/get-cmake@v3.30.0 - name: Create Build Directory shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f890da833..a2487086bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ string(TIMESTAMP TODAY "%Y%m%d") set(VERSION_SUFFIX "") project( ClamAV - VERSION "1.3.1" + VERSION "1.3.2" DESCRIPTION "ClamAV open source email, web, and end-point anti-virus toolkit." ) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) diff --git a/Jenkinsfile b/Jenkinsfile index 2ffb577b82..8ff06f6fbe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,23 +10,32 @@ properties( parameters( [ string(name: 'VERSION', - defaultValue: '1.3.1', + defaultValue: '1.3.2', description: 'ClamAV version string'), string(name: 'FRAMEWORK_BRANCH', defaultValue: '1.3', description: 'test-framework branch'), string(name: 'TESTS_BRANCH', defaultValue: '1.3', - description: 'tests branch'), + description: 'tests branch for the package and regular tests'), string(name: 'TESTS_CUSTOM_BRANCH', defaultValue: '1.3', description: 'tests-custom branch'), string(name: 'TESTS_FUZZ_BRANCH', defaultValue: '1.3', description: 'tests-fuzz-regression branch'), + string(name: 'BUILD_PIPELINES_PATH', + defaultValue: 'ClamAV/build-pipelines', + description: 'build-pipelines path for clamav in Jenkins'), + string(name: 'TEST_PIPELINES_PATH', + defaultValue: 'ClamAV/test-pipelines', + description: 'test-pipelines path for clamav in Jenkins'), string(name: 'BUILD_PIPELINE', defaultValue: 'build-1.3', description: 'test-pipelines branch for build acceptance'), + string(name: 'PACKAGE_PIPELINE', + defaultValue: 'package-1.3', + description: 'test-pipelines branch for package tests.'), string(name: 'REGULAR_PIPELINE', defaultValue: 'regular-1.3', description: 'test-pipelines branch for regular tests.'), @@ -47,7 +56,7 @@ properties( ] ) -node('ubuntu-18-x64') { +node('default') { stage('Generate Tarball') { cleanWs() @@ -68,7 +77,27 @@ node('ubuntu-18-x64') { dir(path: 'build') { sh """# CPack - cmake .. -D VENDOR_DEPENDENCIES=ON + cmake .. -D VENDOR_DEPENDENCIES=ON \ + -D JSONC_INCLUDE_DIR="$HOME/.mussels/install/host-static/include/json-c" \ + -D JSONC_LIBRARY="$HOME/.mussels/install/host-static/lib/libjson-c.a" \ + -D ENABLE_JSON_SHARED=OFF \ + -D BZIP2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ + -D BZIP2_LIBRARY_RELEASE="$HOME/bzip2-1.0.8-install/lib/libbz2.a" \ + -D OPENSSL_ROOT_DIR="$HOME/.mussels/install/host-static" \ + -D OPENSSL_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ + -D OPENSSL_CRYPTO_LIBRARY="$HOME/.mussels/install/host-static/lib/libcrypto.a" \ + -D OPENSSL_SSL_LIBRARY="$HOME/.mussels/install/host-static/lib/libssl.a" \ + -D LIBXML2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include/libxml2" \ + -D LIBXML2_LIBRARY="$HOME/.mussels/install/host-static/lib/libxml2.a" \ + -D PCRE2_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ + -D PCRE2_LIBRARY="$HOME/.mussels/install/host-static/lib/libpcre2-8.a" \ + -D CURSES_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ + -D CURSES_LIBRARY="$HOME/.mussels/install/host-static/lib/libncurses.a;$HOME/.mussels/install/host-static/lib/libtinfo.a" \ + -D ZLIB_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ + -D ZLIB_LIBRARY="$HOME/.mussels/install/host-static/lib/libz.a" \ + -D LIBCHECK_INCLUDE_DIR="$HOME/.mussels/install/host-static/include" \ + -D LIBCHECK_LIBRARY="$HOME/.mussels/install/host-static/lib/libcheck.a" + cpack --config CPackSourceConfig.cmake """ archiveArtifacts(artifacts: "clamav-${params.VERSION}*.tar.gz", onlyIfSuccessful: true) } @@ -79,7 +108,7 @@ node('ubuntu-18-x64') { def buildResult stage('Build') { - buildResult = build(job: "test-pipelines/${params.BUILD_PIPELINE}", + buildResult = build(job: "${params.BUILD_PIPELINES_PATH}/${params.BUILD_PIPELINE}", propagate: true, wait: true, parameters: [ @@ -90,24 +119,23 @@ node('ubuntu-18-x64') { [$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"] ] ) - echo "test-pipelines/${params.BUILD_PIPELINE} #${buildResult.number} succeeded." + echo "${params.BUILD_PIPELINES_PATH}/${params.BUILD_PIPELINE} #${buildResult.number} succeeded." } stage('Test') { def tasks = [:] - tasks["regular_and_custom"] = { - def regularResult + tasks["package_regular_custom"] = { def exception = null try { - stage("Regular Pipeline") { - regularResult = build(job: "test-pipelines/${params.REGULAR_PIPELINE}", + stage("Package") { + final regularResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.PACKAGE_PIPELINE}", propagate: true, wait: true, parameters: [ [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NAME', value: "${JOB_NAME}"], [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NUMBER', value: "${BUILD_NUMBER}"], - [$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "test-pipelines/${params.BUILD_PIPELINE}"], + [$class: 'StringParameterValue', name: 'BUILD_JOB_NAME', value: "${params.BUILD_PIPELINES_PATH}/${params.BUILD_PIPELINE}"], [$class: 'StringParameterValue', name: 'BUILD_JOB_NUMBER', value: "${buildResult.number}"], [$class: 'StringParameterValue', name: 'TESTS_BRANCH', value: "${params.TESTS_BRANCH}"], [$class: 'StringParameterValue', name: 'FRAMEWORK_BRANCH', value: "${params.FRAMEWORK_BRANCH}"], @@ -115,14 +143,36 @@ node('ubuntu-18-x64') { [$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"] ] ) - echo "test-pipelines/${params.REGULAR_PIPELINE} #${regularResult.number} succeeded." + echo "${params.TEST_PIPELINES_PATH}/${params.PACKAGE_PIPELINE} #${regularResult.number} succeeded." } } catch (exc) { - echo "test-pipelines/${params.REGULAR_PIPELINE} failed." + echo "${params.TEST_PIPELINES_PATH}/${params.PACKAGE_PIPELINE} failed." exception = exc } - stage("Custom Pipeline") { - final customResult = build(job: "test-pipelines/${params.CUSTOM_PIPELINE}", + + try { + stage("Regular From-Source") { + final regularResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE}", + propagate: true, + wait: true, + parameters: [ + [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NAME', value: "${JOB_NAME}"], + [$class: 'StringParameterValue', name: 'CLAMAV_JOB_NUMBER', value: "${BUILD_NUMBER}"], + [$class: 'StringParameterValue', name: 'TESTS_BRANCH', value: "${params.TESTS_BRANCH}"], + [$class: 'StringParameterValue', name: 'FRAMEWORK_BRANCH', value: "${params.FRAMEWORK_BRANCH}"], + [$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"], + [$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"] + ] + ) + echo "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE} #${regularResult.number} succeeded." + } + } catch (exc) { + echo "${params.TEST_PIPELINES_PATH}/${params.REGULAR_PIPELINE} failed." + exception = exc + } + + stage("Custom From-Source") { + final customResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.CUSTOM_PIPELINE}", propagate: true, wait: true, parameters: [ @@ -134,17 +184,17 @@ node('ubuntu-18-x64') { [$class: 'StringParameterValue', name: 'SHARED_LIB_BRANCH', value: "${params.SHARED_LIB_BRANCH}"] ] ) - echo "test-pipelines/${params.CUSTOM_PIPELINE} #${customResult.number} succeeded." + echo "${params.TEST_PIPELINES_PATH}/${params.CUSTOM_PIPELINE} #${customResult.number} succeeded." } if(exception != null) { - echo "Custom Pipeline passed, but Regular pipeline failed!" + echo "Custom Pipeline passed, but prior pipelines failed!" throw exception } } tasks["fuzz_regression"] = { stage("Fuzz Regression") { - final fuzzResult = build(job: "test-pipelines/${params.FUZZ_PIPELINE}", + final fuzzResult = build(job: "${params.TEST_PIPELINES_PATH}/${params.FUZZ_PIPELINE}", propagate: true, wait: true, parameters: [ @@ -155,7 +205,7 @@ node('ubuntu-18-x64') { [$class: 'StringParameterValue', name: 'VERSION', value: "${params.VERSION}"] ] ) - echo "test-pipelines/${params.FUZZ_PIPELINE} #${fuzzResult.number} succeeded." + echo "${params.TEST_PIPELINES_PATH}/${params.FUZZ_PIPELINE} #${fuzzResult.number} succeeded." } } diff --git a/NEWS.md b/NEWS.md index dffdedee2a..86e9b1cc0d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,26 @@ Note: This file refers to the official packages. Things described here may differ slightly from third-party binary packages. +## 1.3.2 + +ClamAV 1.3.2 is a patch release with the following fixes: + +- Fix unit test caused by expiring signing certificate. + - Backport of [GitHub pull request](https://github.com/Cisco-Talos/clamav/pull/1305) + +- Fixed a build issue on Windows with newer versions of Rust. + Also upgraded GitHub Actions imports to fix CI failures. + Fixes courtesy of liushuyu. + - Backport of [GitHub pull request](https://github.com/Cisco-Talos/clamav/pull/1307) + +- Fixed an unaligned pointer dereference issue on select architectures. + Fix courtesy of Sebastian Andrzej Siewior. + - Backport of [GitHub pull request](https://github.com/Cisco-Talos/clamav/pull/1293) + +- Fixes to Jenkins CI pipeline. + +For details, see [GitHub pull request](https://github.com/Cisco-Talos/clamav/pull/1330) + ## 1.3.1 ClamAV 1.3.1 is a critical patch release with the following fixes: diff --git a/clam-format b/clam-format index 9b8298390a..e3d8519418 100755 --- a/clam-format +++ b/clam-format @@ -1,54 +1,54 @@ #!/bin/bash -clang-format -style='{ Language: Cpp, UseTab: Never, IndentWidth: 4, AlignTrailingComments: true, AlignConsecutiveAssignments: true, AlignAfterOpenBracket: true, AlignEscapedNewlines: Left, AlignOperands: true, AllowShortFunctionsOnASingleLine: Empty, AllowShortIfStatementsOnASingleLine: true, AllowShortLoopsOnASingleLine: true, BreakBeforeBraces: Linux, BreakBeforeTernaryOperators: true, ColumnLimit: 0, FixNamespaceComments: true, SortIncludes: false, MaxEmptyLinesToKeep: 1, SpaceBeforeParens: ControlStatements, IndentCaseLabels: true, DerivePointerAlignment: true }' -dump-config > .clang-format +clang-format-16 -style='{ Language: Cpp, UseTab: Never, IndentWidth: 4, AlignTrailingComments: true, AlignConsecutiveAssignments: true, AlignAfterOpenBracket: true, AlignEscapedNewlines: Left, AlignOperands: true, AllowShortFunctionsOnASingleLine: Empty, AllowShortIfStatementsOnASingleLine: true, AllowShortLoopsOnASingleLine: true, BreakBeforeBraces: Linux, BreakBeforeTernaryOperators: true, ColumnLimit: 0, FixNamespaceComments: true, SortIncludes: false, MaxEmptyLinesToKeep: 1, SpaceBeforeParens: ControlStatements, IndentCaseLabels: true, DerivePointerAlignment: true }' -dump-config > .clang-format -clang-format -i -verbose clamav-milter/*.c -clang-format -i -verbose clamav-milter/*.h -clang-format -i -verbose clambc/*.c -clang-format -i -verbose clambc/*.h -clang-format -i -verbose clamconf/*.c -clang-format -i -verbose clamconf/*.h -clang-format -i -verbose clamd/*.c -clang-format -i -verbose clamd/*.h -clang-format -i -verbose clamdscan/*.c -clang-format -i -verbose clamdscan/*.h -clang-format -i -verbose clamdtop/*.c -clang-format -i -verbose clamdtop/*.h -clang-format -i -verbose clamscan/*.c -clang-format -i -verbose clamscan/*.h -clang-format -i -verbose clamsubmit/*.c -clang-format -i -verbose clamsubmit/*.h -clang-format -i -verbose examples/*.c -clang-format -i -verbose examples/*.h -clang-format -i -verbose examples/fileprop_analysis/*.c -clang-format -i -verbose examples/fileprop_analysis/old/*.c -clang-format -i -verbose freshclam/*.c -clang-format -i -verbose freshclam/*.h -clang-format -i -verbose libclamav/*.c -clang-format -i -verbose libclamav/*.h -clang-format -i -verbose libclamav/jsparse/*.c -clang-format -i -verbose libclamav/jsparse/*.h -clang-format -i -verbose libclamav/lzw/*.c -clang-format -i -verbose libclamav/lzw/*.h -clang-format -i -verbose libclamav/nsis/nulsft.* -clang-format -i -verbose libclamav/c++/*.cpp -clang-format -i -verbose libclamav/c++/*.h -clang-format -i -verbose libclamunrar_iface/*.cpp -clang-format -i -verbose libclamunrar_iface/*.h -clang-format -i -verbose libfreshclam/*.c -clang-format -i -verbose libfreshclam/*.h -clang-format -i -verbose common/*.c -clang-format -i -verbose common/*.h -clang-format -i -verbose sigtool/*.c -clang-format -i -verbose sigtool/*.h -clang-format -i -verbose clamonacc/*.c -clang-format -i -verbose clamonacc/*.h -clang-format -i -verbose clamonacc/*/*.c -clang-format -i -verbose clamonacc/*/*.h -clang-format -i -verbose unit_tests/*.c -clang-format -i -verbose unit_tests/*.h -clang-format -i -verbose win32/compat/*.c -clang-format -i -verbose win32/compat/*.h +clang-format-16 -i -verbose clamav-milter/*.c +clang-format-16 -i -verbose clamav-milter/*.h +clang-format-16 -i -verbose clambc/*.c +clang-format-16 -i -verbose clambc/*.h +clang-format-16 -i -verbose clamconf/*.c +clang-format-16 -i -verbose clamconf/*.h +clang-format-16 -i -verbose clamd/*.c +clang-format-16 -i -verbose clamd/*.h +clang-format-16 -i -verbose clamdscan/*.c +clang-format-16 -i -verbose clamdscan/*.h +clang-format-16 -i -verbose clamdtop/*.c +clang-format-16 -i -verbose clamdtop/*.h +clang-format-16 -i -verbose clamscan/*.c +clang-format-16 -i -verbose clamscan/*.h +clang-format-16 -i -verbose clamsubmit/*.c +clang-format-16 -i -verbose clamsubmit/*.h +clang-format-16 -i -verbose examples/*.c +clang-format-16 -i -verbose examples/*.h +clang-format-16 -i -verbose examples/fileprop_analysis/*.c +clang-format-16 -i -verbose examples/fileprop_analysis/old/*.c +clang-format-16 -i -verbose freshclam/*.c +clang-format-16 -i -verbose freshclam/*.h +clang-format-16 -i -verbose libclamav/*.c +clang-format-16 -i -verbose libclamav/*.h +clang-format-16 -i -verbose libclamav/jsparse/*.c +clang-format-16 -i -verbose libclamav/jsparse/*.h +clang-format-16 -i -verbose libclamav/lzw/*.c +clang-format-16 -i -verbose libclamav/lzw/*.h +clang-format-16 -i -verbose libclamav/nsis/nulsft.* +clang-format-16 -i -verbose libclamav/c++/*.cpp +clang-format-16 -i -verbose libclamav/c++/*.h +clang-format-16 -i -verbose libclamunrar_iface/*.cpp +clang-format-16 -i -verbose libclamunrar_iface/*.h +clang-format-16 -i -verbose libfreshclam/*.c +clang-format-16 -i -verbose libfreshclam/*.h +clang-format-16 -i -verbose common/*.c +clang-format-16 -i -verbose common/*.h +clang-format-16 -i -verbose sigtool/*.c +clang-format-16 -i -verbose sigtool/*.h +clang-format-16 -i -verbose clamonacc/*.c +clang-format-16 -i -verbose clamonacc/*.h +clang-format-16 -i -verbose clamonacc/*/*.c +clang-format-16 -i -verbose clamonacc/*/*.h +clang-format-16 -i -verbose unit_tests/*.c +clang-format-16 -i -verbose unit_tests/*.h +clang-format-16 -i -verbose win32/compat/*.c +clang-format-16 -i -verbose win32/compat/*.h # Undo changes to specific files that we don't really want to reformat git checkout libclamav/iana_cctld.h diff --git a/clamdscan/proto.c b/clamdscan/proto.c index c3965d2eea..2d6e966a5e 100644 --- a/clamdscan/proto.c +++ b/clamdscan/proto.c @@ -212,7 +212,7 @@ struct client_parallel_data { unsigned int id; const char *file; struct SCANID *next; - } * ids; + } *ids; }; /* Sends a proper scan request to clamd and parses its replies diff --git a/clamonacc/inotif/inotif.c b/clamonacc/inotif/inotif.c index 1851229242..4a61dc069b 100644 --- a/clamonacc/inotif/inotif.c +++ b/clamonacc/inotif/inotif.c @@ -154,7 +154,7 @@ int onas_ddd_init(uint64_t nwatches, size_t ht_size) if (ret < 0) return CL_EREAD; tmp = strtol(nwatch_str, &p, 10); - if (tmp < 0 || tmp == LONG_MAX){ + if (tmp < 0 || tmp == LONG_MAX) { /*Seems like a sane value (also the value on my ubuntu system)*/ nwatches = 0x10000; } else { diff --git a/cmake/FindRust.cmake b/cmake/FindRust.cmake index ffa86e33f1..227d0b4552 100644 --- a/cmake/FindRust.cmake +++ b/cmake/FindRust.cmake @@ -430,6 +430,8 @@ foreach(LINE ${LINE_LIST}) string(REPLACE "native-static-libs: " "" LINE "${LINE}") string(REGEX REPLACE " " "" LINE "${LINE}") string(REGEX REPLACE " " ";" LINE "${LINE}") + # remove linker flags + list(FILTER LINE EXCLUDE REGEX "/.*") if(LINE) message(STATUS "Rust's native static libs: ${LINE}") diff --git a/libclamav/apm.c b/libclamav/apm.c index b33c057998..3cc79b08c5 100644 --- a/libclamav/apm.c +++ b/libclamav/apm.c @@ -37,7 +37,7 @@ #include "scanners.h" #include "dconf.h" -//#define DEBUG_APM_PARSE +// #define DEBUG_APM_PARSE #ifdef DEBUG_APM_PARSE #define apm_parsemsg(...) cli_dbgmsg(__VA_ARGS__) diff --git a/libclamav/bytecode_api.h b/libclamav/bytecode_api.h index d7b3299125..83e4b84a82 100644 --- a/libclamav/bytecode_api.h +++ b/libclamav/bytecode_api.h @@ -183,6 +183,7 @@ enum FunctionalityLevels { FUNC_LEVEL_1_3 = 200, /**< LibClamAV release 1.3.0 */ FUNC_LEVEL_1_3_1 = 201, /**< LibClamAV release 1.3.1 */ + FUNC_LEVEL_1_3_2 = 202, /**< LibClamAV release 1.3.2 */ }; /** diff --git a/libclamav/c++/bytecode2llvm.cpp b/libclamav/c++/bytecode2llvm.cpp index 462c02e50f..0f43146984 100644 --- a/libclamav/c++/bytecode2llvm.cpp +++ b/libclamav/c++/bytecode2llvm.cpp @@ -106,7 +106,7 @@ void LLVMInitializePowerPCAsmPrinter(); #include "llvm/IR/Dominators.h" -//#define TIMING +// #define TIMING #undef TIMING #include "llvm/Config/llvm-config.h" diff --git a/libclamav/crtmgr.c b/libclamav/crtmgr.c index d8660c3ede..c7bd17f097 100644 --- a/libclamav/crtmgr.c +++ b/libclamav/crtmgr.c @@ -398,7 +398,7 @@ static cl_error_t crtmgr_get_recov_data(BIGNUM *sig, cli_crt *x509, int pad_size; int keylen; uint8_t *d = NULL; - BIGNUM *x = NULL; + BIGNUM *x = NULL; cl_error_t ret; *buffer = NULL; diff --git a/libclamav/crtmgr.h b/libclamav/crtmgr.h index 468c2626b8..64a009892a 100644 --- a/libclamav/crtmgr.h +++ b/libclamav/crtmgr.h @@ -66,8 +66,8 @@ typedef struct cli_crt_t { BIGNUM *n; BIGNUM *e; BIGNUM *sig; - time_t not_before; - time_t not_after; + int64_t not_before; + int64_t not_after; cli_crt_hashtype hashtype; int certSign; int codeSign; diff --git a/libclamav/entconv.c b/libclamav/entconv.c index caceaa616b..54c4bd149d 100644 --- a/libclamav/entconv.c +++ b/libclamav/entconv.c @@ -57,7 +57,7 @@ typedef struct { enum encodings encoding; size_t size; -} * iconv_t; +}* iconv_t; #endif static unsigned char tohex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; diff --git a/libclamav/gpt.c b/libclamav/gpt.c index 3ed7a54de8..c92cf6bc97 100644 --- a/libclamav/gpt.c +++ b/libclamav/gpt.c @@ -41,8 +41,8 @@ #include "scanners.h" #include "dconf.h" -//#define DEBUG_GPT_PARSE -//#define DEBUG_GPT_PRINT +// #define DEBUG_GPT_PARSE +// #define DEBUG_GPT_PRINT #ifdef DEBUG_GPT_PARSE #define gpt_parsemsg(...) cli_dbgmsg(__VA_ARGS__) diff --git a/libclamav/htmlnorm.c b/libclamav/htmlnorm.c index cb23273419..c6c7c1fd4d 100644 --- a/libclamav/htmlnorm.c +++ b/libclamav/htmlnorm.c @@ -1882,7 +1882,7 @@ static bool cli_html_normalise(cli_ctx *ctx, int fd, m_area_t *m_area, const cha } if (style_buff != NULL) { - // Found contents of block. + // Found contents of block. // Search it for images embedded in the CSS. cl_error_t ret = html_style_block_handler(ctx, (const char *)style_buff); if (CL_SUCCESS != ret) { diff --git a/libclamav/ishield.c b/libclamav/ishield.c index aecf8308a3..8341dfd21c 100644 --- a/libclamav/ishield.c +++ b/libclamav/ishield.c @@ -358,7 +358,7 @@ struct IS_CABSTUFF { unsigned int cabno; off_t off; size_t sz; - } * cabs; + } *cabs; off_t hdr; size_t hdrsz; unsigned int cabcnt; diff --git a/libclamav/jpeg.c b/libclamav/jpeg.c index 3bf5ec6afc..34ac79b8b8 100644 --- a/libclamav/jpeg.c +++ b/libclamav/jpeg.c @@ -313,7 +313,7 @@ cl_error_t cli_parsejpeg(cli_ctx *ctx) { cl_error_t status = CL_SUCCESS; - fmap_t *map = NULL; + fmap_t *map = NULL; jpeg_marker_t marker = JPEG_MARKER_NOT_A_MARKER_0x00, prev_marker, prev_segment = JPEG_MARKER_NOT_A_MARKER_0x00; uint8_t buff[50]; /* 50 should be sufficient for now */ uint16_t len_u16; diff --git a/libclamav/jsparse/js-norm.c b/libclamav/jsparse/js-norm.c index e417ac4b45..f645ef74cf 100644 --- a/libclamav/jsparse/js-norm.c +++ b/libclamav/jsparse/js-norm.c @@ -67,7 +67,7 @@ typedef struct scanner { size_t lastpos; enum tokenizer_state state; enum tokenizer_state last_state; -} * yyscan_t; +} *yyscan_t; static int yylex(YYSTYPE *lvalp, yyscan_t); static void yy_scan_bytes(const char *, size_t, yyscan_t scanner); diff --git a/libclamav/matcher-byte-comp.c b/libclamav/matcher-byte-comp.c index 1fa294ea03..c1931610b3 100644 --- a/libclamav/matcher-byte-comp.c +++ b/libclamav/matcher-byte-comp.c @@ -36,7 +36,7 @@ #include "str.h" /* DEBUGGING */ -//#define MATCHER_BCOMP_DEBUG +// #define MATCHER_BCOMP_DEBUG #ifdef MATCHER_BCOMP_DEBUG #define bcm_dbgmsg(...) cli_dbgmsg(__VA_ARGS__) #else diff --git a/libclamav/matcher-pcre.c b/libclamav/matcher-pcre.c index 63534b4eed..4295e0b892 100644 --- a/libclamav/matcher-pcre.c +++ b/libclamav/matcher-pcre.c @@ -46,7 +46,7 @@ #endif /* DEBUGGING */ -//#define MATCHER_PCRE_DEBUG +// #define MATCHER_PCRE_DEBUG #ifdef MATCHER_PCRE_DEBUG #define pm_dbgmsg(...) cli_dbgmsg(__VA_ARGS__) #else diff --git a/libclamav/mbox.c b/libclamav/mbox.c index 6221824a72..5d5ff57d6a 100644 --- a/libclamav/mbox.c +++ b/libclamav/mbox.c @@ -162,7 +162,7 @@ typedef enum { * Slows things down a lot and only catches unencoded copies * of EICAR within bounces, which don't matter */ -//#define SCAN_UNENCODED_BOUNCES +// #define SCAN_UNENCODED_BOUNCES typedef struct mbox_ctx { const char *dir; @@ -265,7 +265,7 @@ static bool haveTooManyMIMEArguments(size_t argCnt, cli_ctx *ctx, bool *heuristi * protocol="application/pgp-encrypted" \ */ #define X_BFILE RELATED /* \ - * BeOS, expert two parts: the file and its \ + * BeOS, expert two parts: the file and its \ * attributes. The attributes part comes as \ * Content-Type: application/x-be_attribute \ * name="foo" \ diff --git a/libclamav/mbr.c b/libclamav/mbr.c index 1d0e95532b..f99d375580 100644 --- a/libclamav/mbr.c +++ b/libclamav/mbr.c @@ -38,8 +38,8 @@ #include "scanners.h" #include "dconf.h" -//#define DEBUG_MBR_PARSE -//#define DEBUG_EBR_PARSE +// #define DEBUG_MBR_PARSE +// #define DEBUG_EBR_PARSE #ifdef DEBUG_MBR_PARSE #define mbr_parsemsg(...) cli_dbgmsg(__VA_ARGS__) diff --git a/libclamav/others.c b/libclamav/others.c index 339936d6f5..6bf43946a4 100644 --- a/libclamav/others.c +++ b/libclamav/others.c @@ -269,7 +269,7 @@ static void *get_module_function(HMODULE handle, const char *name) static void *get_module_function(void *handle, const char *name) { void *procAddress = NULL; - procAddress = dlsym(handle, name); + procAddress = dlsym(handle, name); if (NULL == procAddress) { const char *err = dlerror(); if (NULL == err) { diff --git a/libclamav/others.h b/libclamav/others.h index 703a5f1cf1..b3800be10e 100644 --- a/libclamav/others.h +++ b/libclamav/others.h @@ -73,7 +73,7 @@ * in re-enabling affected modules. */ -#define CL_FLEVEL 201 +#define CL_FLEVEL 202 #define CL_FLEVEL_DCONF CL_FLEVEL #define CL_FLEVEL_SIGTOOL CL_FLEVEL diff --git a/libclamav/pdf.c b/libclamav/pdf.c index 059101c19c..7005c6dfe3 100644 --- a/libclamav/pdf.c +++ b/libclamav/pdf.c @@ -3032,7 +3032,8 @@ static void check_user_password(struct pdf_struct *pdf, int R, const char *O, case 3: case 4: { unsigned char *d; - size_t sz = 68 + pdf->fileIDlen + (R >= 4 && !EM ? 4 : 0); d = calloc(1, sz); + size_t sz = 68 + pdf->fileIDlen + (R >= 4 && !EM ? 4 : 0); + d = calloc(1, sz); if (!(d)) goto done; diff --git a/libclamav/pe.c b/libclamav/pe.c index 85ac529291..9301a9ba90 100644 --- a/libclamav/pe.c +++ b/libclamav/pe.c @@ -2335,7 +2335,7 @@ static inline int hash_impfns(cli_ctx *ctx, void **hashctx, uint32_t *impsz, str thuoff += sizeof(struct pe_image_thunk32); - temp = EC32(thunk32.u.Ordinal); + temp = EC32(thunk32.u.Ordinal); thunk32.u.Ordinal = temp; if (!(thunk32.u.Ordinal & PE_IMAGEDIR_ORDINAL_FLAG32)) { diff --git a/libclamav/pe_icons.c b/libclamav/pe_icons.c index dba41124ca..b42652b051 100644 --- a/libclamav/pe_icons.c +++ b/libclamav/pe_icons.c @@ -188,7 +188,7 @@ int cli_groupiconscan(struct ICON_ENV *icon_env, uint32_t rva) uint16_t depth; uint32_t sz; uint16_t id; - } * dir; + } *dir; raddr = cli_rawaddr(cli_readint32(grp), peinfo->sections, peinfo->nsections, (unsigned int *)(&err), map->len, peinfo->hdr_size); cli_dbgmsg("cli_scanicon: icon group @%x\n", raddr); diff --git a/libclamav/readdb.c b/libclamav/readdb.c index f47b24d1ed..797b0ede7c 100644 --- a/libclamav/readdb.c +++ b/libclamav/readdb.c @@ -3475,8 +3475,8 @@ static int cli_loadcrt(FILE *fs, struct cl_engine *engine, struct cli_dbio *dbio ca.name = NULL; if (strlen(tokens[9])) - ca.not_before = atoi(tokens[8]); - ca.not_after = (-1U) >> 1; + ca.not_before = atoi(tokens[9]); + ca.not_after = (-1ULL) >> 1; ca.hashtype = CLI_HASHTYPE_ANY; crtmgr_add(&(engine->cmgr), &ca); diff --git a/libclamav/regex_list.c b/libclamav/regex_list.c index 171f0ddd04..c1b208af61 100644 --- a/libclamav/regex_list.c +++ b/libclamav/regex_list.c @@ -235,8 +235,8 @@ cl_error_t regex_list_match(struct regex_matcher *matcher, char *real_url, const free(buffer); free(bufrev); /* filter says this suffix doesn't match. - * The filter has false positives, but no false - * negatives */ + * The filter has false positives, but no false + * negatives */ return CL_SUCCESS; } diff --git a/libclamav/sf_base64decode.h b/libclamav/sf_base64decode.h index 5ba333097a..9ea5a17448 100644 --- a/libclamav/sf_base64decode.h +++ b/libclamav/sf_base64decode.h @@ -27,6 +27,6 @@ #include #include "clamav-types.h" -int sf_base64decode(uint8_t*, size_t, uint8_t*, size_t, size_t*); +int sf_base64decode(uint8_t *, size_t, uint8_t *, size_t, size_t *); #endif diff --git a/libclamav/special.c b/libclamav/special.c index 506e5799da..4544e59eeb 100644 --- a/libclamav/special.c +++ b/libclamav/special.c @@ -48,7 +48,8 @@ int cli_check_mydoom_log(cli_ctx *ctx) { - const uint32_t *record; + uint32_t record[16]; + const uint32_t *ptr; uint32_t check, key; fmap_t *map = ctx->fmap; unsigned int blocks = map->len / (8 * 4); @@ -59,14 +60,24 @@ int cli_check_mydoom_log(cli_ctx *ctx) if (blocks > 5) blocks = 5; - record = fmap_need_off_once(map, 0, 8 * 4 * blocks); - if (!record) + /* + * The following pointer might not be properly aligned. There there is + * memcmp() + memcpy() workaround to avoid performing an unaligned access + * while reading the uint32_t. + */ + ptr = fmap_need_off_once(map, 0, 8 * 4 * blocks); + if (!ptr) return CL_CLEAN; + while (blocks) { /* This wasn't probably intended but that's what the current code does anyway */ - if (record[--blocks] == 0xffffffff) + const uint32_t marker_ff = 0xffffffff; + + if (!memcmp(&ptr[--blocks], &marker_ff, sizeof(uint32_t))) return CL_CLEAN; } + memcpy(record, ptr, sizeof(record)); + key = ~be32_to_host(record[0]); check = (be32_to_host(record[1]) ^ key) + (be32_to_host(record[2]) ^ key) + diff --git a/libclamav/udf.h b/libclamav/udf.h index edb6e3278d..f8d5a82d88 100644 --- a/libclamav/udf.h +++ b/libclamav/udf.h @@ -66,10 +66,9 @@ typedef struct __attribute__((packed)) { } lb_addr; - // Long allocation descriptor typedef struct __attribute__((packed)) { - uint32_t length; //4/14.14.1.1 + uint32_t length; // 4/14.14.1.1 /*30 least significant bits are length in bytes. * * 2 most significant bits are described in figure 4/42 @@ -80,7 +79,7 @@ typedef struct __attribute__((packed)) { * 3 the extent is the next extent of allocation descriptors. * */ - lb_addr extentLocation; //logical block number. (CAN be zero) + lb_addr extentLocation; // logical block number. (CAN be zero) uint8_t implementationUse[6]; @@ -158,8 +157,8 @@ typedef struct __attribute__((packed)) { uint16_t partitionReferenceNumber; } LBAddr; -//https://www.ecma-international.org/wp-content/uploads/ECMA-167_3rd_edition_june_1997.pdf -//section 4/23 +// https://www.ecma-international.org/wp-content/uploads/ECMA-167_3rd_edition_june_1997.pdf +// section 4/23 typedef struct __attribute__((packed)) { uint32_t priorRecordedNumberOfDirectEntries; uint16_t strategyType; @@ -211,10 +210,7 @@ static uint32_t getFileIdentifierDescriptorPaddingLength(const FileIdentifierDes static inline size_t getFileIdentifierDescriptorSize(const FileIdentifierDescriptor* fid) { - return FILE_IDENTIFIER_DESCRIPTOR_SIZE_KNOWN - + le16_to_host(fid->implementationLength) - + fid->fileIdentifierLength - + getFileIdentifierDescriptorPaddingLength(fid); + return FILE_IDENTIFIER_DESCRIPTOR_SIZE_KNOWN + le16_to_host(fid->implementationLength) + fid->fileIdentifierLength + getFileIdentifierDescriptorPaddingLength(fid); } typedef struct __attribute__((packed)) { @@ -258,7 +254,7 @@ typedef struct __attribute__((packed)) { uint32_t allocationDescLen; /* Variable length stuff here, need to handle; - */ + */ uint8_t rest[1]; } FileEntryDescriptor; @@ -290,7 +286,7 @@ typedef struct __attribute__((packed)) { uint64_t infoLength; - uint64_t objectSize; //different + uint64_t objectSize; // different uint64_t logicalBlocksRecorded; @@ -298,17 +294,17 @@ typedef struct __attribute__((packed)) { timestamp modificationDateTime; - timestamp creationDateTime; //different + timestamp creationDateTime; // different timestamp attributeDateTime; uint32_t checkpoint; - uint32_t reserved; //different + uint32_t reserved; // different long_ad extendedAttrICB; - long_ad streamDirectoryICB; //different + long_ad streamDirectoryICB; // different regid implementationId; @@ -319,7 +315,7 @@ typedef struct __attribute__((packed)) { uint32_t allocationDescLen; /* Variable length stuff here, need to handle; - */ + */ } ExtendedFileEntryDescriptor; @@ -469,7 +465,7 @@ typedef struct __attribute__((packed)) { charspec descriptorCharSet; - uint8_t logicalVolumeIdentifier[128]; //TODO: handle dstring + uint8_t logicalVolumeIdentifier[128]; // TODO: handle dstring uint32_t logicalBlockSize; @@ -487,7 +483,7 @@ typedef struct __attribute__((packed)) { ext_ad integritySequenceExtent; - uint8_t partitionMaps[1]; //actual length of mapTableLength above; + uint8_t partitionMaps[1]; // actual length of mapTableLength above; } LogicalVolumeDescriptor; @@ -521,7 +517,7 @@ typedef struct __attribute__((packed)) { } FileSetDescriptor; -typedef struct __attribute__((packed)) { +typedef struct __attribute__((packed)) { uint8_t structType; char standardIdentifier[5]; uint8_t structVersion; diff --git a/libclamav/vba_extract.c b/libclamav/vba_extract.c index d96e5945a6..5a53d59e4c 100644 --- a/libclamav/vba_extract.c +++ b/libclamav/vba_extract.c @@ -470,7 +470,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); id = le16_to_host(val16); data_offset += sizeof(uint16_t); @@ -479,7 +479,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); @@ -497,7 +497,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); uint32_t sys_kind = le32_to_host(val32); data_offset += sizeof(uint32_t); CLI_WRITEN("REM PROJECTSYSKIND: ", 20); @@ -534,7 +534,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); uint32_t lcid = le32_to_host(val32); char buf[64]; data_offset += size; @@ -552,7 +552,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); uint32_t lcid_invoke = le32_to_host(val32); char buf[64]; data_offset += sizeof(uint32_t); @@ -570,7 +570,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); codepage = le16_to_host(val16); char buf[64]; data_offset += sizeof(uint16_t); @@ -640,7 +640,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); id = le16_to_host(val16); if (id != 0x003d) { cli_warnmsg("vba_readdir_new: PROJECTHELPFILEPATH is not followed by PROJECTHELPFILEPATH2\n"); @@ -655,7 +655,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } uint32_t size2; - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size2 = le32_to_host(val32); data_offset += sizeof(uint32_t); @@ -692,7 +692,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); uint32_t context = le32_to_host(val32); char buf[64]; data_offset += size; @@ -710,7 +710,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); uint32_t libflags = le32_to_host(val32); char buf[64]; data_offset += sizeof(uint32_t); @@ -729,7 +729,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); uint32_t major = le32_to_host(val32); data_offset += size; @@ -738,7 +738,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); uint16_t minor = le16_to_host(val16); data_offset += sizeof(uint16_t); char buf[64]; @@ -756,7 +756,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); uint16_t modules = le16_to_host(val16); data_offset += sizeof(uint16_t); char buf[64]; @@ -774,7 +774,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co ret = CL_EREAD; goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); uint16_t cookie = le16_to_host(val16); data_offset += sizeof(uint16_t); char buf[64]; @@ -808,7 +808,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); if ((id = le16_to_host(val16)) != 0x0047) { cli_dbgmsg("cli_vba_readdir_new: Expected MODULENAMEUNICODE (0x47) record, but got 0x%04x\n", id); ret = CL_EREAD; @@ -816,7 +816,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co } data_offset += sizeof(uint16_t); CLI_WRITEN("\nREM MODULENAMEUNICODE: ", 24); - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); @@ -859,7 +859,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); if ((id = le16_to_host(val16)) != 0x001a) { cli_dbgmsg("cli_vba_readdir_new: Expected MODULESTREAMNAME (0x1a) record, but got 0x%04x\n", id); ret = CL_EREAD; @@ -867,7 +867,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co } data_offset += sizeof(uint16_t); CLI_WRITEN("\nREM MODULESTREAMNAME: ", 23); - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); @@ -894,7 +894,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); if ((id = le16_to_host(val16)) != 0x0032) { cli_dbgmsg("cli_vba_readdir_new: Expected MODULESTREAMNAMEUNICODE (0x32) record, but got 0x%04x\n", id); ret = CL_EREAD; @@ -902,7 +902,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co } data_offset += sizeof(uint16_t); CLI_WRITEN("\nREM MODULESTREAMNAMEUNICODE: ", 30); - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); uint32_t module_stream_name_size = le32_to_host(val32); data_offset += sizeof(uint32_t); @@ -946,7 +946,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); if ((id = le16_to_host(val16)) != 0x001c) { cli_dbgmsg("cli_vba_readdir_new: Expected MODULEDOCSTRING (0x1c) record, but got 0x%04x\n", id); ret = CL_EREAD; @@ -954,7 +954,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co } data_offset += sizeof(uint16_t); CLI_WRITEN("\nREM MODULEDOCSTRING: ", 22); - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); @@ -981,7 +981,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); if ((id = le16_to_host(val16)) != 0x0048) { cli_dbgmsg("cli_vba_readdir_new: Expected MODULEDOCSTRINGUNICODE (0x32) record, but got 0x%04x\n", id); ret = CL_EREAD; @@ -989,7 +989,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co } data_offset += sizeof(uint16_t); CLI_WRITEN("\nREM MODULEDOCSTRINGUNICODE: ", 29); - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); @@ -1032,14 +1032,14 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); if ((id = le16_to_host(val16)) != 0x0031) { cli_dbgmsg("cli_vba_readdir_new: Expected MODULEOFFSET (0x31) record, but got 0x%04x\n", id); ret = CL_EREAD; goto done; } data_offset += sizeof(uint16_t); - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); if (size != sizeof(uint32_t)) { @@ -1054,7 +1054,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); uint32_t module_offset = le32_to_host(val32); data_offset += size; char buffer[64]; @@ -1071,7 +1071,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); if ((id = le16_to_host(val16)) != 0x001e) { cli_dbgmsg("cli_vba_readdir_new: Expected MODULEHELPCONTEXT (0x1e) record, but got 0x%04x\n", id); ret = CL_EREAD; @@ -1079,7 +1079,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co } data_offset += sizeof(uint16_t); - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); if (size != sizeof(uint32_t)) { @@ -1094,7 +1094,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); uint32_t help_context = le32_to_host(val32); data_offset += size; buffer_size = snprintf(buffer, sizeof(buffer), "\nREM MODULEHELPCONTEXT: 0x%08x", help_context); @@ -1110,14 +1110,14 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); if ((id = le16_to_host(val16)) != 0x002c) { cli_dbgmsg("cli_vba_readdir_new: Expected MODULECOOKIE (0x2c) record, but got 0x%04x\n", id); ret = CL_EREAD; goto done; } data_offset += sizeof(uint16_t); - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); if (size != sizeof(uint16_t)) { @@ -1132,7 +1132,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); uint16_t cookie = le16_to_host(val16); data_offset += size; buffer_size = snprintf(buffer, sizeof(buffer), "\nREM MODULECOOKIE: 0x%04x", cookie); @@ -1147,7 +1147,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); id = le16_to_host(val16); if (id != 0x0021 && id != 0x0022) { cli_dbgmsg("cli_vba_readdir_new: Expected MODULETYPE (0x21/0x22) record, but got 0x%04x\n", id); @@ -1155,7 +1155,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } data_offset += sizeof(uint16_t); - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); if (size != 0) { @@ -1176,7 +1176,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); id = le16_to_host(val16); data_offset += sizeof(uint16_t); @@ -1187,7 +1187,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); if (size != 0) { @@ -1203,7 +1203,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); id = le16_to_host(val16); data_offset += sizeof(uint16_t); } @@ -1216,7 +1216,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); if (size != 0) { @@ -1232,7 +1232,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val16, &data[data_offset], sizeof (uint16_t)); + memcpy(&val16, &data[data_offset], sizeof(uint16_t)); id = le16_to_host(val16); data_offset += sizeof(uint16_t); } @@ -1250,7 +1250,7 @@ cl_error_t cli_vba_readdir_new(cli_ctx *ctx, const char *dir, struct uniq *U, co goto done; } - memcpy(&val32, &data[data_offset], sizeof (uint32_t)); + memcpy(&val32, &data[data_offset], sizeof(uint32_t)); size = le32_to_host(val32); data_offset += sizeof(uint32_t); if (size != 0) { @@ -2021,7 +2021,7 @@ word_read_macro_entry(int fd, macro_info_t *macro_info) uint32_t len __attribute__((packed)); uint32_t state __attribute__((packed)); uint32_t offset __attribute__((packed)); - } * m; + } *m; const struct macro *n; #ifdef HAVE_PRAGMA_PACK #pragma pack() diff --git a/unit_tests/freshclam_test.py b/unit_tests/freshclam_test.py index bec400f6aa..78de30c028 100644 --- a/unit_tests/freshclam_test.py +++ b/unit_tests/freshclam_test.py @@ -10,14 +10,10 @@ from pathlib import Path import platform import shutil -import subprocess -import sys -import time import unittest from functools import partial from http.server import HTTPServer, BaseHTTPRequestHandler -import cgi import testcase diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HDB_1of2_MD5_FIXED_testexe.UNOFFICIAL.hdb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HDB_1of2_MD5_FIXED_testexe.UNOFFICIAL.hdb index 94fe32aec2..946e6efe3b 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HDB_1of2_MD5_FIXED_testexe.UNOFFICIAL.hdb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HDB_1of2_MD5_FIXED_testexe.UNOFFICIAL.hdb @@ -1 +1 @@ -05fcb14bd4dbad8617251d4e22708367:1447976:Test.GenSig.HDB_1of2_MD5_FIXED_testexe +8a655379478861572791e2404f45f9ed:1447992:Test.GenSig.HDB_1of2_MD5_FIXED_testexe diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HDB_2of2_MD5_STAR_testexe.UNOFFICIAL.hdb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HDB_2of2_MD5_STAR_testexe.UNOFFICIAL.hdb index 261053d1d8..198c450d85 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HDB_2of2_MD5_STAR_testexe.UNOFFICIAL.hdb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HDB_2of2_MD5_STAR_testexe.UNOFFICIAL.hdb @@ -1 +1 @@ -05fcb14bd4dbad8617251d4e22708367:*:Test.GenSig.HDB_2of2_MD5_STAR_testexe:73 \ No newline at end of file +8a655379478861572791e2404f45f9ed:*:Test.GenSig.HDB_2of2_MD5_STAR_testexe:73 diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_1of4_SHA1_FIXED_testexe.UNOFFICIAL.hsb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_1of4_SHA1_FIXED_testexe.UNOFFICIAL.hsb index 7a3d422c7a..7134f239af 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_1of4_SHA1_FIXED_testexe.UNOFFICIAL.hsb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_1of4_SHA1_FIXED_testexe.UNOFFICIAL.hsb @@ -1 +1 @@ -2ba31b0352bae4f57c1c9144f64ac7a57c010876:1447976:Test.GenSig.HSB_1of4_SHA1_FIXED_testexe +4a2a55f483339bf55fae340f82d3b42001b30e16:1447992:Test.GenSig.HSB_1of4_SHA1_FIXED_testexe diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_2of4_SHA1_STAR_testexe.UNOFFICIAL.hsb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_2of4_SHA1_STAR_testexe.UNOFFICIAL.hsb index 9d05bc2da2..f5e239bbd1 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_2of4_SHA1_STAR_testexe.UNOFFICIAL.hsb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_2of4_SHA1_STAR_testexe.UNOFFICIAL.hsb @@ -1 +1 @@ -2ba31b0352bae4f57c1c9144f64ac7a57c010876:*:Test.GenSig.HSB_2of4_SHA1_STAR_testexe:73 +4a2a55f483339bf55fae340f82d3b42001b30e16:*:Test.GenSig.HSB_2of4_SHA1_STAR_testexe:73 diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_3of4_SHA256_FIXED_testexe.UNOFFICIAL.hsb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_3of4_SHA256_FIXED_testexe.UNOFFICIAL.hsb index 60300a3689..fa06ce21cf 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_3of4_SHA256_FIXED_testexe.UNOFFICIAL.hsb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_3of4_SHA256_FIXED_testexe.UNOFFICIAL.hsb @@ -1 +1 @@ -4f713f2f0d3269d5ea24bf58c8acff9ad67d53044c07f028ae825cacffb6e82e:1447976:Test.GenSig.HSB_3of4_SHA256_FIXED_testexe +ecb52dac06daf876b6ed53063c5fdd5a3e05a0e70f7d326670f202f36ae66c95:1447992:Test.GenSig.HSB_3of4_SHA256_FIXED_testexe diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_4of4_SHA256_STAR_testexe.UNOFFICIAL.hsb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_4of4_SHA256_STAR_testexe.UNOFFICIAL.hsb index 1558769a64..ae6af8f50a 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_4of4_SHA256_STAR_testexe.UNOFFICIAL.hsb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.HSB_4of4_SHA256_STAR_testexe.UNOFFICIAL.hsb @@ -1 +1 @@ -4f713f2f0d3269d5ea24bf58c8acff9ad67d53044c07f028ae825cacffb6e82e:*:Test.GenSig.HSB_4of4_SHA256_STAR_testexe:73 \ No newline at end of file +ecb52dac06daf876b6ed53063c5fdd5a3e05a0e70f7d326670f202f36ae66c95:*:Test.GenSig.HSB_4of4_SHA256_STAR_testexe:73 diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_01of16_MD5_FIXED_text.UNOFFICIAL.mdb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_01of16_MD5_FIXED_text.UNOFFICIAL.mdb index 60ea617381..ab261f1a2e 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_01of16_MD5_FIXED_text.UNOFFICIAL.mdb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_01of16_MD5_FIXED_text.UNOFFICIAL.mdb @@ -1 +1 @@ -34304:c2cf3afc85a94f96246ebc2d10427b99:Test.GenSig.MDB_01of16_MD5_FIXED_text +34304:1931e3808e2374839e1cb81790d14c14:Test.GenSig.MDB_01of16_MD5_FIXED_text diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_02of16_MD5_STAR_text.UNOFFICIAL.mdb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_02of16_MD5_STAR_text.UNOFFICIAL.mdb index a5fa019c22..86d2153bea 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_02of16_MD5_STAR_text.UNOFFICIAL.mdb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_02of16_MD5_STAR_text.UNOFFICIAL.mdb @@ -1 +1 @@ -*:c2cf3afc85a94f96246ebc2d10427b99:Test.GenSig.MDB_02of16_MD5_STAR_text:73 +*:1931e3808e2374839e1cb81790d14c14:Test.GenSig.MDB_02of16_MD5_STAR_text:73 diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_03of16_MD5_FIXED_data.UNOFFICIAL.mdb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_03of16_MD5_FIXED_data.UNOFFICIAL.mdb index da1edc59fc..70e89a1f14 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_03of16_MD5_FIXED_data.UNOFFICIAL.mdb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_03of16_MD5_FIXED_data.UNOFFICIAL.mdb @@ -1 +1 @@ -1168896:6623c7640384c88d74cc4d7701a02627:Test.GenSig.MDB_03of16_MD5_FIXED_data +1168896:b724ae3f375a29dd4d5fbe37f430c0ea:Test.GenSig.MDB_03of16_MD5_FIXED_data diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_04of16_MD5_STAR_data.UNOFFICIAL.mdb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_04of16_MD5_STAR_data.UNOFFICIAL.mdb index 7fbd3d852b..e854e6cf60 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_04of16_MD5_STAR_data.UNOFFICIAL.mdb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MDB_04of16_MD5_STAR_data.UNOFFICIAL.mdb @@ -1 +1 @@ -*:6623c7640384c88d74cc4d7701a02627:Test.GenSig.MDB_04of16_MD5_STAR_data:73 +*:b724ae3f375a29dd4d5fbe37f430c0ea:Test.GenSig.MDB_04of16_MD5_STAR_data:73 diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_01of32_SHA1_FIXED_text.UNOFFICIAL.msb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_01of32_SHA1_FIXED_text.UNOFFICIAL.msb index 26fb2ba711..764299be73 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_01of32_SHA1_FIXED_text.UNOFFICIAL.msb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_01of32_SHA1_FIXED_text.UNOFFICIAL.msb @@ -1 +1 @@ -34304:7bcc8fbbab4b38c28cb9a571fa7004d8ff47b09d:Test.GenSig.MSB_01of32_SHA1_FIXED_text +34304:45f9f37f318a50c62d3f26699f2415338ddc1f81:Test.GenSig.MSB_01of32_SHA1_FIXED_text diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_02of32_SHA1_STAR_text.UNOFFICIAL.msb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_02of32_SHA1_STAR_text.UNOFFICIAL.msb index b614ef8fa0..3feba8624b 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_02of32_SHA1_STAR_text.UNOFFICIAL.msb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_02of32_SHA1_STAR_text.UNOFFICIAL.msb @@ -1 +1 @@ -*:7bcc8fbbab4b38c28cb9a571fa7004d8ff47b09d:Test.GenSig.MSB_02of32_SHA1_STAR_text:73 +*:45f9f37f318a50c62d3f26699f2415338ddc1f81:Test.GenSig.MSB_02of32_SHA1_STAR_text:73 diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_03of32_SHA1_FIXED_data.UNOFFICIAL.msb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_03of32_SHA1_FIXED_data.UNOFFICIAL.msb index d7bca8539a..7010b7703e 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_03of32_SHA1_FIXED_data.UNOFFICIAL.msb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_03of32_SHA1_FIXED_data.UNOFFICIAL.msb @@ -1 +1 @@ -1168896:dae420693dde3530da0ad06f593148c9647a66b3:Test.GenSig.MSB_03of32_SHA1_FIXED_data +1168896:9cdbd12ab842a2d021be6cb8f379ee219e817fd7:Test.GenSig.MSB_03of32_SHA1_FIXED_data diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_04of32_SHA1_STAR_data.UNOFFICIAL.msb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_04of32_SHA1_STAR_data.UNOFFICIAL.msb index 8762992c3e..5bb94ad380 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_04of32_SHA1_STAR_data.UNOFFICIAL.msb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_04of32_SHA1_STAR_data.UNOFFICIAL.msb @@ -1 +1 @@ -*:dae420693dde3530da0ad06f593148c9647a66b3:Test.GenSig.MSB_04of32_SHA1_STAR_data:73 +*:9cdbd12ab842a2d021be6cb8f379ee219e817fd7:Test.GenSig.MSB_04of32_SHA1_STAR_data:73 diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_17of32_SHA256_FIXED_text.UNOFFICIAL.msb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_17of32_SHA256_FIXED_text.UNOFFICIAL.msb index c23e1d313a..339d0e2107 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_17of32_SHA256_FIXED_text.UNOFFICIAL.msb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_17of32_SHA256_FIXED_text.UNOFFICIAL.msb @@ -1 +1 @@ -34304:a0174c8dfab8cd480495fede811c9fcd16ec40db6d9dbe69e9e5f32907be3a1a:Test.GenSig.MSB_17of32_SHA256_FIXED_text +34304:73757fdfd15f2e63995a547e86cc4568a9137bfb2f64a588ad9e6f45ddd5e367:Test.GenSig.MSB_17of32_SHA256_FIXED_text diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_18of32_SHA256_STAR_text.UNOFFICIAL.msb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_18of32_SHA256_STAR_text.UNOFFICIAL.msb index 920ef139e6..3124b3897b 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_18of32_SHA256_STAR_text.UNOFFICIAL.msb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_18of32_SHA256_STAR_text.UNOFFICIAL.msb @@ -1 +1 @@ -*:a0174c8dfab8cd480495fede811c9fcd16ec40db6d9dbe69e9e5f32907be3a1a:Test.GenSig.MSB_18of32_SHA256_STAR_text:73 +*:73757fdfd15f2e63995a547e86cc4568a9137bfb2f64a588ad9e6f45ddd5e367:Test.GenSig.MSB_18of32_SHA256_STAR_text:73 diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_19of32_SHA256_FIXED_data.UNOFFICIAL.msb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_19of32_SHA256_FIXED_data.UNOFFICIAL.msb index aefc9430e9..d5449b2b15 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_19of32_SHA256_FIXED_data.UNOFFICIAL.msb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_19of32_SHA256_FIXED_data.UNOFFICIAL.msb @@ -1 +1 @@ -1168896:96559752f87084cc488e3163b615d13eac1816580375facd2f872a3e4d808789:Test.GenSig.MSB_19of32_SHA256_FIXED_data +1168896:09dbd8590151147c35c0b096c7b437d69cfa08bb7116b2f1dfc20a7c8e6d7a58:Test.GenSig.MSB_19of32_SHA256_FIXED_data diff --git a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_20of32_SHA256_STAR_data.UNOFFICIAL.msb b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_20of32_SHA256_STAR_data.UNOFFICIAL.msb index 236bec5bbc..43565dd810 100644 --- a/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_20of32_SHA256_STAR_data.UNOFFICIAL.msb +++ b/unit_tests/input/pe_allmatch/alert-sigs/Test.GenSig.MSB_20of32_SHA256_STAR_data.UNOFFICIAL.msb @@ -1 +1 @@ -*:96559752f87084cc488e3163b615d13eac1816580375facd2f872a3e4d808789:Test.GenSig.MSB_20of32_SHA256_STAR_data:73 +*:09dbd8590151147c35c0b096c7b437d69cfa08bb7116b2f1dfc20a7c8e6d7a58:Test.GenSig.MSB_20of32_SHA256_STAR_data:73 diff --git a/unit_tests/input/pe_allmatch/block-cert-sigs/Test.Sig.CRB.BlockCert.crb b/unit_tests/input/pe_allmatch/block-cert-sigs/Test.Sig.CRB.BlockCert.crb index 08083f0d69..719bf514a1 100644 --- a/unit_tests/input/pe_allmatch/block-cert-sigs/Test.Sig.CRB.BlockCert.crb +++ b/unit_tests/input/pe_allmatch/block-cert-sigs/Test.Sig.CRB.BlockCert.crb @@ -1 +1 @@ -Test.Sig.CRB.BlockCert;0;8b166a274bfaa700a912edd57e8e41365beea576;d2a8ea878c4bba243788488f59354835a005baae;E709F7C042C0DFE60CDEF79BFEC8723468DE92B027E4BC31C2D2B8224DE04B6A23C49C8FEBFAD35274651AA5DAA91FD392E0336B31140F90C125E43E4DEBD3276659BBC639425595F4713C4CAC1892D5D136F76263EDE02DF4EBB849A508B492C7BD3FE295617FC5FF1C482543C938F389D521D8E758D59183C7986A5729E16B5BC3081CF3A749447E23106D170E5835BA137821202B100124EDAD00F7508C19F8103B774E9FA19989058EC52776934690E2CAD67B99E93A9AD50C470E0DF4C48F9F78DBFCEF812730A3A458A310A913CCA7E0B10699A4A441C8900A59193FFDC7376162DA6DB805E4BD9AD9463717B6EEDACAD53AEA9E7FDBB2826588FBF8E45F390B4A44A6A01787DC8110581DD1DC00407C3868F3534241BB340AED7CC9CAB56D27F7E6B645F7CC7BA7B0D1BFB27036F09B9FB25B396575C16B0BF3177FE052F7B5C8BB97F72E69DA7971EAFA643C68E36B5F156BAD46F3E3A580A7CE56BA92ACB972143DDA4B20867A45081262DF2E7A1F80A9D3588C60D48010F10461A8AE675CF8EE47E66425A5A6A0D95F1076AFEC6246C3AA635C13AC1E9CEA760316FD89AE2C19FDF696A106BC20B5A2F8E14613A4633726ADC92FD67B6E219CE1A419FE7F397F153C2591547EE08B19C54C8F04B0F6824EABD2572AF9115486479567A77853DDA31CB84609154BA3A043AD0548204875FF365047BC4B7382FD03AF;010001;0;1;0;;Generated with details from sigtool --print-certs \ No newline at end of file +Test.Sig.CRB.BlockCert;0;a5f872f51516a7b95493a152eb79b61d8999188c;e8fe30ff40549bb36227b3b6fa978bc3b7c93a1b;CA5767E912FAC33005614BF5A30360CBB1C194B3B5EA7AE78DF228B76A745AE803F248CFFAE9BD8690935CE5173BB31565D04A931DD2F1D99E17B1BDD35C066F2DD097A87B1786F437156995193D5F1FD49CD855AF0FD9A3BBEA2F8A267770F0F402B28107087142A166C3FDAF673F75518F74DBA6014669FC4377D572F32F58E32F1E575508E547AA2FE25B085B58414562D77F7FE85E92F285F0B52C276A6B68A7E17E9ACBD62DD40ACD1319EE844772EADBACB789A42583953827F2EF6D796292C3ABD2F9533EB07EF196EC7274C17E7FC43B182B543FE1AC4612A995820CAEA2BF3F4FDC4BCC559E95D6180D1B34F51F7D46E40B6CAA88C0BDCDF07E9A8B415E87F57F6BAA207CBC5843D70E5C0A98E643A5E1D8614C3D9C8765B617A1568133DF55FE7E4DC7AB717EAA670E1590569FE0423619DCB062F9E2579717E9231EE44C95DE7218F2D602828C33D08305049BDE439F783B7C478B0F41DB0ADB607429D7CE33E8CB7DC98FE5ECACF21D135D0B4D5F1361BF3898450A9923D00804657CB1A5940B6D25E10A615FC77F68A60A589A2A5BA052FB6B97C22538ED1801D34950FBF4401CB3CAD2839DD3E733F3F0A8F279C886FDE63F5384B3507F03A1A6FF314A32A724D9D5C4794B7A5B01183F7977AACD402B778B900BA03C2E2D52E3A6F1C8524B833701DC6EB4538EDBD516B64BD2CAE8B7AF23312407C0F09421;010001;0;1;0;;Generated with details from sigtool --print-certs \ No newline at end of file diff --git a/unit_tests/input/pe_allmatch/test-exe-src/build.py b/unit_tests/input/pe_allmatch/test-exe-src/build.py index 3db8436ae9..f6fd976740 100755 --- a/unit_tests/input/pe_allmatch/test-exe-src/build.py +++ b/unit_tests/input/pe_allmatch/test-exe-src/build.py @@ -119,7 +119,7 @@ def gen_ca_cert(): # TODO Explore making this cert have attributes that look more like # a real CA cert (ex: restrict its uses) subj = "/C=US/ST=Maryland/L=Fulton/O=Cisco Talos/OU=ClamAV Test CA %016x/emailAddress=rfc2606@example.net" % (random.randint(1,0xFFFFFFFFFFFFFFFF)) - cmd = 'openssl req -new -x509 -days 3650 -key build/ca.key -out build/ca.crt -subj "%s"' % (subj) + cmd = 'openssl req -new -x509 -days 73000 -key build/ca.key -out build/ca.crt -subj "%s"' % (subj) run_cmd(cmd) # https://blog.didierstevens.com/2008/12/30/howto-make-your-own-cert-with-openssl/ @@ -136,7 +136,7 @@ def gen_cs_cert(name, ext): cmd = 'openssl req -new -key %s -out %s -subj "%s"' % (key_name, csr_name, subj) run_cmd(cmd) - cmd = 'openssl x509 -req -days 730 -in %s -CA build/ca.crt -CAkey build/ca.key -out %s -set_serial %012d -extfile ./cs.extfile.cfg' % (csr_name, crt_name, random.randint(100000000000,999999999999)) + cmd = 'openssl x509 -req -days 73000 -in %s -CA build/ca.crt -CAkey build/ca.key -out %s -set_serial %012d -extfile ./cs.extfile.cfg' % (csr_name, crt_name, random.randint(100000000000,999999999999)) run_cmd(cmd) return (key_name, crt_name) diff --git a/unit_tests/input/pe_allmatch/test.exe b/unit_tests/input/pe_allmatch/test.exe index 3f0272eb0d..fe6b3dfea6 100644 Binary files a/unit_tests/input/pe_allmatch/test.exe and b/unit_tests/input/pe_allmatch/test.exe differ diff --git a/unit_tests/input/pe_allmatch/trust-sigs/Test.Sig.CRB.TrustCert.crb b/unit_tests/input/pe_allmatch/trust-sigs/Test.Sig.CRB.TrustCert.crb index dbb59b5185..48fb45c7f8 100644 --- a/unit_tests/input/pe_allmatch/trust-sigs/Test.Sig.CRB.TrustCert.crb +++ b/unit_tests/input/pe_allmatch/trust-sigs/Test.Sig.CRB.TrustCert.crb @@ -1 +1 @@ -Test.Sig.CRB.TrustCert;1;8b166a274bfaa700a912edd57e8e41365beea576;d2a8ea878c4bba243788488f59354835a005baae;E709F7C042C0DFE60CDEF79BFEC8723468DE92B027E4BC31C2D2B8224DE04B6A23C49C8FEBFAD35274651AA5DAA91FD392E0336B31140F90C125E43E4DEBD3276659BBC639425595F4713C4CAC1892D5D136F76263EDE02DF4EBB849A508B492C7BD3FE295617FC5FF1C482543C938F389D521D8E758D59183C7986A5729E16B5BC3081CF3A749447E23106D170E5835BA137821202B100124EDAD00F7508C19F8103B774E9FA19989058EC52776934690E2CAD67B99E93A9AD50C470E0DF4C48F9F78DBFCEF812730A3A458A310A913CCA7E0B10699A4A441C8900A59193FFDC7376162DA6DB805E4BD9AD9463717B6EEDACAD53AEA9E7FDBB2826588FBF8E45F390B4A44A6A01787DC8110581DD1DC00407C3868F3534241BB340AED7CC9CAB56D27F7E6B645F7CC7BA7B0D1BFB27036F09B9FB25B396575C16B0BF3177FE052F7B5C8BB97F72E69DA7971EAFA643C68E36B5F156BAD46F3E3A580A7CE56BA92ACB972143DDA4B20867A45081262DF2E7A1F80A9D3588C60D48010F10461A8AE675CF8EE47E66425A5A6A0D95F1076AFEC6246C3AA635C13AC1E9CEA760316FD89AE2C19FDF696A106BC20B5A2F8E14613A4633726ADC92FD67B6E219CE1A419FE7F397F153C2591547EE08B19C54C8F04B0F6824EABD2572AF9115486479567A77853DDA31CB84609154BA3A043AD0548204875FF365047BC4B7382FD03AF;010001;1;0;0;;Generated with details from sigtool --print-certs \ No newline at end of file +Test.Sig.CRB.TrustCert;1;a5f872f51516a7b95493a152eb79b61d8999188c;e8fe30ff40549bb36227b3b6fa978bc3b7c93a1b;CA5767E912FAC33005614BF5A30360CBB1C194B3B5EA7AE78DF228B76A745AE803F248CFFAE9BD8690935CE5173BB31565D04A931DD2F1D99E17B1BDD35C066F2DD097A87B1786F437156995193D5F1FD49CD855AF0FD9A3BBEA2F8A267770F0F402B28107087142A166C3FDAF673F75518F74DBA6014669FC4377D572F32F58E32F1E575508E547AA2FE25B085B58414562D77F7FE85E92F285F0B52C276A6B68A7E17E9ACBD62DD40ACD1319EE844772EADBACB789A42583953827F2EF6D796292C3ABD2F9533EB07EF196EC7274C17E7FC43B182B543FE1AC4612A995820CAEA2BF3F4FDC4BCC559E95D6180D1B34F51F7D46E40B6CAA88C0BDCDF07E9A8B415E87F57F6BAA207CBC5843D70E5C0A98E643A5E1D8614C3D9C8765B617A1568133DF55FE7E4DC7AB717EAA670E1590569FE0423619DCB062F9E2579717E9231EE44C95DE7218F2D602828C33D08305049BDE439F783B7C478B0F41DB0ADB607429D7CE33E8CB7DC98FE5ECACF21D135D0B4D5F1361BF3898450A9923D00804657CB1A5940B6D25E10A615FC77F68A60A589A2A5BA052FB6B97C22538ED1801D34950FBF4401CB3CAD2839DD3E733F3F0A8F279C886FDE63F5384B3507F03A1A6FF314A32A724D9D5C4794B7A5B01183F7977AACD402B778B900BA03C2E2D52E3A6F1C8524B833701DC6EB4538EDBD516B64BD2CAE8B7AF23312407C0F09421;010001;1;0;0;;Generated with details from sigtool --print-certs \ No newline at end of file diff --git a/win32/compat/dirent.c b/win32/compat/dirent.c index 2e64fe79e5..d1973e2cde 100644 --- a/win32/compat/dirent.c +++ b/win32/compat/dirent.c @@ -22,11 +22,11 @@ #include #include -//#include "clamav.h" -//#include "others.h" +// #include "clamav.h" +// #include "others.h" #include "dirent.h" #include "w32_stat.h" -//#include "misc.h" +// #include "misc.h" DIR *opendir(const char *name) { diff --git a/win32/compat/strptime.c b/win32/compat/strptime.c index 9ffbeb0176..a35c5b393a 100644 --- a/win32/compat/strptime.c +++ b/win32/compat/strptime.c @@ -19,7 +19,7 @@ #define strncasecmp _strnicmp #ifndef _LIBC -//# include +// # include #endif #include @@ -31,7 +31,7 @@ #endif #include #include -//#include +// #include #ifdef _LIBC #include "../locale/localeinfo.h"