diff options
author | Swen Schillig <swen@linux.ibm.com> | 2020-01-22 11:28:28 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2020-02-28 03:08:46 +0000 |
commit | 3b95125187c76945210a679b7ea2dc3b8ae7f778 (patch) | |
tree | 010bea5f8e5204898300b1809630e5ceccf68d1d | |
parent | 535debb312b8dc5a9de6b6fe2543af84e9534a23 (diff) | |
download | samba-3b95125187c76945210a679b7ea2dc3b8ae7f778.tar.gz |
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 <swen@linux.ibm.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/torture/rpc/drsuapi_cracknames.c | 7 |
1 files changed, 5 insertions, 2 deletions
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) */ |