Skip to content

Commit

Permalink
Fix bug in directory traversal.
Browse files Browse the repository at this point in the history
This off-by-one error resulted in useless reexamination of the
same files by descending twice into each directory.
  • Loading branch information
madler committed Oct 2, 2016
1 parent 1a4c404 commit 06b5347
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pigz.c
Expand Up @@ -3542,7 +3542,7 @@ local void process(char *path)

/* run process() for each entry in the directory */
base = len && g.inf[len - 1] != (unsigned char)'/' ?
vstrcpy(&g.inf, &g.inz, len, "/") : len;
vstrcpy(&g.inf, &g.inz, len, "/") - 1 : len;
for (off = 0; roll[off]; off += strlen(roll + off) + 1) {
vstrcpy(&g.inf, &g.inz, base, roll + off);
process(g.inf);
Expand Down

0 comments on commit 06b5347

Please sign in to comment.