From ff2b0e242618d048178a00412c48482d728c97bd Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 2 May 2019 11:29:34 +1200 Subject: talloc torture: avoid NULL dereference Signed-off-by: Douglas Bagnall Reviewed-by: Gary Lockyer --- lib/talloc/testsuite.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/talloc') 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); \ -- cgit v1.2.1