diff options
| author | 2023-08-15 01:56:37 -0700 | |
|---|---|---|
| committer | 2023-08-15 01:56:37 -0700 | |
| commit | 1a6a52314f88946e66ac0f36d00d624ec1a5296f (patch) | |
| tree | c43b3eb518d51e97e21cfbfae4808941c4771df7 /src/fs.zig | |
| parent | 47450ed12ccfe1d76ca527ea95f602e6ba089dce (diff) | |
| download | bun-1a6a52314f88946e66ac0f36d00d624ec1a5296f.tar.gz bun-1a6a52314f88946e66ac0f36d00d624ec1a5296f.tar.zst bun-1a6a52314f88946e66ac0f36d00d624ec1a5296f.zip | |
fix importing too long of strings (#4155)
Diffstat (limited to '')
| -rw-r--r-- | src/fs.zig | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/fs.zig b/src/fs.zig index fd06006f5..51d3fb4b7 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -255,9 +255,8 @@ pub const FileSystem = struct { } pub fn get(entry: *const DirEntry, _query: string) ?Entry.Lookup { - if (_query.len == 0) return null; - var scratch_lookup_buffer: [256]u8 = undefined; - std.debug.assert(scratch_lookup_buffer.len >= _query.len); + if (_query.len == 0 or _query.len > bun.MAX_PATH_BYTES) return null; + var scratch_lookup_buffer: [bun.MAX_PATH_BYTES]u8 = undefined; const query = strings.copyLowercaseIfNeeded(_query, &scratch_lookup_buffer); const result = entry.data.get(query) orelse return null; |
