Eina binbuf: add explicit null-check before magic-check

Summary:
Using `--disable-magic-debug` defines EINA_MAGIC_CHECK to always
evaluate to `1`. Eina_Binbuf's null-check relied solely on the
EINA_MAGIC_CHECK, and failed to pick up on the cases where `buf` was
passed as NULL. This has led to  a segfault when a NULL `buf` was passed
in the test suite (see referenced ticket).

This fix adds an explicit NULL check.

Fixes https://phab.enlightenment.org/T7147

Reviewers: zmike

Reviewed By: zmike

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6592
This commit is contained in:
Daniel Hirt 2018-07-16 06:09:38 -04:00 committed by Mike Blumenkrantz
parent a61786bd0e
commit 93397449d4
1 changed files with 1 additions and 0 deletions

View File

@ -25,6 +25,7 @@ struct _Eina_Strbuf
#define EINA_MAGIC_CHECK_STRBUF(d, ...) \
do { \
if (!(d)) return __VA_ARGS__; \
if (!EINA_MAGIC_CHECK((d), _STRBUF_MAGIC)) \
{ \
EINA_MAGIC_FAIL((d), _STRBUF_MAGIC); \