summaryrefslogtreecommitdiffstats
path: root/cpukit/librpc/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-04-23 14:42:58 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-06-06 13:57:43 +0200
commit8250503f218be1a3fa434e905631b1636cf6d033 (patch)
treeb23dfdca86e25ad19ff70a4799b8f7a09389a82d /cpukit/librpc/src
parentnetwork/bootp: PR2031: Add and use header file (diff)
downloadrtems-8250503f218be1a3fa434e905631b1636cf6d033.tar.bz2
librpc: PR2066: Fix for short enums
The XDR library has a problem on architectures with short enums like the default ARM EABI. Short enums means that the size of the enum type is variable and the smallest integer type to hold all enum values will be selected. For many enums this is char. The XDR library uses int32_t for enum_t. There are several evil casts from an enum type to enum_t which leads to invalid memory accesses on short enum architectures. A workaround is to add appropriate dummy enum values.
Diffstat (limited to 'cpukit/librpc/src')
-rw-r--r--cpukit/librpc/src/xdr/xdr.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/cpukit/librpc/src/xdr/xdr.c b/cpukit/librpc/src/xdr/xdr.c
index 02631e60ef..80c29bbfa5 100644
--- a/cpukit/librpc/src/xdr/xdr.c
+++ b/cpukit/librpc/src/xdr/xdr.c
@@ -458,16 +458,14 @@ xdr_enum(
enum_t *ep)
{
#ifndef lint
- enum sizecheck { SIZEVAL }; /* used to find the size of an enum */
-
/*
* enums are treated as ints
*/
- if (sizeof (enum sizecheck) == sizeof (long)) {
+ if (sizeof (enum_t) == sizeof (long)) {
return (xdr_long(xdrs, (long *)ep));
- } else if (sizeof (enum sizecheck) == sizeof (int)) {
+ } else if (sizeof (enum_t) == sizeof (int)) {
return (xdr_int(xdrs, (int *)ep));
- } else if (sizeof (enum sizecheck) == sizeof (short)) {
+ } else if (sizeof (enum_t) == sizeof (short)) {
return (xdr_short(xdrs, (short *)ep));
} else {
return (FALSE);