Fix bad bit shift in setcifsacl.c

Signed-off-by: Jeff Layton <jlayton@redhat.com>
This commit is contained in:
Jeff Layton 2013-10-09 06:35:39 -04:00
parent 205e1dfd3d
commit c674873660
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 163dc5ba93cae1cc81b709a05d8979d6b11cf04d Mon Sep 17 00:00:00 2001
From: Jeff Layton <jlayton@samba.org>
Date: Tue, 8 Oct 2013 21:07:24 -0400
Subject: [PATCH] setcifsacl: fix bad bit-shift in raw_str_to_sid
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A Coverity scan turned up this warning:
1. cifs-utils-6.2/setcifsacl.c:578:result_independent_of_operands "(x & 0xff0000000000ULL) >> 48" is 0 regardless of the values of its operands. This occurs as the operand of assignment.
...which is entirely true. That shift should be 40 bits, not 48.
Signed-off-by: Jeff Layton <jlayton@samba.org>
---
setcifsacl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setcifsacl.c b/setcifsacl.c
index ce708eb..7eeeaa6 100644
--- a/setcifsacl.c
+++ b/setcifsacl.c
@@ -575,7 +575,7 @@ raw_str_to_sid(const char *str, struct cifs_sid *csid)
csid->authority[3] = (x & 0x000000ff0000ULL) >> 16;
csid->authority[2] = (x & 0x0000ff000000ULL) >> 24;
csid->authority[1] = (x & 0x00ff00000000ULL) >> 32;
- csid->authority[0] = (x & 0xff0000000000ULL) >> 48;
+ csid->authority[0] = (x & 0xff0000000000ULL) >> 40;
/* now read the the subauthorities and store as __le32 vals */
p = q + 1;
--
1.8.3.1

View File

@ -3,7 +3,7 @@
Name: cifs-utils
Version: 6.2
Release: 1%{pre_release}%{?dist}
Release: 2%{pre_release}%{?dist}
Summary: Utilities for mounting and managing CIFS mounts
Group: System Environment/Daemons
@ -18,6 +18,7 @@ Requires(post): /usr/sbin/alternatives
Requires(preun): /usr/sbin/alternatives
Source0: ftp://ftp.samba.org/pub/linux-cifs/cifs-utils/%{name}-%{version}%{pre_release}.tar.bz2
Patch1: 0001-setcifsacl-fix-bad-bit-shift-in-raw_str_to_sid.patch
%description
The SMB/CIFS protocol is a standard file sharing protocol widely deployed
@ -38,6 +39,7 @@ necessary for building ID mapping plugins for cifs-utils.
%prep
%setup -q -n %{name}-%{version}%{pre_release}
%patch1 -p1
%build
%configure --prefix=/usr ROOTSBINDIR=%{_sbindir}
@ -87,6 +89,9 @@ fi
%{_includedir}/cifsidmap.h
%changelog
* Wed Oct 09 2013 Jeff Layton <jlayton@redhat.com> 6.2-2
- fix bad bit shift in setcifsacl.c
* Fri Oct 04 2013 Jeff Layton <jlayton@redhat.com> 6.2-1
- update to 6.2 release