pyodbc: write .odbcinst.init file in /tmp/ (#9034)

This is in contrast to writing it in /etc/, which the fuzzer does not
have permission to in the bots.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51308

Signed-off-by: David Korczynski <david@adalogics.com>

Signed-off-by: David Korczynski <david@adalogics.com>
This commit is contained in:
DavidKorczynski 2022-11-22 12:17:05 +00:00 committed by GitHub
parent 322be352aa
commit fa2feb1b5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -48,9 +48,10 @@ def TestOneInput(data):
def main(): def main():
# Write the odbcinst.ini file # Write the odbcinst.ini file
dir_path = os.path.dirname(os.path.realpath(__file__)) dir_path = os.path.dirname(os.path.realpath(__file__))
with open("/etc/odbcinst.ini", "w") as f: with open("/tmp/odbcinst.ini", "w") as f:
f.write("[FUZZ]\n") f.write("[FUZZ]\n")
f.write("Driver=%s/fuzzodbc.so\n"%(dir_path)) f.write("Driver=%s/fuzzodbc.so\n"%(dir_path))
os.environ['ODBCSYSINI'] = '/tmp/'
atheris.instrument_all() atheris.instrument_all()
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)