Author: Armin Rigo <[email protected]>
Branch:
Changeset: r92271:2032a21a8320
Date: 2017-08-27 22:35 +0200
http://bitbucket.org/pypy/pypy/changeset/2032a21a8320/
Log: "Fix" the most glaring issue about sandboxing
diff --git a/rpython/translator/sandbox/rsandbox.py
b/rpython/translator/sandbox/rsandbox.py
--- a/rpython/translator/sandbox/rsandbox.py
+++ b/rpython/translator/sandbox/rsandbox.py
@@ -27,17 +27,20 @@
ll_read_not_sandboxed = rposix.external('read',
[rffi.INT, rffi.CCHARP, rffi.SIZE_T],
rffi.SIZE_T,
- sandboxsafe=True)
+ sandboxsafe=True,
+ _nowrapper=True)
ll_write_not_sandboxed = rposix.external('write',
[rffi.INT, rffi.CCHARP, rffi.SIZE_T],
rffi.SIZE_T,
- sandboxsafe=True)
+ sandboxsafe=True,
+ _nowrapper=True)
@signature(types.int(), types.ptr(rffi.CCHARP.TO), types.int(),
returns=types.none())
def writeall_not_sandboxed(fd, buf, length):
+ fd = rffi.cast(rffi.INT, fd)
while length > 0:
size = rffi.cast(rffi.SIZE_T, length)
count = rffi.cast(lltype.Signed, ll_write_not_sandboxed(fd, buf, size))
@@ -58,7 +61,8 @@
buflen = self.buflen
with lltype.scoped_alloc(rffi.CCHARP.TO, buflen) as buf:
buflen = rffi.cast(rffi.SIZE_T, buflen)
- count = ll_read_not_sandboxed(self.fd, buf, buflen)
+ fd = rffi.cast(rffi.INT, self.fd)
+ count = ll_read_not_sandboxed(fd, buf, buflen)
count = rffi.cast(lltype.Signed, count)
if count <= 0:
raise IOError
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit