SHA256
1
0
forked from pool/libtirpc
libtirpc/0003-xdr-add-a-defensive-mask-in-xdr_int64_t-and-xdr_u_in.patch
Marcus Meissner 4c276cfbb2 Accepting request 747540 from home:pevik:branches:Base:System
- Fix previous version:
  - actually delete
    0001-xdrstdio_create-buffers-do-not-output-encoded-values.patch
  - use 0001-Makefile.am-Use-LIBADD-instead-of-LDFLAGS-to-link-ag.patch
  - use 0002-man-rpc_secure.3t-Fix-typo-in-manpage.patch (renamed from
    0003-man-rpc_secure.3t-Fix-typo-in-manpage.patch)
  - use 0003-xdr-add-a-defensive-mask-in-xdr_int64_t-and-xdr_u_in.patch
    (renamed from
    0004-xdr-add-a-defensive-mask-in-xdr_int64_t-and-xdr_u_in.patch)

  - 000-bindresvport_blacklist.patch (accepted in 5b037cc9, libtirpc 1.1.4)
  - 001-new-rpcbindsock-path.patch (not needed, rpcbind now uses /var/run directory)
  - 002-revert-binddynport.patch (fixed in 2802259, libtirpc-1-0-4-rc1)
  - 0001-Fix-regression-introduced-by-change-rpc-version-orde.patch
    (backport of 25d38d7, libtirpc-1-0-4-rc1)
  - 0001-xdrstdio_create-buffers-do-not-output-encoded-values.patch
    (backport of 145272c, libtirpc-1-0-4-rc2)
  - 0001-Makefile.am-Use-LIBADD-instead-of-LDFLAGS-to-link-ag.patch
  - 0003-man-rpc_secure.3t-Fix-typo-in-manpage.patch
  - 0004-xdr-add-a-defensive-mask-in-xdr_int64_t-and-xdr_u_in.patch

OBS-URL: https://build.opensuse.org/request/show/747540
OBS-URL: https://build.opensuse.org/package/show/Base:System/libtirpc?expand=0&rev=79
2019-11-24 10:23:02 +00:00

45 lines
1.4 KiB
Diff

From d1208b5de7b52172a34e3a7262e96f99830c9770 Mon Sep 17 00:00:00 2001
From: Stefano Garzarella <sgarzare@redhat.com>
Date: Tue, 3 Sep 2019 10:54:11 -0400
Subject: [PATCH 4/7] xdr: add a defensive mask in xdr_int64_t() and
xdr_u_int64_t()
In order to be more defensive, we should mask bits of u_int64_t
value if we want to use only the first 32bit.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
[Upstream status: d1208b5de7b52172a34e3a7262e96f99830c9770]
---
src/xdr.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/xdr.c b/src/xdr.c
index b9a1558..28d1382 100644
--- a/src/xdr.c
+++ b/src/xdr.c
@@ -877,7 +877,8 @@ xdr_int64_t(xdrs, llp)
if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE)
return (FALSE);
*llp = (int64_t)
- (((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1]));
+ (((u_int64_t)ul[0] << 32) |
+ ((u_int64_t)(ul[1]) & 0xffffffff));
return (TRUE);
case XDR_FREE:
return (TRUE);
@@ -910,7 +911,8 @@ xdr_u_int64_t(xdrs, ullp)
if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE)
return (FALSE);
*ullp = (u_int64_t)
- (((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1]));
+ (((u_int64_t)ul[0] << 32) |
+ ((u_int64_t)(ul[1]) & 0xffffffff));
return (TRUE);
case XDR_FREE:
return (TRUE);
--
2.23.0