Talpey, Thomas wrote: > At 01:29 PM 10/31/2007, Chuck Lever wrote: >> My proposal is to make all the variables in xdr_decode_string_inplace of >> type u32, and then work backwards into the ULPs, changing the length >> variables of type int to type u32. > > I'd suggest a slight variation - using u32 where the variables shadow > objects which are decoded/encoded off the wire, but using a native > type (unsigned int/int) after they are actually passed outside xdr. Converting XDR types to native types makes sense, I guess. > For example, the length here is u32 within the xdr routine, but after > it's decoded, it's really not something we'd want to pass to > memcpy. IOW, it seems ok to me to have the "maxlen" argument > remain an int (maybe unsigned), but the internal "len" is naturally u32. I can't see why we need to handle negative string length values in most places, so the length variables should be made unsigned, at least. Trond insisted that *lenp and maxlen must be same type here. However, it seems to me that native string lengths should be size_t. (ie the same type that strlen() returns).