1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3:torture: fix strict aliasing warnings in cmd_vfs.c

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2022-08-21 20:47:13 +02:00 committed by Jeremy Allison
parent 36c5f31d77
commit 7014475f5b

View File

@ -386,10 +386,14 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
flagstr++;
}
if ((how.flags & O_CREAT) && argc == 4) {
if (sscanf(argv[3], "%ho", (unsigned short *)&how.mode) == 0) {
short _mode = 0;
if (sscanf(argv[3], "%ho", &_mode) == 0) {
printf("open: error=-1 (invalid mode!)\n");
return NT_STATUS_UNSUCCESSFUL;
}
how.mode = _mode;
}
fsp = talloc_zero(vfs, struct files_struct);
@ -1334,6 +1338,7 @@ static NTSTATUS cmd_link(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
static NTSTATUS cmd_mknod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
short _mode = 0;
mode_t mode;
unsigned int dev_val;
SMB_DEV_T dev;
@ -1347,10 +1352,11 @@ static NTSTATUS cmd_mknod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
if (sscanf(argv[2], "%ho", (unsigned short *)&mode) == 0) {
if (sscanf(argv[2], "%ho", &_mode) == 0) {
printf("open: error=-1 (invalid mode!)\n");
return NT_STATUS_UNSUCCESSFUL;
}
mode = _mode;
if (sscanf(argv[3], "%x", &dev_val) == 0) {
printf("open: error=-1 (invalid dev!)\n");