bwalex / tc-play

Free and simple TrueCrypt/VeraCrypt Implementation based on dm-crypt
BSD 2-Clause "Simplified" License
551 stars 56 forks source link

segmentation fault with NULL as second argument to tc_api_task_set() #60

Closed mhogomchungu closed 10 years ago

mhogomchungu commented 10 years ago

example program that segfaults is below:

#include <tcplay_api.h>

int main( void )
{
    tc_api_task task ;
    if( tc_api_init( 0 ) == TC_OK ){
                task = tc_api_task_init( "create" ) ;
                if( task != 0 ){
            tc_api_task_set( task,NULL,"blabla" ) ;
            tc_api_task_uninit( task ) ;
                }
                tc_api_uninit() ;
    }

    return 0 ;
}
bwalex commented 10 years ago

To be honest it absolutely doesn't matter. If you do the wrong thing, it'll break. You can still pass (void *)1 now and it'll break...

Don't feel like arguing, so I've just pushed a fix.