[stda@enea.se] libc/1623: buggs in XDR functions
Andreas Jaeger
aj@suse.de
Fri Mar 3 07:39:00 GMT 2000
Hi glibc folks,
we've received the appended bug report which includes a fix [1]. I've
checked this and do think it's correct. I'm appending a proper diff.
Ulrich, please apply this.
Thanks,
Andreas
Footnotes:
[1] Sten, please send diff -u output next time, this shows better what
you do.
2000-03-03 Andreas Jaeger <aj@suse.de>
* sunrpc/xdr_intXX_t.c (xdr_uint16_t): Fix ENCODE and DECODE
cases.
(xdr_int64_t): Correctly handle lower half.
Fix by Sten Dahlgren <stda@enea.se>, closes PR libc/1623.
============================================================
Index: sunrpc/xdr_intXX_t.c
--- sunrpc/xdr_intXX_t.c 1999/04/08 02:09:57 1.2
+++ sunrpc/xdr_intXX_t.c 2000/03/03 15:33:14
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
@@ -25,7 +25,9 @@
xdr_int64_t (XDR *xdrs, int64_t *ip)
{
int32_t t1;
- int32_t t2;
+ /* This must be unsigned, otherwise we get problems with sign
+ extension in the DECODE case. */
+ uint32_t t2;
switch (xdrs->x_op)
{
@@ -139,11 +141,11 @@
switch (xdrs->x_op)
{
- case XDR_DECODE:
- ut = (uint32_t) *uip;
- return XDR_GETINT32 (xdrs, (int32_t *) &ut);
case XDR_ENCODE:
- if (!XDR_PUTINT32 (xdrs, (int32_t *) &ut))
+ ut = (uint32_t) *uip;
+ return XDR_PUTINT32 (xdrs, (int32_t *) &ut);
+ case XDR_DECODE:
+ if (!XDR_GETINT32 (xdrs, (int32_t *) &ut))
return FALSE;
*uip = (uint16_t) ut;
return TRUE;
More information about the Libc-alpha
mailing list