Created attachment 527280 [details, diff] Fix for incorrect marshalling of "long" on 64-bit In src/xdr_stdio.c in libtirpc, there are two functions to marshal integers. The fread/fwrite calls use "sizeof(int32_t)" to specify how much to read or write (which is correct), however the data that is read/written is accessed using a "long *", which is not correct on LP64 systems where "long" is 64 bit, not 32. This leads to weird behaviour being observed on 64-bit big endian, such as multi-gigabyte allocations being attempted. Just running "id" prints memory allocation errors from xdr_string if I limit the memory space to 1 GB. The attached patch fixes the issue by dereferencing the data as 32-bit and _then_ converting to long on read, and vice versa on write.
Looks like this was fixed by http://git.linux-nfs.org/?p=steved/libtirpc.git;a=commit;h=145272c2b6d89a1c3a7de86a2cbef43880f1b61b which is in v1.1.4.