Li Qiang ba42ebb863 9pfs: allocate space for guest originated empty strings
If a guest sends an empty string paramater to any 9P operation, the current
code unmarshals it into a V9fsString equal to { .size = 0, .data = NULL }.

This is unfortunate because it can cause NULL pointer dereference to happen
at various locations in the 9pfs code. And we don't want to check str->data
everywhere we pass it to strcmp() or any other function which expects a
dereferenceable pointer.

This patch enforces the allocation of genuine C empty strings instead, so
callers don't have to bother.

Out of all v9fs_iov_vunmarshal() users, only v9fs_xattrwalk() checks if
the returned string is empty. It now uses v9fs_string_size() since
name.data cannot be NULL anymore.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
[groug, rewritten title and changelog,
 fix empty string check in v9fs_xattrwalk()]
Signed-off-by: Greg Kurz <groug@kaod.org>
2016-10-17 14:13:58 +02:00
..
2016-10-04 13:28:07 +01:00
2016-10-10 16:23:40 +01:00
2016-10-10 16:23:40 +01:00
2016-10-08 09:02:19 +03:00
2016-10-04 13:28:09 +01:00
2016-06-17 16:33:48 +10:00
2016-10-10 16:23:40 +01:00
2016-09-29 12:07:51 +01:00
2016-06-14 15:59:13 +01:00
2016-10-10 16:23:40 +01:00
2016-10-04 14:25:08 +01:00
2016-10-10 10:39:29 +01:00
2016-05-18 15:04:27 +03:00
2016-09-23 11:42:52 +08:00
2016-09-08 18:05:21 +04:00
2016-10-04 10:00:25 +02:00
2016-10-10 02:21:43 +03:00
2016-09-23 11:42:52 +08:00
2016-07-29 00:07:09 +03:00
2016-01-29 15:07:25 +00:00
2016-09-22 18:13:08 +01:00
2016-09-15 15:32:22 +03:00
2016-09-29 11:43:22 +08:00
2016-10-04 13:28:07 +01:00
2016-10-10 10:39:29 +01:00
2016-09-15 15:32:22 +03:00
2016-10-10 16:23:40 +01:00
2016-10-04 13:28:07 +01:00