Fixed xattr parsing
This commit is contained in:
+3
-2
@@ -40,12 +40,12 @@ pub fn get(self: *XattrTable, alloc: std.mem.Allocator, io: Io, idx: u32) !Xattr
|
||||
var key: KeyEntry = undefined;
|
||||
try meta.interface.readSliceEndian(KeyEntry, @ptrCast(&key), .little);
|
||||
|
||||
key.name_size += switch (key.type.prefix) {
|
||||
const prefix_size: u16 = switch (key.type.prefix) {
|
||||
.user => 5,
|
||||
.trusted => 8,
|
||||
.security => 9,
|
||||
};
|
||||
x.key = try alloc.allocSentinel(u8, key.name_size, 0);
|
||||
x.key = try alloc.allocSentinel(u8, key.name_size + prefix_size, 0);
|
||||
errdefer alloc.free(x.key);
|
||||
|
||||
switch (key.type.prefix) {
|
||||
@@ -53,6 +53,7 @@ pub fn get(self: *XattrTable, alloc: std.mem.Allocator, io: Io, idx: u32) !Xattr
|
||||
.trusted => @memcpy(x.key[0..8], "trusted."),
|
||||
.security => @memcpy(x.key[0..9], "security."),
|
||||
}
|
||||
try meta.interface.readSliceEndian(u8, x.key[prefix_size..][0..key.name_size], .little);
|
||||
|
||||
if (!key.type.out_of_line) {
|
||||
var size: u32 = undefined;
|
||||
|
||||
Reference in New Issue
Block a user