commit | 496b4694ef1efd0b504bf8d7a687af4bc1299c04 | [log] [tgz] |
---|---|---|
author | Chris Tam <godtamit@google.com> | Wed Jan 18 02:32:50 2023 +0000 |
committer | Chris Tam <godtamit@google.com> | Wed Jan 18 19:29:13 2023 +0000 |
tree | 0b1ae3618723610c1194038ebe47af88c817f149 | |
parent | 464c15b1ae11d2f11e0d62fb9f9f1ef6146e9765 [diff] |
[zxio] Do not null-terminate directory entry name As specified in the zxio spec, `zxio_dirent_t` does not guarantee that the name is null-terminated[1]. Remove this null termination in the Fuchsia mesa code so that we don't rely on it. [1]: https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/lib/zxio/include/lib/zxio/types.h;l=356;drc=bc47f52ff4f1e33f845840661a294586562f35b7 Change-Id: I643a589c6778db2e1dd9c0133b7c4bdd0496946b Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/mesa/+/790606 Reviewed-by: Tamir Duberstein <tamird@google.com>
diff --git a/src/util/os_dirent_fuchsia.cpp b/src/util/os_dirent_fuchsia.cpp index 881c90c..e428846 100644 --- a/src/util/os_dirent_fuchsia.cpp +++ b/src/util/os_dirent_fuchsia.cpp
@@ -79,7 +79,7 @@ struct os_dirent_impl* Next() { - zxio_dirent_t dirent = { .name = entry.d_name }; + zxio_dirent_t dirent = {.name = entry.d_name}; zx_status_t status = zxio_dirent_iterator_next(&iterator, &dirent); if (status != ZX_OK) { if (status != ZX_ERR_NOT_FOUND) @@ -87,9 +87,7 @@ return nullptr; } - entry.d_ino = dirent.has.id ? dirent.id : OS_INO_UNKNOWN; - entry.d_name[dirent.name_length] = '\0'; return &entry; }