• Chuck Lever's avatar
    SUNRPC: Use unsigned string lengths in xdr_decode_string_inplace · e5cff482
    Chuck Lever authored
    XDR strings, opaques, and net objects should all use unsigned lengths.
    To wit, RFC 4506 says:
    
    4.2.  Unsigned Integer
    
       An XDR unsigned integer is a 32-bit datum that encodes a non-negative
       integer in the range [0,4294967295].
    
     ...
    
    4.11.  String
    
       The standard defines a string of n (numbered 0 through n-1) ASCII
       bytes to be the number n encoded as an unsigned integer (as described
       above), and followed by the n bytes of the string.
    
    After this patch, xdr_decode_string_inplace now matches the other XDR
    string and array helpers that take a string length argument.  See:
    
    xdr_encode_opaque_fixed, xdr_encode_opaque, xdr_encode_array
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    Acked-By: default avatarNeilBrown <neilb@suse.de>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    e5cff482
xdr.c 26.9 KB