[PATCH] s3/rpc_server/srvsvc/srv_srvsvc_nt.c: change snum to signed int
Aurélien Aptel
aaptel at suse.com
Thu Mar 3 15:53:27 UTC 2016
Hi,
Another PVS fix:
snum is used to store the result of the find_service() call which
returns a signed int, with -1 being an error.
As an uint32_t the implicit cast converts -1 to UINT32_MAX in snum and
the error check (< 0) is always false.
The attached patch defines snum as an int instead of uint32_t. When
snum is subsequently passed to count_share_opens() as an uint32_t the
implicit cast from a positive int to uint32_t is always safe AFAIK.
An alternative fix would be to replace the < 0 check with == UINT32_MAX
or == -1 which are equivalent (signed values are always casted to
unsigned in signed/unsigned comparison, e.g. -1 > 1U is true).
Please review/comment
Thanks!
--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG
Nürnberg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-s3-rpc_server-srvsvc-srv_srvsvc_nt.c-change-snum-to-.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160303/64121ee3/0008-s3-rpc_server-srvsvc-srv_srvsvc_nt.c-change-snum-to-.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160303/64121ee3/attachment.sig>
More information about the samba-technical
mailing list