Suhas Athani has uploaded this change for review.

View Change

XDR: reject empty utf8strings unless the field allows empty

GitHub Issue: #1404

xdr_utf8string_decode() accepted a zero length string and returned
early, leaving utf8string_val NULL. Callers then had to check both the
length and the pointer, and several did not.

Add an allow_empty flag to xdr_utf8string_decode() and
inline_xdr_utf8string(). xdr_utf8string() (and so component4,
linktext4 and the utf8str_* types) now rejects empty strings on both
decode and encode. An allowed empty string is returned as a NUL
terminated "" rather than NULL.

Add xdr_utf8string_empty_ok() and use it for the fields that may be
empty:
- COMPOUND and CB_COMPOUND tag (args and res)
- GETXATTR/SETXATTR value (really an opaque, may be empty)
- nfsace4.who (delegation permissions ACE is sent with empty who)
- nfs_impl_id4 nii_domain/nii_name (informational only)

decode_acl() rejects an empty ACE who.

Change-Id: I4822ce64f324a64a6d6c6c02884ccdf04d2b5871
Signed-off-by: Suhas Athani <Suhas.Athani@ibm.com>
---
M src/Protocols/NFS/nfs_proto_tools.c
M src/include/nfsv41.h
2 files changed, 40 insertions(+), 21 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/81/1252581/1

To view, visit change 1252581. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I4822ce64f324a64a6d6c6c02884ccdf04d2b5871
Gerrit-Change-Number: 1252581
Gerrit-PatchSet: 1
Gerrit-Owner: Suhas Athani <Suhas.Athani@ibm.com>