Thread: Error using libclamav

  1. #1
    Registered User surgeon's Avatar
    Join Date
    Jan 2015
    Posts
    26

    Error using libclamav

    I'm trying to work with clamav sample code. Application compiled,prints number of signatures, and then crashed.

    Using debugger, I found code with error:
    Code:
    if((ret = cl_scandesc(fd,&virname,&size, engine, CL_SCAN_STDOPT))== CL_VIRUS){//!!!!!
        printf("Virus detected: %s\n", virname);
    }
    
    
    On this code application crashed. Help plz to fix error.
    P.S. MSVC 2010/MSVC 2017, x86/x64 - same error.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    So using the debugger, find out which of fd,virname,size, engine are garbage.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    A wild guess of what to try.

    The sample has this
    Code:
    const char *virname;
    I would try to replace it with
    Code:
    const char *virname = NULL;
    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-31-2015, 02:11 PM
  2. Compile error? Logic error? Syntax Error? Please help
    By Khody Afkhami in forum C Programming
    Replies: 4
    Last Post: 10-11-2014, 01:36 AM
  3. Replies: 6
    Last Post: 10-29-2012, 03:33 AM
  4. Replies: 4
    Last Post: 07-24-2011, 09:38 PM
  5. Replies: 3
    Last Post: 10-02-2007, 09:12 PM

Tags for this Thread