fix: don't allow absolute paths (duh)
This commit is contained in:
parent
8629c93766
commit
b1a847cf2c
|
@ -258,7 +258,7 @@ pub fn vidsRoute(
|
|||
const filepath = try std.fs.path.resolve(std.heap.c_allocator, &.{ state.vids_dir, basepath });
|
||||
defer std.heap.c_allocator.free(filepath);
|
||||
|
||||
if (std.mem.startsWith(u8, filepath, ".."))
|
||||
if (std.fs.path.isAbsolute(filepath) or std.mem.startsWith(u8, filepath, ".."))
|
||||
return c.OCS_FORBIDDEN;
|
||||
|
||||
const filepath_z = try std.heap.c_allocator.dupeZ(u8, filepath);
|
||||
|
|
Loading…
Reference in New Issue