Skip to content

Commit

Permalink
fix: throw error for too long tar entry (#968)
Browse files Browse the repository at this point in the history
* fix: throw error for too long tar entry

* fix: throw error for too long tar entry
  • Loading branch information
Cafe137 authored Oct 24, 2024
1 parent 8d63c6f commit 710f6eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/tar.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export class TarStream {
}

beginFile(path: string, size: number) {
if (path.length > 100) {
throw new Error(`File name too long: ${path}`)
}
const header = createHeader(path, size)
this.pieces.push(header)
this.currentFileSize = 0
Expand Down
3 changes: 3 additions & 0 deletions src/utils/tar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export class TarStream {
currentFileSize = 0

beginFile(path: string, size: number) {
if (path.length > 100) {
throw new Error(`File name too long: ${path}`)
}
const header = createHeader(path, size)
this.output.write(header)
this.currentFileSize = 0
Expand Down

0 comments on commit 710f6eb

Please sign in to comment.