linux.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:manticore 作者: trailofbits 项目源码 文件源码
def sys_read(self, fd, buf, count):
        data = ''
        if count != 0:
            # TODO check count bytes from buf
            if not buf in self.current.memory: # or not  self.current.memory.isValid(buf+count):
                logger.info("READ: buf points to invalid address. Returning EFAULT")
                return -errno.EFAULT

            try:
                # Read the data and put in tin memory
                data = self._get_fd(fd).read(count)
            except BadFd:
                logger.info(("READ: Not valid file descriptor on read."
                             " Returning EBADF"))
                return -errno.EBADF
            self.syscall_trace.append(("_read", fd, data))
            self.current.write_bytes(buf, data)

        return len(data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号