From: Douglas Bagnall Date: Wed, 1 May 2019 23:29:34 +0000 (+1200) Subject: talloc torture: avoid NULL dereference X-Git-Tag: tdb-1.4.1~144 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ff2b0e242618d048178a00412c48482d728c97bd;p=thirdparty%2Fsamba.git talloc torture: avoid NULL dereference Signed-off-by: Douglas Bagnall Reviewed-by: Gary Lockyer --- diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c index 35309e2af25..a76a64716c8 100644 --- a/lib/talloc/testsuite.c +++ b/lib/talloc/testsuite.c @@ -63,7 +63,9 @@ static double private_timeval_elapsed(struct timeval *tv) } #define torture_assert_str_equal(test, arg1, arg2, desc) \ - if (arg1 == NULL && arg2 == NULL) { \ + if (arg1 == NULL && arg2 == NULL) { /* OK, both NULL == equal */ \ + } else if (arg1 == NULL || arg2 == NULL) { \ + return false; \ } else if (strcmp(arg1, arg2)) { \ printf("failure: %s [\n%s: Expected %s, got %s: %s\n]\n", \ test, __location__, arg1, arg2, desc); \