1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s4:torture: Add missing NULL checks in spoolss.c

source4/torture/rpc/spoolss.c: In function
  ‘check_printer_driver_file.isra’:
source4/torture/rpc/spoolss.c:10850:58: error: ‘%s’ directive argument
  is null [-Werror=format-overflow=]
10850 |         const char *remote_name = talloc_asprintf(tctx, "%s\\%d\\%s",
      |                                                          ^~

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andreas Schneider 2024-04-30 17:31:00 +02:00 committed by Andreas Schneider
parent 8d5b40296f
commit 4a48148a7d

View File

@ -10846,15 +10846,22 @@ static bool check_printer_driver_file(struct torture_context *tctx,
struct torture_driver_context *d, struct torture_driver_context *d,
const char *file_name) const char *file_name)
{ {
const char *remote_arch_dir = driver_directory_dir(d->remote.driver_directory); const char *remote_arch_dir = NULL;
const char *remote_name = talloc_asprintf(tctx, "%s\\%d\\%s", const char *remote_name = NULL;
remote_arch_dir,
d->info8.version,
file_name);
int fnum; int fnum;
torture_assert(tctx, (file_name && strlen(file_name) != 0), "invalid filename"); torture_assert(tctx, (file_name && strlen(file_name) != 0), "invalid filename");
remote_arch_dir = driver_directory_dir(d->remote.driver_directory);
torture_assert_not_null(tctx, remote_arch_dir, "remote_arch_dir is null");
remote_name = talloc_asprintf(tctx,
"%s\\%d\\%s",
remote_arch_dir,
d->info8.version,
file_name);
torture_assert_not_null(tctx, remote_name, "renote_name is null");
torture_comment(tctx, "checking for driver file at %s\n", remote_name); torture_comment(tctx, "checking for driver file at %s\n", remote_name);
fnum = smbcli_open(cli->tree, remote_name, O_RDONLY, DENY_NONE); fnum = smbcli_open(cli->tree, remote_name, O_RDONLY, DENY_NONE);