mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-05-14 22:16:08 +00:00
Fix UAF in static routes
Dupe resource ID before freeing Data memory.
This commit is contained in:
parent
cd4932ff79
commit
605c85ca97
@ -32,7 +32,7 @@ pub fn resourceId(self: *Self) ![]const u8 {
|
|||||||
// Routes generator rejects missing `.id` option so this should always be present.
|
// Routes generator rejects missing `.id` option so this should always be present.
|
||||||
// Note that static requests are never rendered at runtime so we can be unsafe here and risk
|
// Note that static requests are never rendered at runtime so we can be unsafe here and risk
|
||||||
// failing a build (which would not be coherent if we allowed it to complete).
|
// failing a build (which would not be coherent if we allowed it to complete).
|
||||||
return data.value.?.get("id").?.string.value;
|
return try self.allocator.dupe(u8, data.value.?.get("id").?.string.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the static params defined by `pub const static_params` in the relevant view.
|
/// Returns the static params defined by `pub const static_params` in the relevant view.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user