aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris D. Faulhaber <jedgar@FreeBSD.org>2003-03-20 13:05:28 +0000
committerChris D. Faulhaber <jedgar@FreeBSD.org>2003-03-20 13:05:28 +0000
commit1aa5093e0c270549412dbc7c125643e0d8e89e9e (patch)
tree8dc3e1e404cbef136a7f9902f4060c11b27bcdaa
parent175b7923ab4e666c26af7932b3414a0d472d66b0 (diff)
downloadsrc-1aa5093e0c270549412dbc7c125643e0d8e89e9e.tar.gz
src-1aa5093e0c270549412dbc7c125643e0d8e89e9e.zip
MFC:
src/lib/libc/xdr/xdr_mem.c 1.12 src/include/rpc/xdr.h 1.23 Clean up some signed/unsigned issues in the XDR code.
Notes
Notes: svn path=/releng/5.0/; revision=112432
-rw-r--r--UPDATING3
-rw-r--r--include/rpc/xdr.h2
-rw-r--r--lib/libc/xdr/xdr_mem.c22
-rw-r--r--sys/conf/newvers.sh2
4 files changed, 19 insertions, 10 deletions
diff --git a/UPDATING b/UPDATING
index a5aa4f7063df..0299487a0e5f 100644
--- a/UPDATING
+++ b/UPDATING
@@ -17,6 +17,9 @@ minimal number of processes, if possible, for that patch. For those
updates that don't have an advisory, or to be safe, you can do a full
build and install as described in the COMMON ITEMS section.
+20030320: p5 FreeBSD-SA-03:05.xdr
+ integer overflow errors in the Sun XDR library.
+
20030303: p4 FreeBSD-SA-03:04.sendmail
sendmail header parsing buffer overflow, ident parsing bug.
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index 7af99ce2c903..00459ba7b62a 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -121,7 +121,7 @@ typedef struct __rpc_xdr {
char * x_public; /* users' data */
void * x_private; /* pointer to private data */
char * x_base; /* private used for position info */
- int x_handy; /* extra private word */
+ u_int x_handy; /* extra private word */
} XDR;
/*
diff --git a/lib/libc/xdr/xdr_mem.c b/lib/libc/xdr/xdr_mem.c
index 19ed188cf4e1..c1d7594a7360 100644
--- a/lib/libc/xdr/xdr_mem.c
+++ b/lib/libc/xdr/xdr_mem.c
@@ -126,8 +126,9 @@ xdrmem_getlong_aligned(xdrs, lp)
long *lp;
{
- if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ if (xdrs->x_handy < sizeof(int32_t))
return (FALSE);
+ xdrs->x_handy -= sizeof(int32_t);
*lp = ntohl(*(u_int32_t *)xdrs->x_private);
xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
return (TRUE);
@@ -139,8 +140,9 @@ xdrmem_putlong_aligned(xdrs, lp)
const long *lp;
{
- if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ if (xdrs->x_handy < sizeof(int32_t))
return (FALSE);
+ xdrs->x_handy -= sizeof(int32_t);
*(u_int32_t *)xdrs->x_private = htonl((u_int32_t)*lp);
xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
return (TRUE);
@@ -153,8 +155,9 @@ xdrmem_getlong_unaligned(xdrs, lp)
{
u_int32_t l;
- if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ if (xdrs->x_handy < sizeof(int32_t))
return (FALSE);
+ xdrs->x_handy -= sizeof(int32_t);
memmove(&l, xdrs->x_private, sizeof(int32_t));
*lp = ntohl(l);
xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
@@ -168,8 +171,9 @@ xdrmem_putlong_unaligned(xdrs, lp)
{
u_int32_t l;
- if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ if (xdrs->x_handy < sizeof(int32_t))
return (FALSE);
+ xdrs->x_handy -= sizeof(int32_t);
l = htonl((u_int32_t)*lp);
memmove(xdrs->x_private, &l, sizeof(int32_t));
xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
@@ -183,8 +187,9 @@ xdrmem_getbytes(xdrs, addr, len)
u_int len;
{
- if ((xdrs->x_handy -= len) < 0)
+ if (xdrs->x_handy < len)
return (FALSE);
+ xdrs->x_handy -= len;
memmove(addr, xdrs->x_private, len);
xdrs->x_private = (char *)xdrs->x_private + len;
return (TRUE);
@@ -197,8 +202,9 @@ xdrmem_putbytes(xdrs, addr, len)
u_int len;
{
- if ((xdrs->x_handy -= len) < 0)
+ if (xdrs->x_handy < len)
return (FALSE);
+ xdrs->x_handy -= len;
memmove(xdrs->x_private, addr, len);
xdrs->x_private = (char *)xdrs->x_private + len;
return (TRUE);
@@ -221,10 +227,10 @@ xdrmem_setpos(xdrs, pos)
char *newaddr = xdrs->x_base + pos;
char *lastaddr = (char *)xdrs->x_private + xdrs->x_handy;
- if ((long)newaddr > (long)lastaddr)
+ if (newaddr > lastaddr)
return (FALSE);
xdrs->x_private = newaddr;
- xdrs->x_handy = (int)((long)lastaddr - (long)newaddr);
+ xdrs->x_handy = (u_int)(lastaddr - newaddr); /* XXX sizeof(u_int) <? sizeof(ptrdiff_t) */
return (TRUE);
}
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 26b518b50224..2137f9be21a4 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -36,7 +36,7 @@
TYPE="FreeBSD"
REVISION="5.0"
-BRANCH="RELEASE-p4"
+BRANCH="RELEASE-p5"
RELEASE="${REVISION}-${BRANCH}"
VERSION="${TYPE} ${RELEASE}"