From 6bb84114c9bf2d23980f5ca7f245bc7e1b7d3e93 Mon Sep 17 00:00:00 2001 From: vladko312 <37411315+vladko312@users.noreply.github.com> Date: Fri, 6 May 2022 09:35:08 +0300 Subject: [PATCH] Support more libc filenames Solution from https://github.com/emcconville/wand/issues/409 --- fuzzowski/helpers/helpers.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fuzzowski/helpers/helpers.py b/fuzzowski/helpers/helpers.py index 5571dba..5c48b14 100644 --- a/fuzzowski/helpers/helpers.py +++ b/fuzzowski/helpers/helpers.py @@ -1,6 +1,7 @@ from functools import reduce from itertools import groupby import ctypes +import ctypes.util import errno import os import platform @@ -142,7 +143,16 @@ def get_max_udp_size(): if mac: lib = ctypes.cdll.LoadLibrary('libc.dylib') elif linux: - lib = ctypes.cdll.LoadLibrary('libc.so.6') + libc_paths = ('libc.so.6', 'libc.so', 'libc.a', + ctypes.util.find_library('c')) + for libc_path in libc_paths: + try: + lib = ctypes.cdll.LoadLibrary(libc_path) + break + except (IOError, OSError): + continue + if not lib: + raise Error("Unable to locate libc") sol_socket = ctypes.c_int(socket.SOL_SOCKET) opt = ctypes.c_int(socket.SO_SNDBUF)