Skip to content

Commit

Permalink
Adjust comments and add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ekilmer committed Aug 27, 2020
1 parent bcec64f commit c48b91e
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions manticore/platforms/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -2571,11 +2571,35 @@ def sys_recvfrom(

return len(data)

def sys_send(self, sockfd, buf, count, flags, trace_str="_send") -> int:
def sys_send(
self, sockfd: int, buf: int, count: int, flags: int, trace_str: str = "_send"
) -> int:
"""
send(2) is currently a nop; we don't communicate yet: The data is read
from memory, but not actually sent anywhere - we just return count to
pretend that it was.
"""
# Act like sys_sendto with zeroed dest_addr and addrlen
return self.sys_sendto(sockfd, buf, count, flags, 0, 0, trace_str=trace_str)

def sys_sendto(self, sockfd, buf, count, flags, dest_addr, addrlen, trace_str="_sendto"):
def sys_sendto(
self,
sockfd: int,
buf: int,
count: int,
flags: int,
dest_addr: int,
addrlen: int,
trace_str: str = "_sendto",
):
"""
sendto(2) is currently a nop; we don't communicate yet: The data is read
from memory, but not actually sent anywhere - we just return count to
pretend that it was.
Additionally, dest_addr and addrlen are dropped, so it behaves exactly
the same as send.
"""
# TODO: Do something with destination address. Could be used to better
# follow where data is being sent
if dest_addr != 0:
Expand All @@ -2598,7 +2622,6 @@ def sys_sendto(self, sockfd, buf, count, flags, dest_addr, addrlen, trace_str="_
logger.info("SEND: buf within invalid memory. Returning EFAULT")
return -errno.EFAULT

# XXX(yan): send(2) is currently a nop; we don't communicate yet
self.syscall_trace.append((trace_str, sockfd, data))

return count
Expand Down

0 comments on commit c48b91e

Please sign in to comment.