Blame SOURCES/libtirpc-0.2.4-xdrstdio.patch
|
|
42131c |
diff -up libtirpc-0.2.4/src/xdr_stdio.c.orig libtirpc-0.2.4/src/xdr_stdio.c
|
|
|
42131c |
--- libtirpc-0.2.4/src/xdr_stdio.c.orig 2013-12-09 15:59:51.000000000 -0500
|
|
|
42131c |
+++ libtirpc-0.2.4/src/xdr_stdio.c 2018-07-20 12:19:18.682840483 -0400
|
|
|
42131c |
@@ -39,6 +39,7 @@
|
|
|
42131c |
*/
|
|
|
42131c |
|
|
|
42131c |
#include <stdio.h>
|
|
|
42131c |
+#include <stdint.h>
|
|
|
42131c |
|
|
|
42131c |
#include <arpa/inet.h>
|
|
|
42131c |
#include <rpc/types.h>
|
|
|
42131c |
@@ -104,10 +105,12 @@ xdrstdio_getlong(xdrs, lp)
|
|
|
42131c |
XDR *xdrs;
|
|
|
42131c |
long *lp;
|
|
|
42131c |
{
|
|
|
42131c |
+ int32_t mycopy;
|
|
|
42131c |
|
|
|
42131c |
- if (fread(lp, sizeof(int32_t), 1, (FILE *)xdrs->x_private) != 1)
|
|
|
42131c |
+ if (fread(&mycopy, sizeof(int32_t), 1, (FILE *)xdrs->x_private) != 1)
|
|
|
42131c |
return (FALSE);
|
|
|
42131c |
- *lp = (long)ntohl((u_int32_t)*lp);
|
|
|
42131c |
+
|
|
|
42131c |
+ *lp = (long)ntohl(mycopy);
|
|
|
42131c |
return (TRUE);
|
|
|
42131c |
}
|
|
|
42131c |
|
|
|
42131c |
@@ -116,8 +119,14 @@ xdrstdio_putlong(xdrs, lp)
|
|
|
42131c |
XDR *xdrs;
|
|
|
42131c |
const long *lp;
|
|
|
42131c |
{
|
|
|
42131c |
- long mycopy = (long)htonl((u_int32_t)*lp);
|
|
|
42131c |
+ int32_t mycopy;
|
|
|
42131c |
+
|
|
|
42131c |
+#if defined(_LP64)
|
|
|
42131c |
+ if ((*lp > UINT32_MAX) || (*lp < INT32_MIN))
|
|
|
42131c |
+ return (FALSE);
|
|
|
42131c |
+#endif
|
|
|
42131c |
|
|
|
42131c |
+ mycopy = (int32_t)htonl((int32_t)*lp);
|
|
|
42131c |
if (fwrite(&mycopy, sizeof(int32_t), 1, (FILE *)xdrs->x_private) != 1)
|
|
|
42131c |
return (FALSE);
|
|
|
42131c |
return (TRUE);
|