From 67d28aa9d614e282e33c7ae2c898beb42ffa4c63 Mon Sep 17 00:00:00 2001 From: orbisai0security Date: Wed, 13 May 2026 14:07:37 +0000 Subject: [PATCH] fix: V-001 security vulnerability Automated security fix generated by Orbis Security AI --- gtests/net/tcp/common/set_sysctls.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gtests/net/tcp/common/set_sysctls.py b/gtests/net/tcp/common/set_sysctls.py index fb1dc29e..93074827 100755 --- a/gtests/net/tcp/common/set_sysctls.py +++ b/gtests/net/tcp/common/set_sysctls.py @@ -17,7 +17,7 @@ __author__ = ('brakmo@google.com (Lawrence Brakmo)') import os -import subprocess +import stat import sys filename = '/tmp/sysctl_restore_%s.sh' % os.environ['PACKETDRILL_PID'] @@ -31,11 +31,12 @@ # sysctl[0] contains the proc-file name, sysctl[1] the new value # read current value and add restore command to file - cur_val = subprocess.check_output(['cat', sysctl[0]], universal_newlines=True) + with open(sysctl[0], 'r') as f: + cur_val = f.read() print('echo "%s" > %s' % (cur_val.strip(), sysctl[0]), file=restore_file) # set new value - cmd = 'echo "%s" > %s' % (sysctl[1], sysctl[0]) - os.system(cmd) + with open(sysctl[0], 'w') as f: + f.write(sysctl[1] + '\n') -os.system('chmod u+x %s' % filename) +os.chmod(filename, os.stat(filename).st_mode | stat.S_IXUSR)