Skip to content

Commit

Permalink
Bug 694724: Have filenameforall and getenv honor SAFER
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-liddell committed Mar 29, 2016
1 parent bcdbe51 commit ab109aa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
Binary file modified Resource/Init/gs_init.ps
Binary file not shown.
36 changes: 20 additions & 16 deletions psi/zfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,22 +371,26 @@ file_continue(i_ctx_t *i_ctx_p)

if (len < devlen)
return_error(gs_error_rangecheck); /* not even room for device len */
memcpy((char *)pscratch->value.bytes, iodev->dname, devlen);
code = iodev->procs.enumerate_next(pfen, (char *)pscratch->value.bytes + devlen,
len - devlen);
if (code == ~(uint) 0) { /* all done */
esp -= 5; /* pop proc, pfen, devlen, iodev , mark */
return o_pop_estack;
} else if (code > len) /* overran string */
return_error(gs_error_rangecheck);
else {
push(1);
ref_assign(op, pscratch);
r_set_size(op, code + devlen);
push_op_estack(file_continue); /* come again */
*++esp = pscratch[2]; /* proc */
return o_push_estack;
}

do {
memcpy((char *)pscratch->value.bytes, iodev->dname, devlen);
code = iodev->procs.enumerate_next(pfen, (char *)pscratch->value.bytes + devlen,
len - devlen);
if (code == ~(uint) 0) { /* all done */
esp -= 5; /* pop proc, pfen, devlen, iodev , mark */
return o_pop_estack;
} else if (code > len) /* overran string */
return_error(gs_error_rangecheck);
else if (iodev != iodev_default(imemory)
|| (check_file_permissions_reduced(i_ctx_p, (char *)pscratch->value.bytes, code + devlen, "PermitFileReading")) == 0) {
push(1);
ref_assign(op, pscratch);
r_set_size(op, code + devlen);
push_op_estack(file_continue); /* come again */
*++esp = pscratch[2]; /* proc */
return o_push_estack;
}
} while(1);
}
/* Cleanup procedure for enumerating files */
static int
Expand Down

0 comments on commit ab109aa

Please sign in to comment.