vmg / sundown

Standards compliant, fast, secure markdown processing library in C
1.99k stars 385 forks source link

fixed crashbug with empty string #76

Closed roddi closed 12 years ago

roddi commented 12 years ago

please accept this patch. Thanks Roddi

vmg commented 12 years ago

Hey, sorry I've overlooked this. I don't quite like the fix -- can you tell me why is bufputs called with a NULL string? I think it'd be better if we fixed that instead. :)

roddi commented 12 years ago

Hi tanoku,

in my code (when using sundown) I accidentally called it with a NULL string (fixed by now). Since all other methods of the buffer module check for NULL pointers I thought that this was an oversight that should be fixed.

Is there a reason, that buffputs() should not check its parameters but crash instead? Shouldn't I use buffputs() in the first place (as a client)?

Regards Roddi

vmg commented 12 years ago

:+1: I've merged a different version of this, that asserts the buffer and the buffer allocation size uniformly for all buffer calls. Thanks for spotting this!

roddi commented 12 years ago

Good solution, Thanks!