View Single Post
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#21
Just a few notes (my C is also a bit rusty, but it's still there

With cal_read_block() both tmp and len are initialized. rd_mode_string is, at that point, still not initialized (i.e. not a valid pointer).

Then you do if((len < 1) && !rd_mode_string) { ... }

so in principle this is invalid. I guess you want if( (len<1) || (tmp == NULL))

because it's tmp and len that get initialized/assigned by cal_read_block().

The && is important. It should be || (OR). Because, assuming rd_mode_string is hopefully initialized to NULL, you're only exiting if len < 1.

So it can happen that you're actually trying to read from tmp (rd_mode_string) when it's still NULL or uninitialized -> SIGSEGV!

I can't compile anything now (can only do useful "work" here when I'm at work, i.e. no compiler; at home I have the compiler, but no time

Try fixing those bugs.(I only looked at the "-q" code path) and post another compiled binary and I'll give it a try!
 

The Following 2 Users Say Thank You to reinob For This Useful Post: