Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add descriptive error messages #1

Closed
wants to merge 1 commit into from
Closed

Add descriptive error messages #1

wants to merge 1 commit into from

Conversation

half-duplex
Copy link

Particularly helpful for ENOSPC (No space left on device), which previously showed only "Can't create temporary directory _", "Can't write to _" and "Hint: Check permissions!". Retains all previous hints.

Particularly helpful for ENOSPC (No space left on device)
vrtadmin pushed a commit that referenced this pull request Jan 12, 2016
vrtadmin pushed a commit that referenced this pull request Jan 15, 2016
vrtadmin pushed a commit that referenced this pull request Jan 15, 2016
@half-duplex half-duplex closed this Apr 2, 2019
micahsnyder pushed a commit that referenced this pull request Jun 28, 2020
Looking through the list of issues, I spotted some easy ones and submitted
some fixes:

- 225229 - In cli_rarload: Leak of memory or pointers to system resources.
If finding the necessary libunrar functions fails (should be rare),we now
dlclose libunrar.

225224 - In main (freshclam.c): A copied piece of code is inconsistent with
the original (CWE-398). A minor copy-paste error was present, and optOutList
could be cleaned up in one of the failure edge cases.

225228 - In decodecdb: Out-of-bounds access to a buffer (CWE-119). Off by one
error when tokenizing certain CDB sig fields for printing with sigtool. Ex:

$ cat test.cdb
a:CL_TYPE_7Z:1-2-3:/.*/:1-2-3:1-2-3:0:1-2-3::

$ cat test.cdb | ../installed/bin/sigtool --decode
VIRUS NAME: a
CONTAINER TYPE: CL_TYPE_7Z
CONTAINER SIZE: WITHIN RANGE 1 to 2
FILENAME REGEX: /.*/
COMPRESSED FILESIZE: WITHIN RANGE 1 to 2
UNCOMPRESSED FILESIZE: WITHIN RANGE 1 to 2
ENCRYPTION: NO
FILE POSITION: =================================================================
==17245==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffe3136d10 at pc 0x7f0f31c3f414 bp 0x7fffe3136c70 sp 0x7fffe3136c60
WRITE of size 8 at 0x7fffe3136d10 thread T0
    #0 0x7f0f31c3f413 in cli_strtokenize ../../libclamav/str.c:524
    #1 0x559e9797dc91 in decodecdb ../../sigtool/sigtool.c:2929
    #2 0x559e9797ea66 in decodesig ../../sigtool/sigtool.c:3058
    #3 0x559e9797f31e in decodesigs ../../sigtool/sigtool.c:3162
    #4 0x559e97981fbc in main ../../sigtool/sigtool.c:3638
    #5 0x7f0f3100fb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #6 0x559e9795a1d9 in _start (/home/zelda/workspace/clamav-devel/installed/bin/sigtool+0x381d9)

Address 0x7fffe3136d10 is located in stack of thread T0 at offset 48 in frame
    #0 0x559e9797d113 in decodecdb ../../sigtool/sigtool.c:2840

  This frame has 1 object(s):
    [32, 48) 'range' <== Memory access at offset 48 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow ../../libclamav/str.c:524 in cli_strtokenize

- 225223 - In cli_egg_deflate_decompress: Reads an uninitialized pointer or
its target (CWE-457). Certain fail cases would call inflateEnd on an
uninitialized stream. Now it’s only called after initialization occurs.

- 225220 - In buildcld: Use of an uninitialized variable (CWE-457). Certain
fail cases would result in oldDir being used before initialization. It now
gets zeroed before the first fail case.

- 225219 - In cli_egg_open: Leak of memory or pointers to system resources
(CWE-404).  If certain realloc’s failed, several structures would not be cleaned up

- 225218 - In cli_scanhwpml: Code block is unreachable because of the syntactic
structure of the code (CWE-561).  With certain macros set, there could be two
consecutive return statements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant