From: Swen Schillig Date: Wed, 22 Jan 2020 10:28:28 +0000 (+0100) Subject: prevent NULL reference from being used as '%s' argument. X-Git-Tag: ldb-2.2.0~1544 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b95125187c76945210a679b7ea2dc3b8ae7f778;p=thirdparty%2Fsamba.git prevent NULL reference from being used as '%s' argument. The two string arguments to torture_comment() can be NULL as the succeeding checks suggest. This is not wanted because a compile with --enable-developer throws an error of [-Werror=format-overflow=] in those situations. Signed-off-by: Swen Schillig Reviewed-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c index 7d8139f8c1d..a0daa608748 100644 --- a/source4/torture/rpc/drsuapi_cracknames.c +++ b/source4/torture/rpc/drsuapi_cracknames.c @@ -201,8 +201,11 @@ static bool test_DsCrackNamesMatrix(struct torture_context *tctx, for (j = 0; j < ARRAY_SIZE(formats); j++) { torture_comment(tctx, "Converting %s (format %d)" " to %d gave %s\n", - n_from[i], formats[i], - formats[j], n_matrix[i][j]); + n_from[i] == NULL ? "NULL" : n_from[i], + formats[i], formats[j], + n_matrix[i][j] == NULL ? + "NULL" : n_matrix[i][j]); + if (n_matrix[i][j] == n_from[j]) { /* We don't have a from name for these yet (and we can't map to them to find it out) */