func_name stringlengths 2 53 | func_src_before stringlengths 63 114k | func_src_after stringlengths 86 114k | line_changes dict | char_changes dict | commit_link stringlengths 66 117 | file_name stringlengths 5 72 | vul_type stringclasses 9
values |
|---|---|---|---|---|---|---|---|
dd_get_item_size | long dd_get_item_size(struct dump_dir *dd, const char *name)
{
long size = -1;
char *iname = concat_path_file(dd->dd_dirname, name);
struct stat statbuf;
if (lstat(iname, &statbuf) == 0 && S_ISREG(statbuf.st_mode))
size = statbuf.st_size;
else
{
if (errno == ENOENT)
... | long dd_get_item_size(struct dump_dir *dd, const char *name)
{
if (!str_is_correct_filename(name))
error_msg_and_die("Cannot get item size. '%s' is not a valid file name", name);
long size = -1;
char *iname = concat_path_file(dd->dd_dirname, name);
struct stat statbuf;
if (lstat(iname, &st... | {
"deleted": [],
"added": [
{
"line_no": 3,
"char_start": 63,
"char_end": 103,
"line": " if (!str_is_correct_filename(name))\n"
},
{
"line_no": 4,
"char_start": 103,
"char_end": 191,
"line": " error_msg_and_die(\"Cannot get item size. '%s' is not... | {
"deleted": [],
"added": [
{
"char_start": 67,
"char_end": 196,
"chars": "if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot get item size. '%s' is not a valid file name\", name);\n\n "
}
]
} | github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277 | src/lib/dump_dir.c | cwe-022 |
zmi_page_request | def zmi_page_request(self, *args, **kwargs):
request = self.REQUEST
RESPONSE = request.RESPONSE
SESSION = request.SESSION
self._zmi_page_request()
RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822())
RESPONSE.setHeader('Cache-Control', ... | def zmi_page_request(self, *args, **kwargs):
request = self.REQUEST
RESPONSE = request.RESPONSE
SESSION = request.SESSION
self._zmi_page_request()
RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822())
RESPONSE.setHeader('Cache-Control', ... | {
"deleted": [
{
"line_no": 26,
"char_start": 1313,
"char_end": 1395,
"line": " if len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n"
}
],
"added": [
{
"line_no": 26,
"char_start": 1313,
"char_end": 1436,
"line": " if ... | {
"deleted": [],
"added": [
{
"char_start": 1322,
"char_end": 1363,
"chars": "self.getDocumentElement().id in path and "
}
]
} | github.com/zms-publishing/zms4/commit/3f28620d475220dfdb06f79787158ac50727c61a | ZMSItem.py | cwe-022 |
nntp_hcache_namer | static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)
{
return snprintf(dest, destlen, "%s.hcache", path);
} | static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)
{
int count = snprintf(dest, destlen, "%s.hcache", path);
/* Strip out any directories in the path */
char *first = strchr(dest, '/');
char *last = strrchr(dest, '/');
if (first && last && (last > first))
{
memmove(first, last, ... | {
"deleted": [
{
"line_no": 3,
"char_start": 77,
"char_end": 130,
"line": " return snprintf(dest, destlen, \"%s.hcache\", path);\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 77,
"char_end": 135,
"line": " int count = snprintf(dest, destlen, \"%s.hc... | {
"deleted": [
{
"char_start": 79,
"char_end": 81,
"chars": "re"
},
{
"char_start": 83,
"char_end": 84,
"chars": "r"
}
],
"added": [
{
"char_start": 79,
"char_end": 81,
"chars": "in"
},
{
"char_start": 82,
"char_end": 85... | github.com/neomutt/neomutt/commit/9bfab35522301794483f8f9ed60820bdec9be59e | newsrc.c | cwe-022 |
TarFileReader::extract | std::string TarFileReader::extract(const string &_path) {
if (_path.empty()) THROW("path cannot be empty");
if (!hasMore()) THROW("No more tar files");
string path = _path;
if (SystemUtilities::isDirectory(path)) path += "/" + getFilename();
LOG_DEBUG(5, "Extracting: " << path);
return extract(*SystemUti... | std::string TarFileReader::extract(const string &_path) {
if (_path.empty()) THROW("path cannot be empty");
if (!hasMore()) THROW("No more tar files");
string path = _path;
if (SystemUtilities::isDirectory(path)) {
path += "/" + getFilename();
// Check that path is under the target directory
strin... | {
"deleted": [
{
"line_no": 6,
"char_start": 180,
"char_end": 251,
"line": " if (SystemUtilities::isDirectory(path)) path += \"/\" + getFilename();\n"
},
{
"line_no": 10,
"char_start": 293,
"char_end": 342,
"line": " return extract(*SystemUtilities::oopen(... | {
"deleted": [],
"added": [
{
"char_start": 222,
"char_end": 228,
"chars": "{\n "
},
{
"char_start": 260,
"char_end": 544,
"chars": " // Check that path is under the target directory\n string a = SystemUtilities::getCanonicalPath(_path);\n string b = SystemU... | github.com/CauldronDevelopmentLLC/cbang/commit/1c1dba62bd3e6fa9d0d0c0aa21926043b75382c7 | src/cbang/tar/TarFileReader.cpp | cwe-022 |
handle_method_call | static void handle_method_call(GDBusConnection *connection,
const gchar *caller,
const gchar *object_path,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
... | static void handle_method_call(GDBusConnection *connection,
const gchar *caller,
const gchar *object_path,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
... | {
"deleted": [],
"added": [
{
"line_no": 259,
"char_start": 9073,
"char_end": 9119,
"line": " if (!allowed_problem_dir(problem_id))\n"
},
{
"line_no": 260,
"char_start": 9119,
"char_end": 9129,
"line": " {\n"
},
{
"line_no": 261... | {
"deleted": [],
"added": [
{
"char_start": 9086,
"char_end": 9241,
"chars": "allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }\n\n if (!"
},
{
"char_start": 11712,
"char_e... | github.com/abrt/abrt/commit/7a47f57975be0d285a2f20758e4572dca6d9cdd3 | src/dbus/abrt-dbus.c | cwe-022 |
_inject_file_into_fs | def _inject_file_into_fs(fs, path, contents):
absolute_path = os.path.join(fs, path.lstrip('/'))
parent_dir = os.path.dirname(absolute_path)
utils.execute('mkdir', '-p', parent_dir, run_as_root=True)
utils.execute('tee', absolute_path, process_input=contents,
run_as_root=True) | def _inject_file_into_fs(fs, path, contents, append=False):
absolute_path = _join_and_check_path_within_fs(fs, path.lstrip('/'))
parent_dir = os.path.dirname(absolute_path)
utils.execute('mkdir', '-p', parent_dir, run_as_root=True)
args = []
if append:
args.append('-a')
args.append(abs... | {
"deleted": [
{
"line_no": 5,
"char_start": 212,
"char_end": 276,
"line": " utils.execute('tee', absolute_path, process_input=contents,\n"
},
{
"line_no": 6,
"char_start": 276,
"char_end": 303,
"line": " run_as_root=True)\n"
}
],
"added"... | {
"deleted": [
{
"char_start": 67,
"char_end": 69,
"chars": "s."
},
{
"char_start": 73,
"char_end": 76,
"chars": ".jo"
},
{
"char_start": 216,
"char_end": 218,
"chars": "ut"
},
{
"char_start": 219,
"char_end": 220,
"ch... | github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7 | nova/virt/disk/api.py | cwe-022 |
set_interface_var | set_interface_var(const char *iface,
const char *var, const char *name,
uint32_t val)
{
FILE *fp;
char spath[64+IFNAMSIZ]; /* XXX: magic constant */
if (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))
return -1;
if (access(spath, F_OK) != 0)
return -1;
fp = fopen(spath, "w");
if (!fp) {... | set_interface_var(const char *iface,
const char *var, const char *name,
uint32_t val)
{
FILE *fp;
char spath[64+IFNAMSIZ]; /* XXX: magic constant */
if (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))
return -1;
/* No path traversal */
if (strstr(name, "..") || strchr(name, '/'))
return -... | {
"deleted": [],
"added": [
{
"line_no": 10,
"char_start": 239,
"char_end": 264,
"line": "\t/* No path traversal */\n"
},
{
"line_no": 11,
"char_start": 264,
"char_end": 310,
"line": "\tif (strstr(name, \"..\") || strchr(name, '/'))\n"
},
{
"... | {
"deleted": [],
"added": [
{
"char_start": 240,
"char_end": 325,
"chars": "/* No path traversal */\n\tif (strstr(name, \"..\") || strchr(name, '/'))\n\t\treturn -1;\n\n\t"
}
]
} | github.com/reubenhwk/radvd/commit/92e22ca23e52066da2258df8c76a2dca8a428bcc | device-linux.c | cwe-022 |
cut | def cut(self, key):
try:
self.etcd.delete(os.path.join(self.namespace, key))
except etcd.EtcdKeyNotFound:
return False
except etcd.EtcdException as err:
log_error("Error removing key %s: [%r]" % (key, repr(err)))
raise CSStoreError('Error occur... | def cut(self, key):
try:
self.etcd.delete(self._absolute_key(key))
except etcd.EtcdKeyNotFound:
return False
except etcd.EtcdException as err:
log_error("Error removing key %s: [%r]" % (key, repr(err)))
raise CSStoreError('Error occurred while ... | {
"deleted": [
{
"line_no": 3,
"char_start": 37,
"char_end": 101,
"line": " self.etcd.delete(os.path.join(self.namespace, key))\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 37,
"char_end": 91,
"line": " self.etcd.delete(self._ab... | {
"deleted": [
{
"char_start": 66,
"char_end": 79,
"chars": "os.path.join("
},
{
"char_start": 84,
"char_end": 85,
"chars": "n"
},
{
"char_start": 86,
"char_end": 88,
"chars": "me"
},
{
"char_start": 89,
"char_end": 92,
... | github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4 | custodia/store/etcdstore.py | cwe-022 |
wiki_handle_http_request | wiki_handle_http_request(HttpRequest *req)
{
HttpResponse *res = http_response_new(req);
char *page = http_request_get_path_info(req);
char *command = http_request_get_query_string(req);
char *wikitext = "";
util_dehttpize(page); /* remove any encoding on the requested
... | wiki_handle_http_request(HttpRequest *req)
{
HttpResponse *res = http_response_new(req);
char *page = http_request_get_path_info(req);
char *command = http_request_get_query_string(req);
char *wikitext = "";
util_dehttpize(page); /* remove any encoding on the requested
... | {
"deleted": [
{
"line_no": 54,
"char_start": 1350,
"char_end": 1375,
"line": " if (strchr(page, '/'))\n"
}
],
"added": [
{
"line_no": 54,
"char_start": 1350,
"char_end": 1382,
"line": " if (!page_name_is_good(page))\n"
}
]
} | {
"deleted": [
{
"char_start": 1357,
"char_end": 1362,
"chars": "trchr"
},
{
"char_start": 1367,
"char_end": 1372,
"chars": ", '/'"
}
],
"added": [
{
"char_start": 1356,
"char_end": 1368,
"chars": "!page_name_i"
},
{
"char_sta... | github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea | src/wiki.c | cwe-022 |
candidate_paths_for_url | def candidate_paths_for_url(self, url):
for root, prefix in self.directories:
if url.startswith(prefix):
yield os.path.join(root, url[len(prefix):]) | def candidate_paths_for_url(self, url):
for root, prefix in self.directories:
if url.startswith(prefix):
path = os.path.join(root, url[len(prefix):])
if os.path.commonprefix((root, path)) == root:
yield path | {
"deleted": [
{
"line_no": 4,
"char_start": 129,
"char_end": 188,
"line": " yield os.path.join(root, url[len(prefix):])\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 129,
"char_end": 190,
"line": " path = os.path.join(ro... | {
"deleted": [
{
"char_start": 145,
"char_end": 150,
"chars": "yield"
}
],
"added": [
{
"char_start": 145,
"char_end": 151,
"chars": "path ="
},
{
"char_start": 189,
"char_end": 283,
"chars": "\n if os.path.commonprefix((root... | github.com/evansd/whitenoise/commit/4d8a3ab1e97d7ddb18b3fa8b4909c92bad5529c6 | whitenoise/base.py | cwe-022 |
updateKey | def updateKey(client):
"""Updates the contents of a key that already exists in our system.
Returns an error if the specified key doesn't exist for the specified user.
"""
global NOT_FOUND
global CREATED
validateClient(client)
client_pub_key = loadClientRSAKey(client)
token_data = decodeRequestToken(request.da... | def updateKey(client):
"""Updates the contents of a key that already exists in our system.
Returns an error if the specified key doesn't exist for the specified user.
"""
global NOT_FOUND
global CREATED
validateClient(client)
client_pub_key = loadClientRSAKey(client)
token_data = decodeRequestToken(request.dat... | {
"deleted": [
{
"line_no": 9,
"char_start": 233,
"char_end": 234,
"line": "\n"
}
],
"added": [
{
"line_no": 12,
"char_start": 371,
"char_end": 408,
"line": "\tvalidateKeyName(token_data['name'])\n"
}
]
} | {
"deleted": [
{
"char_start": 233,
"char_end": 234,
"chars": "\n"
}
],
"added": [
{
"char_start": 369,
"char_end": 406,
"chars": ")\n\tvalidateKeyName(token_data['name']"
}
]
} | github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833 | impl.py | cwe-022 |
create_basename_core | def create_basename_core(basename):
try:
basename = basename.casefold()
except Exception:
basename = basename.lower()
basename = basename.replace(' ', '-')
basename = re.sub(r'<[^>]*>', r'', basename)
basename = re.sub(r'[^a-z0-9\-]', r'', basename)
basename = re.sub(r'\-\-', r'... | def create_basename_core(basename):
try:
basename = basename.casefold()
except Exception:
basename = basename.lower()
basename = re.sub(r'[ \./]', r'-', basename)
basename = re.sub(r'<[^>]*>', r'', basename)
basename = re.sub(r'[^a-z0-9\-]', r'', basename)
basename = re.sub(r'\-... | {
"deleted": [
{
"line_no": 7,
"char_start": 143,
"char_end": 185,
"line": " basename = basename.replace(' ', '-')\n"
}
],
"added": [
{
"line_no": 7,
"char_start": 143,
"char_end": 192,
"line": " basename = re.sub(r'[ \\./]', r'-', basename)\n"
... | {
"deleted": [
{
"char_start": 158,
"char_end": 165,
"chars": "basenam"
},
{
"char_start": 168,
"char_end": 175,
"chars": "eplace("
}
],
"added": [
{
"char_start": 158,
"char_end": 159,
"chars": "r"
},
{
"char_start": 161,
... | github.com/syegulalp/mercury/commit/3f7c7442fa49aec37577dbdb47ce11a848e7bd03 | MeTal/core/utils.py | cwe-022 |
get | def get(self, key):
try:
result = self.etcd.get(os.path.join(self.namespace, key))
except etcd.EtcdException as err:
log_error("Error fetching key %s: [%r]" % (key, repr(err)))
raise CSStoreError('Error occurred while trying to get key')
return result.valu... | def get(self, key):
try:
result = self.etcd.get(self._absolute_key(key))
except etcd.EtcdException as err:
log_error("Error fetching key %s: [%r]" % (key, repr(err)))
raise CSStoreError('Error occurred while trying to get key')
return result.value | {
"deleted": [
{
"line_no": 3,
"char_start": 37,
"char_end": 107,
"line": " result = self.etcd.get(os.path.join(self.namespace, key))\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 37,
"char_end": 97,
"line": " result = self.etcd.... | {
"deleted": [
{
"char_start": 72,
"char_end": 85,
"chars": "os.path.join("
},
{
"char_start": 90,
"char_end": 91,
"chars": "n"
},
{
"char_start": 92,
"char_end": 94,
"chars": "me"
},
{
"char_start": 95,
"char_end": 98,
... | github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4 | custodia/store/etcdstore.py | cwe-022 |
PHYSICALPATH_FUNC | PHYSICALPATH_FUNC(mod_alias_physical_handler) {
plugin_data *p = p_d;
int uri_len, basedir_len;
char *uri_ptr;
size_t k;
if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON;
mod_alias_patch_connection(srv, con, p);
/* not to include the tailing slash */
basedir_len = buffer_string_length(con->physi... | PHYSICALPATH_FUNC(mod_alias_physical_handler) {
plugin_data *p = p_d;
int uri_len, basedir_len;
char *uri_ptr;
size_t k;
if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON;
mod_alias_patch_connection(srv, con, p);
/* not to include the tailing slash */
basedir_len = buffer_string_length(con->physi... | {
"deleted": [],
"added": [
{
"line_no": 29,
"char_start": 928,
"char_end": 994,
"line": "\t\t\t/* check for path traversal in url-path following alias if key\n"
},
{
"line_no": 30,
"char_start": 994,
"char_end": 1062,
"line": "\t\t\t * does not end in sla... | {
"deleted": [],
"added": [
{
"char_start": 931,
"char_end": 1449,
"chars": "/* check for path traversal in url-path following alias if key\n\t\t\t * does not end in slash, but replacement value ends in slash */\n\t\t\tif (uri_ptr[alias_len] == '.') {\n\t\t\t\tchar *s = uri_ptr + alias_len + 1... | github.com/lighttpd/lighttpd1.4/commit/2105dae0f9d7a964375ce681e53cb165375f84c1 | src/mod_alias.c | cwe-022 |
download_check_files | def download_check_files(self, filelist):
# only admins and allowed users may download
if not cherrypy.session['admin']:
uo = self.useroptions.forUser(self.getUserId())
if not uo.getOptionValue('media.may_download'):
return 'not_permitted'
# make sure ... | def download_check_files(self, filelist):
# only admins and allowed users may download
if not cherrypy.session['admin']:
uo = self.useroptions.forUser(self.getUserId())
if not uo.getOptionValue('media.may_download'):
return 'not_permitted'
# make sure ... | {
"deleted": [
{
"line_no": 9,
"char_start": 383,
"char_end": 411,
"line": " if '/../' in f:\n"
}
],
"added": [
{
"line_no": 10,
"char_start": 443,
"char_end": 494,
"line": " if '/../' in f or f.startswith('../'):\n"
},
{
... | {
"deleted": [],
"added": [
{
"char_start": 395,
"char_end": 455,
"chars": "# don't allow to traverse up in the file system\n "
},
{
"char_start": 469,
"char_end": 625,
"chars": " or f.startswith('../'):\n return 'invalid_file'\n #... | github.com/devsnd/cherrymusic/commit/62dec34a1ea0741400dd6b6c660d303dcd651e86 | cherrymusicserver/httphandler.py | cwe-022 |
get_files | def get_files(self, submit_id, password=None, astree=False):
"""
Returns files from a submitted analysis.
@param password: The password to unlock container archives with
@param astree: sflock option; determines the format in which the files are returned
@return: A tree of fil... | def get_files(self, submit_id, password=None, astree=False):
"""
Returns files from a submitted analysis.
@param password: The password to unlock container archives with
@param astree: sflock option; determines the format in which the files are returned
@return: A tree of fil... | {
"deleted": [
{
"line_no": 14,
"char_start": 574,
"char_end": 645,
"line": " filepath = os.path.join(submit.tmp_path, data[\"data\"])\n"
},
{
"line_no": 15,
"char_start": 645,
"char_end": 700,
"line": " filedata = open(filepath... | {
"deleted": [
{
"char_start": 631,
"char_end": 661,
"chars": "data[\"data\"])\n "
},
{
"char_start": 665,
"char_end": 675,
"chars": "data = ope"
},
{
"char_start": 676,
"char_end": 682,
"chars": "(filep"
},
{
"char... | github.com/cuckoosandbox/cuckoo/commit/168cabf86730d56b7fa319278bf0f0034052666a | cuckoo/core/submit.py | cwe-022 |
handle | def handle(self, keepalive=True, initial_timeout=None):
# we are requested to skip processing and keep the previous values
if self.skip:
return self.response.handle()
# default to no keepalive in case something happens while even trying ensure we have a request
self.keep... | def handle(self, keepalive=True, initial_timeout=None):
# we are requested to skip processing and keep the previous values
if self.skip:
return self.response.handle()
# default to no keepalive in case something happens while even trying ensure we have a request
self.keep... | {
"deleted": [
{
"line_no": 53,
"char_start": 1744,
"char_end": 1834,
"line": " self.method, self.resource, self.request_http = self.request_line.split()\n"
}
],
"added": [
{
"line_no": 53,
"char_start": 1744,
"char_end": 1829,
"line": " ... | {
"deleted": [
{
"char_start": 1773,
"char_end": 1778,
"chars": "self."
}
],
"added": [
{
"char_start": 1827,
"char_end": 1890,
"chars": ")\n self.resource = urllib.parse.unquote(resource"
}
]
} | github.com/fkmclane/python-fooster-web/commit/80202a6d3788ad1212a162d19785c600025e6aa4 | fooster/web/web.py | cwe-022 |
dd_delete_item | int dd_delete_item(struct dump_dir *dd, const char *name)
{
if (!dd->locked)
error_msg_and_die("dump_dir is not opened"); /* bug */
char *path = concat_path_file(dd->dd_dirname, name);
int res = unlink(path);
if (res < 0)
{
if (errno == ENOENT)
errno = res = 0;
... | int dd_delete_item(struct dump_dir *dd, const char *name)
{
if (!dd->locked)
error_msg_and_die("dump_dir is not opened"); /* bug */
if (!str_is_correct_filename(name))
error_msg_and_die("Cannot delete item. '%s' is not a valid file name", name);
char *path = concat_path_file(dd->dd_dirname... | {
"deleted": [],
"added": [
{
"line_no": 6,
"char_start": 145,
"char_end": 185,
"line": " if (!str_is_correct_filename(name))\n"
},
{
"line_no": 7,
"char_start": 185,
"char_end": 271,
"line": " error_msg_and_die(\"Cannot delete item. '%s' is not ... | {
"deleted": [],
"added": [
{
"char_start": 149,
"char_end": 276,
"chars": "if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot delete item. '%s' is not a valid file name\", name);\n\n "
}
]
} | github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277 | src/lib/dump_dir.c | cwe-022 |
render | def render(self, request):
action = "download"
if "action" in request.args:
action = request.args["action"][0]
if "file" in request.args:
filename = request.args["file"][0].decode('utf-8', 'ignore').encode('utf-8')
filename = re.sub("^/+", "/", os.path.realpath(filename))
if not os.path.exists(file... | def render(self, request):
action = "download"
if "action" in request.args:
action = request.args["action"][0]
if "file" in request.args:
filename = lenient_force_utf_8(request.args["file"][0])
filename = sanitise_filename_slashes(os.path.realpath(filename))
if not os.path.exists(filename):
ret... | {
"deleted": [
{
"line_no": 7,
"char_start": 149,
"char_end": 229,
"line": "\t\t\tfilename = request.args[\"file\"][0].decode('utf-8', 'ignore').encode('utf-8')\n"
},
{
"line_no": 8,
"char_start": 229,
"char_end": 290,
"line": "\t\t\tfilename = re.sub(\"^/+\... | {
"deleted": [
{
"char_start": 186,
"char_end": 227,
"chars": ".decode('utf-8', 'ignore').encode('utf-8'"
},
{
"char_start": 243,
"char_end": 244,
"chars": "r"
},
{
"char_start": 245,
"char_end": 246,
"chars": "."
},
{
"char_start... | github.com/E2OpenPlugins/e2openplugin-OpenWebif/commit/a846b7664eda3a4c51a452e00638cf7337dc2013 | plugin/controllers/file.py | cwe-022 |
_inject_net_into_fs | def _inject_net_into_fs(net, fs, execute=None):
"""Inject /etc/network/interfaces into the filesystem rooted at fs.
net is the contents of /etc/network/interfaces.
"""
netdir = os.path.join(os.path.join(fs, 'etc'), 'network')
utils.execute('mkdir', '-p', netdir, run_as_root=True)
utils.execute(... | def _inject_net_into_fs(net, fs, execute=None):
"""Inject /etc/network/interfaces into the filesystem rooted at fs.
net is the contents of /etc/network/interfaces.
"""
netdir = _join_and_check_path_within_fs(fs, 'etc', 'network')
utils.execute('mkdir', '-p', netdir, run_as_root=True)
utils.exec... | {
"deleted": [
{
"line_no": 6,
"char_start": 181,
"char_end": 243,
"line": " netdir = os.path.join(os.path.join(fs, 'etc'), 'network')\n"
},
{
"line_no": 10,
"char_start": 426,
"char_end": 475,
"line": " netfile = os.path.join(netdir, 'interfaces')\n"
... | {
"deleted": [
{
"char_start": 194,
"char_end": 202,
"chars": "os.path."
},
{
"char_start": 206,
"char_end": 210,
"chars": "(os."
},
{
"char_start": 214,
"char_end": 217,
"chars": ".jo"
},
{
"char_start": 229,
"char_end": 23... | github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7 | nova/virt/disk/api.py | cwe-022 |
canonicalize | def canonicalize(self):
"""::
path = path.canonicalize()
Canonicalize path. ::
# "/foo/baz"
Pyjo.Path.new('/foo/./bar/../baz').canonicalize()
# "/../baz"
Pyjo.Path.new('/foo/../bar/../../baz').canonicalize()
"""
parts = ... | def canonicalize(self):
"""::
path = path.canonicalize()
Canonicalize path by resolving ``.`` and ``..``, in addition ``...`` will be
treated as ``.`` to protect from path traversal attacks.
# "/foo/baz"
Pyjo.Path.new('/foo/./bar/../baz').canonicalize()... | {
"deleted": [
{
"line_no": 6,
"char_start": 83,
"char_end": 113,
"line": " Canonicalize path. ::\n"
},
{
"line_no": 17,
"char_start": 375,
"char_end": 425,
"line": " if parts[i] == '.' or parts[i] == '':\n"
}
],
"added": [
{
... | {
"deleted": [
{
"char_start": 110,
"char_end": 112,
"chars": "::"
}
],
"added": [
{
"char_start": 108,
"char_end": 124,
"chars": " by resolving ``"
},
{
"char_start": 125,
"char_end": 171,
"chars": "`` and ``..``, in addition ``...`` will ... | github.com/dex4er/Pyjoyment/commit/e4b115bc80c41615b2133091af3a74ee5d995c2e | Pyjo/Path.py | cwe-022 |
CWebSock::GetSkinPath | CString CWebSock::GetSkinPath(const CString& sSkinName) {
CString sRet = CZNC::Get().GetZNCPath() + "/webskins/" + sSkinName;
if (!CFile::IsDir(sRet)) {
sRet = CZNC::Get().GetCurPath() + "/webskins/" + sSkinName;
if (!CFile::IsDir(sRet)) {
sRet = CString(_SKINDIR_) + "/" + sSkinNam... | CString CWebSock::GetSkinPath(const CString& sSkinName) {
const CString sSkin = sSkinName.Replace_n("/", "_").Replace_n(".", "_");
CString sRet = CZNC::Get().GetZNCPath() + "/webskins/" + sSkin;
if (!CFile::IsDir(sRet)) {
sRet = CZNC::Get().GetCurPath() + "/webskins/" + sSkin;
if (!CFile:... | {
"deleted": [
{
"line_no": 2,
"char_start": 58,
"char_end": 130,
"line": " CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkinName;\n"
},
{
"line_no": 5,
"char_start": 162,
"char_end": 230,
"line": " sRet = CZNC::Get().GetCurPath() + ... | {
"deleted": [
{
"char_start": 124,
"char_end": 128,
"chars": "Name"
},
{
"char_start": 224,
"char_end": 228,
"chars": "Name"
},
{
"char_start": 317,
"char_end": 321,
"chars": "Name"
}
],
"added": [
{
"char_start": 62,
"... | github.com/znc/znc/commit/a4a5aeeb17d32937d8c7d743dae9a4cc755ce773 | src/WebModules.cpp | cwe-022 |
addKey | def addKey(client):
"""Adds a new key with the specified name and contents.
Returns an error if a key with the specified name already exists.
"""
global BAD_REQUEST
global CREATED
validateClient(client)
client_pub_key = loadClientRSAKey(client)
token_data = decodeRequestToken(request.data, client_pub_key)
va... | def addKey(client):
"""Adds a new key with the specified name and contents.
Returns an error if a key with the specified name already exists.
"""
global BAD_REQUEST
global CREATED
validateClient(client)
client_pub_key = loadClientRSAKey(client)
token_data = decodeRequestToken(request.data, client_pub_key)
val... | {
"deleted": [
{
"line_no": 9,
"char_start": 210,
"char_end": 211,
"line": "\n"
}
],
"added": [
{
"line_no": 12,
"char_start": 348,
"char_end": 385,
"line": "\tvalidateKeyName(token_data['name'])\n"
}
]
} | {
"deleted": [
{
"char_start": 210,
"char_end": 211,
"chars": "\n"
}
],
"added": [
{
"char_start": 346,
"char_end": 383,
"chars": ")\n\tvalidateKeyName(token_data['name']"
}
]
} | github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833 | impl.py | cwe-022 |
dd_save_text | void dd_save_text(struct dump_dir *dd, const char *name, const char *data)
{
if (!dd->locked)
error_msg_and_die("dump_dir is not opened"); /* bug */
char *full_path = concat_path_file(dd->dd_dirname, name);
save_binary_file(full_path, data, strlen(data), dd->dd_uid, dd->dd_gid, dd->mode);
free(... | void dd_save_text(struct dump_dir *dd, const char *name, const char *data)
{
if (!dd->locked)
error_msg_and_die("dump_dir is not opened"); /* bug */
if (!str_is_correct_filename(name))
error_msg_and_die("Cannot save text. '%s' is not a valid file name", name);
char *full_path = concat_path... | {
"deleted": [],
"added": [
{
"line_no": 6,
"char_start": 162,
"char_end": 202,
"line": " if (!str_is_correct_filename(name))\n"
},
{
"line_no": 7,
"char_start": 202,
"char_end": 286,
"line": " error_msg_and_die(\"Cannot save text. '%s' is not a ... | {
"deleted": [],
"added": [
{
"char_start": 166,
"char_end": 291,
"chars": "if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save text. '%s' is not a valid file name\", name);\n\n "
}
]
} | github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277 | src/lib/dump_dir.c | cwe-022 |
misc_file_checks | def misc_file_checks(self):
print_header("MISC FILE CHECKS")
#
# Check for recommended and mandatory files
#
filenames = ("manifest.json", "LICENSE", "README.md",
"scripts/install", "scripts/remove",
"scripts/upgrade",
... | def misc_file_checks(self):
print_header("MISC FILE CHECKS")
#
# Check for recommended and mandatory files
#
filenames = ("manifest.json", "LICENSE", "README.md",
"scripts/install", "scripts/remove",
"scripts/upgrade",
... | {
"deleted": [
{
"line_no": 39,
"char_start": 1268,
"char_end": 1336,
"line": " if not os.path.isfile(self.path + \"/conf/\" + filename):\n"
}
],
"added": [
{
"line_no": 42,
"char_start": 1425,
"char_end": 1520,
"line": " if not os.... | {
"deleted": [],
"added": [
{
"char_start": 1153,
"char_end": 1184,
"chars": "Analyze nginx conf\n # - "
},
{
"char_start": 1240,
"char_end": 1292,
"chars": " - Spot path traversal issue vulnerability\n #"
},
{
"char_start": 1363,
"ch... | github.com/YunoHost/package_linter/commit/f6e98894cfe841aedaa7efd590937f0255193913 | package_linter.py | cwe-022 |
dd_save_binary | void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size)
{
if (!dd->locked)
error_msg_and_die("dump_dir is not opened"); /* bug */
char *full_path = concat_path_file(dd->dd_dirname, name);
save_binary_file(full_path, data, size, dd->dd_uid, dd->dd_gid, dd->mode);
... | void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size)
{
if (!dd->locked)
error_msg_and_die("dump_dir is not opened"); /* bug */
if (!str_is_correct_filename(name))
error_msg_and_die("Cannot save binary. '%s' is not a valid file name", name);
char *full... | {
"deleted": [],
"added": [
{
"line_no": 6,
"char_start": 179,
"char_end": 219,
"line": " if (!str_is_correct_filename(name))\n"
},
{
"line_no": 7,
"char_start": 219,
"char_end": 305,
"line": " error_msg_and_die(\"Cannot save binary. '%s' is not ... | {
"deleted": [],
"added": [
{
"char_start": 183,
"char_end": 310,
"chars": "if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save binary. '%s' is not a valid file name\", name);\n\n "
}
]
} | github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277 | src/lib/dump_dir.c | cwe-022 |
pascal_case | def pascal_case(value: str) -> str:
return stringcase.pascalcase(value) | def pascal_case(value: str) -> str:
return stringcase.pascalcase(_sanitize(value)) | {
"deleted": [
{
"line_no": 2,
"char_start": 36,
"char_end": 75,
"line": " return stringcase.pascalcase(value)\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 36,
"char_end": 86,
"line": " return stringcase.pascalcase(_sanitize(value))\n"
}
... | {
"deleted": [],
"added": [
{
"char_start": 69,
"char_end": 79,
"chars": "_sanitize("
},
{
"char_start": 85,
"char_end": 86,
"chars": ")"
}
]
} | github.com/openapi-generators/openapi-python-client/commit/3e7dfae5d0b3685abf1ede1bc6c086a116ac4746 | openapi_python_client/utils.py | cwe-022 |
cleanup_pathname | cleanup_pathname(struct archive_write_disk *a)
{
char *dest, *src;
char separator = '\0';
dest = src = a->name;
if (*src == '\0') {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid empty pathname");
return (ARCHIVE_FAILED);
}
#if defined(__CYGWIN__)
cleanup_pathname_win(a);
#endif
/* Skip ... | cleanup_pathname(struct archive_write_disk *a)
{
char *dest, *src;
char separator = '\0';
dest = src = a->name;
if (*src == '\0') {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid empty pathname");
return (ARCHIVE_FAILED);
}
#if defined(__CYGWIN__)
cleanup_pathname_win(a);
#endif
/* Skip ... | {
"deleted": [
{
"line_no": 17,
"char_start": 336,
"char_end": 354,
"line": "\tif (*src == '/')\n"
}
],
"added": [
{
"line_no": 17,
"char_start": 336,
"char_end": 356,
"line": "\tif (*src == '/') {\n"
},
{
"line_no": 18,
"char_start":... | {
"deleted": [],
"added": [
{
"char_start": 353,
"char_end": 543,
"chars": " {\n\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Path is absolute\");\n\t\t\treturn (ARCHIVE_FAILED);\n\t\t}\n"
}... | github.com/libarchive/libarchive/commit/59357157706d47c365b2227739e17daba3607526 | libarchive/archive_write_disk_posix.c | cwe-022 |
create_dump_dir_from_problem_data | struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)
{
INITIALIZE_LIBREPORT();
char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER);
if (!type)
{
error_msg(_("Missing required item: '%s'"), FILENAME_ANALYZER);
... | struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)
{
INITIALIZE_LIBREPORT();
char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER);
if (!type)
{
error_msg(_("Missing required item: '%s'"), FILENAME_ANALYZER);
... | {
"deleted": [
{
"line_no": 90,
"char_start": 2743,
"char_end": 2817,
"line": " /* only files should contain '/' and those are handled earlier */\n"
},
{
"line_no": 91,
"char_start": 2817,
"char_end": 2866,
"line": " if (name[0] == '.' || strch... | {
"deleted": [
{
"char_start": 2709,
"char_end": 2963,
"chars": "\n continue;\n }\n\n /* only files should contain '/' and those are handled earlier */\n if (name[0] == '.' || strchr(name, '/'))\n {\n error_msg(\"Problem data field name contains ... | github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277 | src/lib/create_dump_dir.c | cwe-022 |
list | def list(self, keyfilter='/'):
path = os.path.join(self.namespace, keyfilter)
if path != '/':
path = path.rstrip('/')
try:
result = self.etcd.read(path, recursive=True)
except etcd.EtcdKeyNotFound:
return None
except etcd.EtcdException as e... | def list(self, keyfilter='/'):
path = self._absolute_key(keyfilter)
if path != '/':
path = path.rstrip('/')
try:
result = self.etcd.read(path, recursive=True)
except etcd.EtcdKeyNotFound:
return None
except etcd.EtcdException as err:
... | {
"deleted": [
{
"line_no": 2,
"char_start": 35,
"char_end": 90,
"line": " path = os.path.join(self.namespace, keyfilter)\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 35,
"char_end": 80,
"line": " path = self._absolute_key(keyfilter)\n"... | {
"deleted": [
{
"char_start": 50,
"char_end": 63,
"chars": "os.path.join("
},
{
"char_start": 68,
"char_end": 69,
"chars": "n"
},
{
"char_start": 70,
"char_end": 72,
"chars": "me"
},
{
"char_start": 73,
"char_end": 76,
... | github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4 | custodia/store/etcdstore.py | cwe-022 |
process | local void process(char *path)
{
int method = -1; /* get_header() return value */
size_t len; /* length of base name (minus suffix) */
struct stat st; /* to get file type and mod time */
/* all compressed suffixes for decoding search, in length order */... | local void process(char *path)
{
int method = -1; /* get_header() return value */
size_t len; /* length of base name (minus suffix) */
struct stat st; /* to get file type and mod time */
/* all compressed suffixes for decoding search, in length order */... | {
"deleted": [
{
"line_no": 224,
"char_start": 8033,
"char_end": 8058,
"line": " char *to, *repl;\n"
},
{
"line_no": 225,
"char_start": 8058,
"char_end": 8059,
"line": "\n"
},
{
"line_no": 226,
"char_start": 8059,
"char_end":... | {
"deleted": [
{
"char_start": 8052,
"char_end": 8053,
"chars": "r"
},
{
"char_start": 8055,
"char_end": 8056,
"chars": "l"
},
{
"char_start": 8070,
"char_end": 8071,
"chars": "u"
},
{
"char_start": 8076,
"char_end": 8078,
... | github.com/madler/pigz/commit/fdad1406b3ec809f4954ff7cdf9e99eb18c2458f | pigz.c | cwe-022 |
imap_hcache_open | header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)
{
struct ImapMbox mx;
struct Url url;
char cachepath[PATH_MAX];
char mbox[PATH_MAX];
if (path)
imap_cachepath(idata, path, mbox, sizeof(mbox));
else
{
if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) < 0)
re... | header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)
{
struct ImapMbox mx;
struct Url url;
char cachepath[PATH_MAX];
char mbox[PATH_MAX];
if (path)
imap_cachepath(idata, path, mbox, sizeof(mbox));
else
{
if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) < 0)
re... | {
"deleted": [],
"added": [
{
"line_no": 19,
"char_start": 413,
"char_end": 504,
"line": " if (strstr(mbox, \"/../\") || (strcmp(mbox, \"..\") == 0) || (strncmp(mbox, \"../\", 3) == 0))\n"
},
{
"line_no": 20,
"char_start": 504,
"char_end": 521,
"line": " ... | {
"deleted": [],
"added": [
{
"char_start": 415,
"char_end": 627,
"chars": "if (strstr(mbox, \"/../\") || (strcmp(mbox, \"..\") == 0) || (strncmp(mbox, \"../\", 3) == 0))\n return NULL;\n size_t len = strlen(mbox);\n if ((len > 3) && (strcmp(mbox + len - 3, \"/..\") == 0))\n return NUL... | github.com/neomutt/neomutt/commit/57971dba06346b2d7179294f4528b8d4427a7c5d | imap/util.c | cwe-022 |
_normalize | def _normalize(self, metaerrors):
"""Normalize output format to be usable by Anaconda's linting frontend
"""
errors = []
for error in metaerrors:
if self.filepath not in error.get('path', ''):
continue
error_type = error.get('severity', 'X').... | def _normalize(self, metaerrors):
"""Normalize output format to be usable by Anaconda's linting frontend
"""
errors = []
for error in metaerrors:
last_path = os.path.join(
os.path.basename(os.path.dirname(self.filepath)),
os.path.basename(... | {
"deleted": [
{
"line_no": 7,
"char_start": 183,
"char_end": 242,
"line": " if self.filepath not in error.get('path', ''):\n"
}
],
"added": [
{
"line_no": 7,
"char_start": 183,
"char_end": 221,
"line": " last_path = os.path.join(\n... | {
"deleted": [],
"added": [
{
"char_start": 195,
"char_end": 217,
"chars": "last_path = os.path.jo"
},
{
"char_start": 218,
"char_end": 273,
"chars": "n(\n os.path.basename(os.path.dirname(sel"
},
{
"char_start": 274,
"char_end": 287... | github.com/DamnWidget/anaconda_go/commit/d3db90bb8853d832927818699591b91f56f6413c | plugin/handlers_go/anagonda/context/gometalinter.py | cwe-022 |
dd_load_text_ext | char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags)
{
// if (!dd->locked)
// error_msg_and_die("dump_dir is not opened"); /* bug */
/* Compat with old abrt dumps. Remove in abrt-2.1 */
if (strcmp(name, "release") == 0)
name = FILENAME_OS_RELEASE;
char *ful... | char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags)
{
// if (!dd->locked)
// error_msg_and_die("dump_dir is not opened"); /* bug */
if (!str_is_correct_filename(name))
{
error_msg("Cannot load text. '%s' is not a valid file name", name);
if (!(flags & D... | {
"deleted": [],
"added": [
{
"line_no": 6,
"char_start": 175,
"char_end": 215,
"line": " if (!str_is_correct_filename(name))\n"
},
{
"line_no": 7,
"char_start": 215,
"char_end": 221,
"line": " {\n"
},
{
"line_no": 8,
"char_start"... | {
"deleted": [],
"added": [
{
"char_start": 179,
"char_end": 393,
"chars": "if (!str_is_correct_filename(name))\n {\n error_msg(\"Cannot load text. '%s' is not a valid file name\", name);\n if (!(flags & DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE))\n xfunc_die();\n }\n\... | github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277 | src/lib/dump_dir.c | cwe-022 |
_download_file | @staticmethod
def _download_file(bucket, filename, local_dir):
key = bucket.get_key(filename)
local_filename = os.path.join(local_dir, filename)
key.get_contents_to_filename(local_filename)
return local_filename | @staticmethod
def _download_file(bucket, filename, local_dir):
key = bucket.get_key(filename)
local_filename = os.path.join(local_dir, os.path.basename(filename))
key.get_contents_to_filename(local_filename)
return local_filename | {
"deleted": [
{
"line_no": 4,
"char_start": 110,
"char_end": 169,
"line": " local_filename = os.path.join(local_dir, filename)\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 110,
"char_end": 187,
"line": " local_filename = os.path.join(l... | {
"deleted": [],
"added": [
{
"char_start": 159,
"char_end": 176,
"chars": "os.path.basename("
},
{
"char_start": 184,
"char_end": 185,
"chars": ")"
}
]
} | github.com/openstack/nova/commit/76363226bd8533256f7795bba358d7f4b8a6c9e6 | nova/image/s3.py | cwe-022 |
Utility::UnZip | bool Utility::UnZip(const QString &zippath, const QString &destpath)
{
int res = 0;
QDir dir(destpath);
if (!cp437) {
cp437 = new QCodePage437Codec();
}
#ifdef Q_OS_WIN32
zlib_filefunc64_def ffunc;
fill_win32_filefunc64W(&ffunc);
unzFile zfile = unzOpen2_64(Utility::QStringToStdWStri... | bool Utility::UnZip(const QString &zippath, const QString &destpath)
{
int res = 0;
QDir dir(destpath);
if (!cp437) {
cp437 = new QCodePage437Codec();
}
#ifdef Q_OS_WIN32
zlib_filefunc64_def ffunc;
fill_win32_filefunc64W(&ffunc);
unzFile zfile = unzOpen2_64(Utility::QStringToStdWStri... | {
"deleted": [],
"added": [
{
"line_no": 39,
"char_start": 1400,
"char_end": 1401,
"line": "\n"
},
{
"line_no": 46,
"char_start": 1800,
"char_end": 1801,
"line": "\n"
},
{
"line_no": 47,
"char_start": 1801,
"char_end": 1846,
... | {
"deleted": [],
"added": [
{
"char_start": 1400,
"char_end": 2937,
"chars": "\n\t // for security reasons against maliciously crafted zip archives\n\t // we need the file path to always be inside the target folder \n\t // and not outside, so we will remove all illegal bac... | github.com/Sigil-Ebook/Sigil/commit/0979ba8d10c96ebca330715bfd4494ea0e019a8f | src/Misc/Utility.cpp | cwe-022 |
save | async def save(request):
# TODO csrf
data = await request.post()
item = Item(data['src'])
# Update name
new_src = data.get('new_src')
if new_src and new_src != data['src']:
# don't need to worry about html unquote
shutil.move(item.abspath, settings.STORAGE_DIR + new_src)
... | async def save(request):
# TODO csrf
data = await request.post()
item = Item(data['src'])
# Update name
new_src = data.get('new_src')
if new_src:
new_abspath = os.path.abspath(settings.STORAGE_DIR + new_src)
if not new_abspath.startswith(settings.STORAGE_DIR):
return... | {
"deleted": [
{
"line_no": 8,
"char_start": 155,
"char_end": 198,
"line": " if new_src and new_src != data['src']:\n"
},
{
"line_no": 10,
"char_start": 247,
"char_end": 313,
"line": " shutil.move(item.abspath, settings.STORAGE_DIR + new_src)\n"
... | {
"deleted": [
{
"char_start": 170,
"char_end": 173,
"chars": "and"
},
{
"char_start": 179,
"char_end": 181,
"chars": "rc"
},
{
"char_start": 182,
"char_end": 183,
"chars": "!"
},
{
"char_start": 185,
"char_end": 186,
... | github.com/crccheck/gallery-cms/commit/60dec5c580a779ae27824ed54cb113eca25afdc0 | gallery/gallery.py | cwe-022 |
wiki_handle_rest_call | wiki_handle_rest_call(HttpRequest *req,
HttpResponse *res,
char *func)
{
if (func != NULL && *func != '\0')
{
if (!strcmp(func, "page/get"))
{
char *page = http_request_param_get(req, "page");
if (page == NULL)
page = http_request_get_query_string(req);
if (page &... | wiki_handle_rest_call(HttpRequest *req,
HttpResponse *res,
char *func)
{
if (func != NULL && *func != '\0')
{
if (!strcmp(func, "page/get"))
{
char *page = http_request_param_get(req, "page");
if (page == NULL)
page = http_request_get_query_string(req);
if (page &... | {
"deleted": [
{
"line_no": 15,
"char_start": 307,
"char_end": 350,
"line": "\t if (page && (access(page, R_OK) == 0)) \n"
},
{
"line_no": 28,
"char_start": 699,
"char_end": 741,
"line": "\t file_write(page, wikitext);\t \n"
},
{
"li... | {
"deleted": [
{
"char_start": 348,
"char_end": 349,
"chars": " "
},
{
"char_start": 733,
"char_end": 740,
"chars": "\t "
},
{
"char_start": 1374,
"char_end": 1375,
"chars": " "
}
],
"added": [
{
"char_start": 322,
... | github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea | src/wiki.c | cwe-022 |
handle_method_call | static void handle_method_call(GDBusConnection *connection,
const gchar *caller,
const gchar *object_path,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
... | static void handle_method_call(GDBusConnection *connection,
const gchar *caller,
const gchar *object_path,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
... | {
"deleted": [
{
"line_no": 259,
"char_start": 9073,
"char_end": 9148,
"line": " if (element == NULL || element[0] == '\\0' || strlen(element) > 64)\n"
}
],
"added": [
{
"line_no": 259,
"char_start": 9073,
"char_end": 9120,
"line": " if (!s... | {
"deleted": [
{
"char_start": 9085,
"char_end": 9126,
"chars": "element == NULL || element[0] == '\\0' || "
},
{
"char_start": 9141,
"char_end": 9146,
"chars": " > 64"
}
],
"added": [
{
"char_start": 9085,
"char_end": 9097,
"chars": "!str_... | github.com/abrt/abrt/commit/f3c2a6af3455b2882e28570e8a04f1c2d4500d5b | src/dbus/abrt-dbus.c | cwe-022 |
HPHP::extractFileTo | static bool extractFileTo(zip* zip, const std::string &file, std::string& to,
char* buf, size_t len) {
auto sep = file.rfind('/');
if (sep != std::string::npos) {
auto path = to + file.substr(0, sep);
if (!HHVM_FN(is_dir)(path) && !HHVM_FN(mkdir)(path, 0777, true)) {
return f... | static bool extractFileTo(zip* zip, const std::string &file, std::string& to,
char* buf, size_t len) {
struct zip_stat zipStat;
// Verify the file to be extracted is actually in the zip file
if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {
return false;
}
auto clean_file = ... | {
"deleted": [
{
"line_no": 3,
"char_start": 129,
"char_end": 159,
"line": " auto sep = file.rfind('/');\n"
},
{
"line_no": 5,
"char_start": 193,
"char_end": 235,
"line": " auto path = to + file.substr(0, sep);\n"
},
{
"line_no": 10,
... | {
"deleted": [
{
"char_start": 132,
"char_end": 133,
"chars": "u"
},
{
"char_start": 140,
"char_end": 141,
"chars": "="
},
{
"char_start": 152,
"char_end": 154,
"chars": "('"
},
{
"char_start": 218,
"char_end": 219,
"c... | github.com/facebook/hhvm/commit/65c95a01541dd2fbc9c978ac53bed235b5376686 | hphp/runtime/ext/zip/ext_zip.cpp | cwe-022 |
new_goal | def new_goal():
"""
new goal
"""
goals_dir_check()
click.echo(chalk.blue('Input a single-word name of the goal:'))
goal_name = input().strip()
if goal_name_exists(goal_name):
click.echo(chalk.red(
'A goal with this name already exists. Please type "yoda goals view" to ... | def new_goal():
"""
new goal
"""
goals_dir_check()
goal_name_not_ok = True
click.echo(chalk.blue('Input a single-word name of the goal:'))
while goal_name_not_ok:
goal_name = input().strip()
if goal_name.isalnum():
goal_name_not_ok = False
else:
... | {
"deleted": [
{
"line_no": 9,
"char_start": 137,
"char_end": 169,
"line": " goal_name = input().strip()\n"
},
{
"line_no": 19,
"char_start": 535,
"char_end": 570,
"line": " deadline = input().strip()\n"
}
],
"added": [
{
"line_no... | {
"deleted": [],
"added": [
{
"char_start": 73,
"char_end": 102,
"chars": "goal_name_not_ok = True\n\n "
},
{
"char_start": 170,
"char_end": 202,
"chars": "while goal_name_not_ok:\n "
},
{
"char_start": 230,
"char_end": 420,
"chars"... | github.com/yoda-pa/yoda/commit/263946316041601de75638ee303a892f2652cf40 | modules/goals.py | cwe-022 |
_inject_admin_password_into_fs | def _inject_admin_password_into_fs(admin_passwd, fs, execute=None):
"""Set the root password to admin_passwd
admin_password is a root password
fs is the path to the base of the filesystem into which to inject
the key.
This method modifies the instance filesystem directly,
and does not require ... | def _inject_admin_password_into_fs(admin_passwd, fs, execute=None):
"""Set the root password to admin_passwd
admin_password is a root password
fs is the path to the base of the filesystem into which to inject
the key.
This method modifies the instance filesystem directly,
and does not require ... | {
"deleted": [
{
"line_no": 23,
"char_start": 689,
"char_end": 760,
"line": " utils.execute('cp', os.path.join(fs, 'etc', 'passwd'), tmp_passwd,\n"
},
{
"line_no": 24,
"char_start": 760,
"char_end": 796,
"line": " run_as_root=True)\n"
... | {
"deleted": [
{
"char_start": 693,
"char_end": 694,
"chars": "u"
},
{
"char_start": 696,
"char_end": 701,
"chars": "ls.ex"
},
{
"char_start": 703,
"char_end": 704,
"chars": "u"
},
{
"char_start": 705,
"char_end": 706,
... | github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7 | nova/virt/disk/api.py | cwe-022 |
get_paths | def get_paths(base_path: pathlib.Path):
data_file = pathlib.Path(str(base_path) + ".data")
metadata_file = pathlib.Path(str(base_path) + ".meta")
return data_file, metadata_file | def get_paths(root: str, sub_path: str) \
-> typing.Tuple[pathlib.Path, pathlib.Path]:
base_path = flask.safe_join(root, sub_path)
data_file = pathlib.Path(base_path + ".data")
metadata_file = pathlib.Path(base_path + ".meta")
return data_file, metadata_file | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 40,
"line": "def get_paths(base_path: pathlib.Path):\n"
}
],
"added": [
{
"line_no": 1,
"char_start": 0,
"char_end": 42,
"line": "def get_paths(root: str, sub_path: str) \\\n"
},
{
... | {
"deleted": [
{
"char_start": 18,
"char_end": 19,
"chars": "_"
},
{
"char_start": 23,
"char_end": 24,
"chars": ":"
},
{
"char_start": 38,
"char_end": 39,
"chars": ":"
},
{
"char_start": 69,
"char_end": 73,
"chars": "s... | github.com/horazont/xmpp-http-upload/commit/82056540191e89f0cd697c81f57714c00962ed75 | xhu.py | cwe-022 |
compose_path | char *compose_path(ctrl_t *ctrl, char *path)
{
struct stat st;
static char rpath[PATH_MAX];
char *name, *ptr;
char dir[PATH_MAX] = { 0 };
strlcpy(dir, ctrl->cwd, sizeof(dir));
DBG("Compose path from cwd: %s, arg: %s", ctrl->cwd, path ?: "");
if (!path || !strlen(path))
goto check;
if (path) {
if (path[0] ... | char *compose_path(ctrl_t *ctrl, char *path)
{
struct stat st;
static char rpath[PATH_MAX];
char *name, *ptr;
char dir[PATH_MAX] = { 0 };
strlcpy(dir, ctrl->cwd, sizeof(dir));
DBG("Compose path from cwd: %s, arg: %s", ctrl->cwd, path ?: "");
if (!path || !strlen(path))
goto check;
if (path) {
if (path[0] ... | {
"deleted": [
{
"line_no": 63,
"char_start": 1460,
"char_end": 1514,
"line": "\tif (!chrooted && strncmp(dir, home, strlen(home))) {\n"
}
],
"added": [
{
"line_no": 63,
"char_start": 1460,
"char_end": 1516,
"line": "\tif (!chrooted && strncmp(rpath, hom... | {
"deleted": [
{
"char_start": 1486,
"char_end": 1488,
"chars": "di"
}
],
"added": [
{
"char_start": 1487,
"char_end": 1491,
"chars": "path"
}
]
} | github.com/troglobit/uftpd/commit/455b47d3756aed162d2d0ef7f40b549f3b5b30fe | src/common.c | cwe-022 |
valid_id | def valid_id(opts, id_):
'''
Returns if the passed id is valid
'''
try:
return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)
except (AttributeError, KeyError, TypeError) as e:
return False | def valid_id(opts, id_):
'''
Returns if the passed id is valid
'''
try:
if any(x in id_ for x in ('/', '\\', '\0')):
return False
return bool(clean_path(opts['pki_dir'], id_))
except (AttributeError, KeyError, TypeError):
return False | {
"deleted": [
{
"line_no": 6,
"char_start": 88,
"char_end": 160,
"line": " return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)\n"
},
{
"line_no": 7,
"char_start": 160,
"char_end": 215,
"line": " except (AttributeError, KeyError, TypeEr... | {
"deleted": [
{
"char_start": 141,
"char_end": 159,
"chars": " and clean_id(id_)"
},
{
"char_start": 208,
"char_end": 213,
"chars": " as e"
}
],
"added": [
{
"char_start": 96,
"char_end": 174,
"chars": "if any(x in id_ for x in ('/', '\\\\... | github.com/saltstack/salt/commit/80d90307b07b3703428ecbb7c8bb468e28a9ae6d | salt/utils/verify.py | cwe-022 |
get | def get(self, path):
return static_file(path, self.get_base_path()) | def get(self, path):
path = self.sanitize_path(path)
base_paths = self.get_base_paths()
if hasattr(base_paths, 'split'):
# String, so go simple
base_path = base_paths
else:
base_path = self.get_first_base(base_paths, path)
return static_fil... | {
"deleted": [
{
"line_no": 2,
"char_start": 25,
"char_end": 79,
"line": " return static_file(path, self.get_base_path())\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 25,
"char_end": 65,
"line": " path = self.sanitize_path(path)\n"
... | {
"deleted": [
{
"char_start": 36,
"char_end": 37,
"chars": "u"
},
{
"char_start": 44,
"char_end": 49,
"chars": "ic_fi"
},
{
"char_start": 51,
"char_end": 52,
"chars": "("
},
{
"char_start": 56,
"char_end": 57,
"chars"... | github.com/foxbunny/seagull/commit/1fb790712fe0c1d1957b31e34a8e0e6593af87a7 | seagull/routes/app.py | cwe-022 |
dd_exist | int dd_exist(const struct dump_dir *dd, const char *path)
{
char *full_path = concat_path_file(dd->dd_dirname, path);
int ret = exist_file_dir(full_path);
free(full_path);
return ret;
} | int dd_exist(const struct dump_dir *dd, const char *path)
{
if (!str_is_correct_filename(path))
error_msg_and_die("Cannot test existence. '%s' is not a valid file name", path);
char *full_path = concat_path_file(dd->dd_dirname, path);
int ret = exist_file_dir(full_path);
free(full_path);
re... | {
"deleted": [],
"added": [
{
"line_no": 3,
"char_start": 60,
"char_end": 100,
"line": " if (!str_is_correct_filename(path))\n"
},
{
"line_no": 4,
"char_start": 100,
"char_end": 189,
"line": " error_msg_and_die(\"Cannot test existence. '%s' is no... | {
"deleted": [],
"added": [
{
"char_start": 64,
"char_end": 194,
"chars": "if (!str_is_correct_filename(path))\n error_msg_and_die(\"Cannot test existence. '%s' is not a valid file name\", path);\n\n "
}
]
} | github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277 | src/lib/dump_dir.c | cwe-022 |
is_cgi | def is_cgi(self):
"""Test whether self.path corresponds to a CGI script,
and return a boolean.
This function sets self.cgi_info to a tuple (dir, rest)
when it returns True, where dir is the directory part before
the CGI script name. Note that rest begins with a
slas... | def is_cgi(self):
"""Test whether self.path corresponds to a CGI script.
Returns True and updates the cgi_info attribute to the tuple
(dir, rest) if self.path requires running a CGI script.
Returns False otherwise.
The default implementation tests whether the normalized url... | {
"deleted": [
{
"line_no": 2,
"char_start": 22,
"char_end": 85,
"line": " \"\"\"Test whether self.path corresponds to a CGI script,\n"
},
{
"line_no": 3,
"char_start": 85,
"char_end": 115,
"line": " and return a boolean.\n"
},
{
... | {
"deleted": [
{
"char_start": 83,
"char_end": 84,
"chars": ","
},
{
"char_start": 93,
"char_end": 98,
"chars": "and r"
},
{
"char_start": 104,
"char_end": 110,
"chars": "a bool"
},
{
"char_start": 113,
"char_end": 120,
... | github.com/Ricky-Wilson/Python/commit/c5abced949e6a4b001d1dee321593e74ecadecfe | Lib/CGIHTTPServer.py | cwe-022 |
deleteKey | def deleteKey(client):
"""Deletes the specified key.
Returns an error if the key doesn't exist
"""
global BAD_REQUEST
global NOT_FOUND
validateClient(client)
client_pub_key = loadClientRSAKey(client)
token_data = decodeRequestToken(request.data, client_pub_key)
if re.search('[^a-zA-Z0-9]', token_data['key']... | def deleteKey(client):
"""Deletes the specified key.
Returns an error if the key doesn't exist
"""
global NOT_FOUND
validateClient(client)
client_pub_key = loadClientRSAKey(client)
token_data = decodeRequestToken(request.data, client_pub_key)
validateKeyName(token_data['key'])
try:
os.remove('keys/%s/%s.ke... | {
"deleted": [
{
"line_no": 5,
"char_start": 102,
"char_end": 122,
"line": "\tglobal BAD_REQUEST\n"
},
{
"line_no": 9,
"char_start": 165,
"char_end": 166,
"line": "\n"
},
{
"line_no": 12,
"char_start": 272,
"char_end": 273,
"l... | {
"deleted": [
{
"char_start": 110,
"char_end": 130,
"chars": "BAD_REQUEST\n\tglobal "
},
{
"char_start": 165,
"char_end": 166,
"chars": "\n"
},
{
"char_start": 272,
"char_end": 273,
"chars": "\n"
},
{
"char_start": 275,
"ch... | github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833 | impl.py | cwe-022 |
set | def set(self, key, value, replace=False):
path = os.path.join(self.namespace, key)
try:
self.etcd.write(path, value, prevExist=replace)
except etcd.EtcdAlreadyExist as err:
raise CSStoreExists(str(err))
except etcd.EtcdException as err:
log_error("... | def set(self, key, value, replace=False):
path = self._absolute_key(key)
try:
self.etcd.write(path, value, prevExist=replace)
except etcd.EtcdAlreadyExist as err:
raise CSStoreExists(str(err))
except etcd.EtcdException as err:
log_error("Error stor... | {
"deleted": [
{
"line_no": 2,
"char_start": 46,
"char_end": 95,
"line": " path = os.path.join(self.namespace, key)\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 46,
"char_end": 85,
"line": " path = self._absolute_key(key)\n"
}
]
} | {
"deleted": [
{
"char_start": 61,
"char_end": 74,
"chars": "os.path.join("
},
{
"char_start": 79,
"char_end": 80,
"chars": "n"
},
{
"char_start": 81,
"char_end": 83,
"chars": "me"
},
{
"char_start": 84,
"char_end": 87,
... | github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4 | custodia/store/etcdstore.py | cwe-022 |
_inject_key_into_fs | def _inject_key_into_fs(key, fs, execute=None):
"""Add the given public ssh key to root's authorized_keys.
key is an ssh key string.
fs is the path to the base of the filesystem into which to inject the key.
"""
sshdir = os.path.join(fs, 'root', '.ssh')
utils.execute('mkdir', '-p', sshdir, run_... | def _inject_key_into_fs(key, fs, execute=None):
"""Add the given public ssh key to root's authorized_keys.
key is an ssh key string.
fs is the path to the base of the filesystem into which to inject the key.
"""
sshdir = _join_and_check_path_within_fs(fs, 'root', '.ssh')
utils.execute('mkdir', ... | {
"deleted": [
{
"line_no": 7,
"char_start": 229,
"char_end": 275,
"line": " sshdir = os.path.join(fs, 'root', '.ssh')\n"
},
{
"line_no": 11,
"char_start": 455,
"char_end": 509,
"line": " keyfile = os.path.join(sshdir, 'authorized_keys')\n"
},
... | {
"deleted": [
{
"char_start": 243,
"char_end": 245,
"chars": "s."
},
{
"char_start": 249,
"char_end": 252,
"chars": ".jo"
},
{
"char_start": 485,
"char_end": 488,
"chars": "dir"
},
{
"char_start": 655,
"char_end": 656,
... | github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7 | nova/virt/disk/api.py | cwe-022 |
start | def start():
print("[*] Starting backdoor process")
print("[*] Decompressing target to tmp directory...")
#subprocess.call("jar -x %s" % target, shell=True)
with zipfile.ZipFile(target, 'r') as zip:
zip.extractall("tmp")
print("[*] Target dumped to tmp directory")
print("[*] Modifying m... | def start():
print("[*] Starting backdoor process")
print("[*] Decompressing target to tmp directory...")
#subprocess.call("jar -x %s" % target, shell=True)
with zipfile.ZipFile(target, 'r') as zip:
zip.extractall("tmp")
print("[*] Target dumped to tmp directory")
print("[*] Modifying m... | {
"deleted": [
{
"line_no": 44,
"char_start": 1462,
"char_end": 1539,
"line": " if subprocess.call(\"javac -cp tmp/ tmp/%s\" % backdoor, shell=True) != 0:\n"
}
],
"added": [
{
"line_no": 45,
"char_start": 1540,
"char_end": 1623,
"line": " if subpro... | {
"deleted": [],
"added": [
{
"char_start": 1466,
"char_end": 1467,
"chars": "#"
},
{
"char_start": 1531,
"char_end": 1614,
"chars": "e) != 0:\n if subprocess.call(['javac','-cp','tmp/','tmp/%s'%backdoor],shell=Fals"
}
]
} | github.com/Atticuss/ajar/commit/5ed8aba271ad20e6168f2e3bd6c25ba89b84484f | ajar.py | cwe-078 |
_map_vol_to_host | def _map_vol_to_host(self, volume_name, host_name):
"""Create a mapping between a volume to a host."""
LOG.debug(_('enter: _map_vol_to_host: volume %(volume_name)s to '
'host %(host_name)s')
% {'volume_name': volume_name, 'host_name': host_name})
# Che... | def _map_vol_to_host(self, volume_name, host_name):
"""Create a mapping between a volume to a host."""
LOG.debug(_('enter: _map_vol_to_host: volume %(volume_name)s to '
'host %(host_name)s')
% {'volume_name': volume_name, 'host_name': host_name})
# Che... | {
"deleted": [
{
"line_no": 29,
"char_start": 1119,
"char_end": 1194,
"line": " ssh_cmd = ('svctask mkvdiskhostmap -host %(host_name)s -scsi '\n"
},
{
"line_no": 30,
"char_start": 1194,
"char_end": 1252,
"line": " '%(result_l... | {
"deleted": [
{
"char_start": 1141,
"char_end": 1142,
"chars": "("
},
{
"char_start": 1165,
"char_end": 1192,
"chars": " -host %(host_name)s -scsi "
},
{
"char_start": 1193,
"char_end": 1216,
"chars": "\n "
},
{
... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_delete_vdisk | def _delete_vdisk(self, name, force):
"""Deletes existing vdisks.
It is very important to properly take care of mappings before deleting
the disk:
1. If no mappings, then it was a vdisk, and can be deleted
2. If it is the source of a flashcopy mapping and copy_rate is 0, the... | def _delete_vdisk(self, name, force):
"""Deletes existing vdisks.
It is very important to properly take care of mappings before deleting
the disk:
1. If no mappings, then it was a vdisk, and can be deleted
2. If it is the source of a flashcopy mapping and copy_rate is 0, the... | {
"deleted": [
{
"line_no": 32,
"char_start": 1403,
"char_end": 1449,
"line": " forceflag = '-force' if force else ''\n"
},
{
"line_no": 33,
"char_start": 1449,
"char_end": 1503,
"line": " cmd_params = {'frc': forceflag, 'name': name}\n"
},... | {
"deleted": [
{
"char_start": 1411,
"char_end": 1414,
"chars": "for"
},
{
"char_start": 1415,
"char_end": 1420,
"chars": "eflag"
},
{
"char_start": 1424,
"char_end": 1428,
"chars": "-for"
},
{
"char_start": 1429,
"char_end"... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_cliq_run | def _cliq_run(self, verb, cliq_args, check_exit_code=True):
"""Runs a CLIQ command over SSH, without doing any result parsing"""
cliq_arg_strings = []
for k, v in cliq_args.items():
cliq_arg_strings.append(" %s=%s" % (k, v))
cmd = verb + ''.join(cliq_arg_strings)
... | def _cliq_run(self, verb, cliq_args, check_exit_code=True):
"""Runs a CLIQ command over SSH, without doing any result parsing"""
cmd_list = [verb]
for k, v in cliq_args.items():
cmd_list.append("%s=%s" % (k, v))
return self._run_ssh(cmd_list, check_exit_code) | {
"deleted": [
{
"line_no": 3,
"char_start": 141,
"char_end": 171,
"line": " cliq_arg_strings = []\n"
},
{
"line_no": 5,
"char_start": 210,
"char_end": 265,
"line": " cliq_arg_strings.append(\" %s=%s\" % (k, v))\n"
},
{
"line_... | {
"deleted": [
{
"char_start": 152,
"char_end": 158,
"chars": "q_arg_"
},
{
"char_start": 160,
"char_end": 165,
"chars": "rings"
},
{
"char_start": 225,
"char_end": 231,
"chars": "q_arg_"
},
{
"char_start": 233,
"char_end": ... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp_lefthand.py | cwe-078 |
_set_qos_rule | def _set_qos_rule(self, qos, vvs_name):
max_io = self._get_qos_value(qos, 'maxIOPS')
max_bw = self._get_qos_value(qos, 'maxBWS')
cli_qos_string = ""
if max_io is not None:
cli_qos_string += ('-io %s ' % max_io)
if max_bw is not None:
cli_qos_string += ... | def _set_qos_rule(self, qos, vvs_name):
max_io = self._get_qos_value(qos, 'maxIOPS')
max_bw = self._get_qos_value(qos, 'maxBWS')
cli_qos_string = ""
if max_io is not None:
cli_qos_string += ('-io %s ' % max_io)
if max_bw is not None:
cli_qos_string += ... | {
"deleted": [
{
"line_no": 9,
"char_start": 342,
"char_end": 386,
"line": " self._cli_run('setqos %svvset:%s' %\n"
},
{
"line_no": 10,
"char_start": 386,
"char_end": 441,
"line": " (cli_qos_string, vvs_name), None)\n"
}
],
... | {
"deleted": [
{
"char_start": 385,
"char_end": 407,
"chars": "\n "
},
{
"char_start": 434,
"char_end": 440,
"chars": ", None"
}
],
"added": [
{
"char_start": 364,
"char_end": 365,
"chars": "["
},
{
"char_s... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
get_lines | def get_lines(command: str) -> List[str]:
"""
Run a command and return lines of output
:param str command: the command to run
:returns: list of whitespace-stripped lines output by command
"""
stdout = get_output(command)
return [line.strip().decode() for line in stdout.splitlines()] | def get_lines(command: List[str]) -> List[str]:
"""
Run a command and return lines of output
:param str command: the command to run
:returns: list of whitespace-stripped lines output by command
"""
stdout = get_output(command)
return [line.strip() for line in stdout.splitlines()] | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 42,
"line": "def get_lines(command: str) -> List[str]:\n"
},
{
"line_no": 9,
"char_start": 246,
"char_end": 312,
"line": " return [line.strip().decode() for line in stdout.splitlines()]\n"
}
... | {
"deleted": [
{
"char_start": 268,
"char_end": 277,
"chars": "().decode"
}
],
"added": [
{
"char_start": 23,
"char_end": 28,
"chars": "List["
},
{
"char_start": 31,
"char_end": 32,
"chars": "]"
}
]
} | github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76 | isort/hooks.py | cwe-078 |
_modify_3par_iscsi_host | def _modify_3par_iscsi_host(self, hostname, iscsi_iqn):
# when using -add, you can not send the persona or domain options
self.common._cli_run('createhost -iscsi -add %s %s'
% (hostname, iscsi_iqn), None) | def _modify_3par_iscsi_host(self, hostname, iscsi_iqn):
# when using -add, you can not send the persona or domain options
command = ['createhost', '-iscsi', '-add', hostname, iscsi_iqn]
self.common._cli_run(command) | {
"deleted": [
{
"line_no": 3,
"char_start": 134,
"char_end": 194,
"line": " self.common._cli_run('createhost -iscsi -add %s %s'\n"
},
{
"line_no": 4,
"char_start": 194,
"char_end": 253,
"line": " % (hostname, iscsi_iqn), N... | {
"deleted": [
{
"char_start": 142,
"char_end": 147,
"chars": "self."
},
{
"char_start": 151,
"char_end": 152,
"chars": "o"
},
{
"char_start": 153,
"char_end": 163,
"chars": "._cli_run("
},
{
"char_start": 186,
"char_end": 1... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_iscsi.py | cwe-078 |
run_interactive_shell_command | @contextmanager
def run_interactive_shell_command(command, **kwargs):
"""
Runs a command in shell and provides stdout, stderr and stdin streams.
This function creates a context manager that sets up the process, returns
to caller, closes streams and waits for process to exit on leaving.
The process... | @contextmanager
def run_interactive_shell_command(command, **kwargs):
"""
Runs a single command in shell and provides stdout, stderr and stdin
streams.
This function creates a context manager that sets up the process (using
`subprocess.Popen()`), returns to caller, closes streams and waits for
... | {
"deleted": [
{
"line_no": 4,
"char_start": 78,
"char_end": 153,
"line": " Runs a command in shell and provides stdout, stderr and stdin streams.\n"
},
{
"line_no": 6,
"char_start": 154,
"char_end": 232,
"line": " This function creates a context manag... | {
"deleted": [
{
"char_start": 231,
"char_end": 235,
"chars": "\n "
},
{
"char_start": 554,
"char_end": 558,
"chars": "hell"
},
{
"char_start": 580,
"char_end": 590,
"chars": " `stdout`,"
},
{
"char_start": 656,
"char_end"... | github.com/coala/coala/commit/adc94c745e4d9f792fd9c9791c7b4cd8790d0d2f | coalib/misc/Shell.py | cwe-078 |
delete_video | @app.route('/delete_video/<filename>')
def delete_video(filename):
if 'username' in session:
#os.remove("static/videos/{}".format(filename))
print(session['username'], file=sys.stdout)
data=users.query.filter_by(Username=session['username']).first()
video=Video.query.filter_by(UserID=data.UserID,Name=filename)... | @app.route('/delete_video/<filename>')
def delete_video(filename):
if 'username' in session:
#os.remove("static/videos/{}".format(filename))
print(session['username'], file=sys.stdout)
data=users.query.filter_by(Username=session['username']).first()
video=Video.query.filter_by(UserID=data.UserID,Name=filename)... | {
"deleted": [
{
"line_no": 9,
"char_start": 349,
"char_end": 399,
"line": "\t\t\tos.remove(\"static/videos/{}\".format(filename))\n"
}
],
"added": [
{
"line_no": 10,
"char_start": 400,
"char_end": 453,
"line": "\t\t\tos.system(\"rm static/videos/{}\".fo... | {
"deleted": [],
"added": [
{
"char_start": 352,
"char_end": 353,
"chars": "#"
},
{
"char_start": 364,
"char_end": 417,
"chars": "static/videos/{}\".format(filename))\n\t\t\tos.system(\"rm "
}
]
} | github.com/jmarcello97/CSEC-380-Project/commit/05dcd628aa5879b6e4979c43e7c635075975de09 | Trialwebsite/app/app.py | cwe-078 |
whitelist | def whitelist(users: str):
for user in users.split():
call(WHITELIST_COMMAND_TEMPLATE.format(user)) | def whitelist(channel: discord.TextChannel, users: str):
for user in users.split():
if not re.match(r'^[A-Za-z0-9_]{3,16}$', user): # as per https://help.mojang.com/customer/en/portal/articles/928638-minecraft-usernames?b_id=5408
await channel.send('\'{}\' is not a valid Minecraft username'.for... | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 27,
"line": "def whitelist(users: str):\n"
},
{
"line_no": 3,
"char_start": 58,
"char_end": 111,
"line": " call(WHITELIST_COMMAND_TEMPLATE.format(user))\n"
}
],
"added": [
{
... | {
"deleted": [],
"added": [
{
"char_start": 14,
"char_end": 44,
"chars": "channel: discord.TextChannel, "
},
{
"char_start": 88,
"char_end": 349,
"chars": " if not re.match(r'^[A-Za-z0-9_]{3,16}$', user): # as per https://help.mojang.com/customer/en/portal/art... | github.com/thomotron/Gatekeep/commit/955660f9b3dc336ab0d5dfb4392b3ab6deac6b25 | bot.py | cwe-078 |
test_create_host | def test_create_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, "get_domain",
... | def test_create_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, "get_domain",
... | {
"deleted": [
{
"line_no": 13,
"char_start": 501,
"char_end": 554,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n"
},
{
"line_no": 16,
"char_start": 635,
"char_end": 712,
"line": " create_host_cmd = ('createhost -persona 1 -domain (\... | {
"deleted": [
{
"char_start": 692,
"char_end": 706,
"chars": " (\\'OpenStack\\"
},
{
"char_start": 708,
"char_end": 711,
"chars": ") '"
}
],
"added": [
{
"char_start": 525,
"char_end": 526,
"chars": "["
},
{
"char_start": 535... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/tests/test_hp3par.py | cwe-078 |
do_setup | def do_setup(self, ctxt):
"""Check that we have all configuration details from the storage."""
LOG.debug(_('enter: do_setup'))
self._context = ctxt
# Validate that the pool exists
ssh_cmd = 'svcinfo lsmdiskgrp -delim ! -nohdr'
out, err = self._run_ssh(ssh_cmd)
... | def do_setup(self, ctxt):
"""Check that we have all configuration details from the storage."""
LOG.debug(_('enter: do_setup'))
self._context = ctxt
# Validate that the pool exists
ssh_cmd = ['svcinfo', 'lsmdiskgrp', '-delim', '!', '-nohdr']
out, err = self._run_ssh(... | {
"deleted": [
{
"line_no": 8,
"char_start": 218,
"char_end": 273,
"line": " ssh_cmd = 'svcinfo lsmdiskgrp -delim ! -nohdr'\n"
},
{
"line_no": 21,
"char_start": 806,
"char_end": 857,
"line": " ssh_cmd = 'svcinfo lslicense -delim !'\n"
}... | {
"deleted": [],
"added": [
{
"char_start": 236,
"char_end": 237,
"chars": "["
},
{
"char_start": 245,
"char_end": 247,
"chars": "',"
},
{
"char_start": 248,
"char_end": 249,
"chars": "'"
},
{
"char_start": 259,
"char_end"... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_execute_command_and_parse_attributes | def _execute_command_and_parse_attributes(self, ssh_cmd):
"""Execute command on the Storwize/SVC and parse attributes.
Exception is raised if the information from the system
can not be obtained.
"""
LOG.debug(_('enter: _execute_command_and_parse_attributes: '
... | def _execute_command_and_parse_attributes(self, ssh_cmd):
"""Execute command on the Storwize/SVC and parse attributes.
Exception is raised if the information from the system
can not be obtained.
"""
LOG.debug(_('enter: _execute_command_and_parse_attributes: '
... | {
"deleted": [
{
"line_no": 10,
"char_start": 307,
"char_end": 353,
"line": " ' command %s') % ssh_cmd)\n"
},
{
"line_no": 36,
"char_start": 1465,
"char_end": 1502,
"line": " % {'cmd': ssh_cmd,\n"
}
],
"added": [
... | {
"deleted": [],
"added": [
{
"char_start": 345,
"char_end": 349,
"chars": "tr(s"
},
{
"char_start": 355,
"char_end": 356,
"chars": ")"
},
{
"char_start": 1499,
"char_end": 1503,
"chars": "tr(s"
},
{
"char_start": 1509,
"c... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
test_get_iscsi_ip_active | def test_get_iscsi_ip_active(self):
self.flags(lock_path=self.tempdir)
#record set up
self.clear_mox()
_run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh)
show_port_cmd = 'showp... | def test_get_iscsi_ip_active(self):
self.flags(lock_path=self.tempdir)
#record set up
self.clear_mox()
_run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh)
show_port_cmd = ['show... | {
"deleted": [
{
"line_no": 9,
"char_start": 290,
"char_end": 325,
"line": " show_port_cmd = 'showport'\n"
},
{
"line_no": 12,
"char_start": 397,
"char_end": 441,
"line": " show_port_i_cmd = 'showport -iscsi'\n"
},
{
"line_no": 16... | {
"deleted": [],
"added": [
{
"char_start": 314,
"char_end": 315,
"chars": "["
},
{
"char_start": 325,
"char_end": 326,
"chars": "]"
},
{
"char_start": 425,
"char_end": 426,
"chars": "["
},
{
"char_start": 435,
"char_end":... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/tests/test_hp3par.py | cwe-078 |
_find_host_from_wwpn | def _find_host_from_wwpn(self, connector):
for wwpn in connector['wwpns']:
ssh_cmd = 'svcinfo lsfabric -wwpn %s -delim !' % wwpn
out, err = self._run_ssh(ssh_cmd)
if not len(out.strip()):
# This WWPN is not in use
continue
hos... | def _find_host_from_wwpn(self, connector):
for wwpn in connector['wwpns']:
ssh_cmd = ['svcinfo', 'lsfabric', '-wwpn', wwpn, '-delim', '!']
out, err = self._run_ssh(ssh_cmd)
if not len(out.strip()):
# This WWPN is not in use
continue
... | {
"deleted": [
{
"line_no": 3,
"char_start": 87,
"char_end": 153,
"line": " ssh_cmd = 'svcinfo lsfabric -wwpn %s -delim !' % wwpn\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 87,
"char_end": 163,
"line": " ssh_cmd = ['svcinfo', ... | {
"deleted": [
{
"char_start": 133,
"char_end": 135,
"chars": "%s"
},
{
"char_start": 145,
"char_end": 152,
"chars": " % wwpn"
}
],
"added": [
{
"char_start": 109,
"char_end": 110,
"chars": "["
},
{
"char_start": 118,
"c... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
extend_volume | def extend_volume(self, volume, new_size):
LOG.debug(_('enter: extend_volume: volume %s') % volume['id'])
ret = self._ensure_vdisk_no_fc_mappings(volume['name'],
allow_snaps=False)
if not ret:
exception_message = (_('extend_volume: ... | def extend_volume(self, volume, new_size):
LOG.debug(_('enter: extend_volume: volume %s') % volume['id'])
ret = self._ensure_vdisk_no_fc_mappings(volume['name'],
allow_snaps=False)
if not ret:
exception_message = (_('extend_volume: ... | {
"deleted": [
{
"line_no": 11,
"char_start": 544,
"char_end": 621,
"line": " ssh_cmd = ('svctask expandvdisksize -size %(amt)d -unit gb %(name)s'\n"
},
{
"line_no": 12,
"char_start": 621,
"char_end": 687,
"line": " % {'amt': extend_... | {
"deleted": [
{
"char_start": 594,
"char_end": 595,
"chars": "%"
},
{
"char_start": 596,
"char_end": 598,
"chars": "am"
},
{
"char_start": 599,
"char_end": 600,
"chars": ")"
},
{
"char_start": 601,
"char_end": 614,
"c... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_get_host_from_connector | def _get_host_from_connector(self, connector):
"""List the hosts defined in the storage.
Return the host name with the given connection info, or None if there
is no host fitting that information.
"""
prefix = self._connector_to_hostname_prefix(connector)
LOG.debug(... | def _get_host_from_connector(self, connector):
"""List the hosts defined in the storage.
Return the host name with the given connection info, or None if there
is no host fitting that information.
"""
prefix = self._connector_to_hostname_prefix(connector)
LOG.debug(... | {
"deleted": [
{
"line_no": 13,
"char_start": 421,
"char_end": 465,
"line": " ssh_cmd = 'svcinfo lshost -delim !'\n"
}
],
"added": [
{
"line_no": 13,
"char_start": 421,
"char_end": 476,
"line": " ssh_cmd = ['svcinfo', 'lshost', '-delim', '!... | {
"deleted": [],
"added": [
{
"char_start": 439,
"char_end": 440,
"chars": "["
},
{
"char_start": 448,
"char_end": 450,
"chars": "',"
},
{
"char_start": 451,
"char_end": 452,
"chars": "'"
},
{
"char_start": 458,
"char_end"... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_get_hostvdisk_mappings | def _get_hostvdisk_mappings(self, host_name):
"""Return the defined storage mappings for a host."""
return_data = {}
ssh_cmd = 'svcinfo lshostvdiskmap -delim ! %s' % host_name
out, err = self._run_ssh(ssh_cmd)
mappings = out.strip().split('\n')
if len(mappings):
... | def _get_hostvdisk_mappings(self, host_name):
"""Return the defined storage mappings for a host."""
return_data = {}
ssh_cmd = ['svcinfo', 'lshostvdiskmap', '-delim', '!', host_name]
out, err = self._run_ssh(ssh_cmd)
mappings = out.strip().split('\n')
if len(mapping... | {
"deleted": [
{
"line_no": 5,
"char_start": 138,
"char_end": 205,
"line": " ssh_cmd = 'svcinfo lshostvdiskmap -delim ! %s' % host_name\n"
}
],
"added": [
{
"line_no": 5,
"char_start": 138,
"char_end": 212,
"line": " ssh_cmd = ['svcinfo', '... | {
"deleted": [
{
"char_start": 188,
"char_end": 191,
"chars": " %s"
},
{
"char_start": 192,
"char_end": 194,
"chars": " %"
}
],
"added": [
{
"char_start": 156,
"char_end": 157,
"chars": "["
},
{
"char_start": 165,
"char_... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
main | def main():
global word
print("Starting script... press 'ctrl+c' in terminal to turn off")
while True:
if pyperclip.paste() != word and len(pyperclip.paste().split())<5:
word = pyperclip.paste()
wordChc=False
req = requests.get("https://api-portal.dictionary.com/d... | def main():
global word
print("Starting script... press 'ctrl+c' in terminal to turn off")
while True:
if pyperclip.paste() != word and len(pyperclip.paste().split())<5:
word = pyperclip.paste()
wordChc=False
req = requests.get("https://api-portal.dictionary.com/d... | {
"deleted": [
{
"line_no": 14,
"char_start": 630,
"char_end": 714,
"line": " os.system('notify-send \"Cant find |%s| on dictionary.com!\"' % word)\n"
},
{
"line_no": 17,
"char_start": 774,
"char_end": 858,
"line": " os.system('... | {
"deleted": [
{
"char_start": 680,
"char_end": 684,
"chars": "|%s|"
},
{
"char_start": 705,
"char_end": 712,
"chars": " % word"
},
{
"char_start": 824,
"char_end": 828,
"chars": "|%s|"
},
{
"char_start": 849,
"char_end": 85... | github.com/kelj0/LearningPython/commit/2563088bf44f4d5e7f7d65f3c41f12fdaef4a1e4 | SmallProjects/Define/define.py | cwe-078 |
_get_vvset_from_3par | def _get_vvset_from_3par(self, volume_name):
"""Get Virtual Volume Set from 3PAR.
The only way to do this currently is to try and delete the volume
to get the error message.
NOTE(walter-boring): don't call this unless you know the volume is
already in a vvset!
"""
... | def _get_vvset_from_3par(self, volume_name):
"""Get Virtual Volume Set from 3PAR.
The only way to do this currently is to try and delete the volume
to get the error message.
NOTE(walter-boring): don't call this unless you know the volume is
already in a vvset!
"""
... | {
"deleted": [
{
"line_no": 10,
"char_start": 319,
"char_end": 364,
"line": " cmd = \"removevv -f %s\" % volume_name\n"
},
{
"line_no": 12,
"char_start": 436,
"char_end": 475,
"line": " out = self._cli_run(cmd, None)\n"
}
],
"added": [
... | {
"deleted": [
{
"char_start": 333,
"char_end": 334,
"chars": "\""
},
{
"char_start": 345,
"char_end": 351,
"chars": " %s\" %"
},
{
"char_start": 467,
"char_end": 473,
"chars": ", None"
}
],
"added": [
{
"char_start": 333,
... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
_get_flashcopy_mapping_attributes | def _get_flashcopy_mapping_attributes(self, fc_map_id):
LOG.debug(_('enter: _get_flashcopy_mapping_attributes: mapping %s')
% fc_map_id)
fc_ls_map_cmd = 'svcinfo lsfcmap -filtervalue id=%s -delim !' % \
fc_map_id
out, err = self._run_ssh(fc_ls_map_cmd)
... | def _get_flashcopy_mapping_attributes(self, fc_map_id):
LOG.debug(_('enter: _get_flashcopy_mapping_attributes: mapping %s')
% fc_map_id)
fc_ls_map_cmd = ['svcinfo', 'lsfcmap', '-filtervalue',
'id=%s' % fc_map_id, '-delim', '!']
out, err = self._run... | {
"deleted": [
{
"line_no": 5,
"char_start": 168,
"char_end": 242,
"line": " fc_ls_map_cmd = 'svcinfo lsfcmap -filtervalue id=%s -delim !' % \\\n"
},
{
"line_no": 6,
"char_start": 242,
"char_end": 264,
"line": " fc_map_id\n"
}
],
"a... | {
"deleted": [
{
"char_start": 222,
"char_end": 227,
"chars": "id=%s"
},
{
"char_start": 228,
"char_end": 234,
"chars": "-delim"
},
{
"char_start": 235,
"char_end": 237,
"chars": "!'"
},
{
"char_start": 238,
"char_end": 239,... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_add_volume_to_volume_set | def _add_volume_to_volume_set(self, volume, volume_name,
cpg, vvs_name, qos):
if vvs_name is not None:
# Admin has set a volume set name to add the volume to
self._cli_run('createvvset -add %s %s' % (vvs_name,
... | def _add_volume_to_volume_set(self, volume, volume_name,
cpg, vvs_name, qos):
if vvs_name is not None:
# Admin has set a volume set name to add the volume to
self._cli_run(['createvvset', '-add', vvs_name, volume_name])
else:
vvs_... | {
"deleted": [
{
"line_no": 5,
"char_start": 216,
"char_end": 280,
"line": " self._cli_run('createvvset -add %s %s' % (vvs_name,\n"
},
{
"line_no": 6,
"char_start": 280,
"char_end": 354,
"line": " ... | {
"deleted": [
{
"char_start": 259,
"char_end": 265,
"chars": " %s %s"
},
{
"char_start": 266,
"char_end": 268,
"chars": " %"
},
{
"char_start": 269,
"char_end": 270,
"chars": "("
},
{
"char_start": 279,
"char_end": 333,
... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
test_initialize_connection | def test_initialize_connection(self):
self.driver._eql_execute = self.mox.\
CreateMock(self.driver._eql_execute)
volume = {'name': self.volume_name}
self.stubs.Set(self.driver, "_get_iscsi_properties",
self._fake_get_iscsi_properties)
self.driver._e... | def test_initialize_connection(self):
self.driver._eql_execute = self.mox.\
CreateMock(self.driver._eql_execute)
volume = {'name': self.volume_name}
self.stubs.Set(self.driver, "_get_iscsi_properties",
self._fake_get_iscsi_properties)
self.driver._e... | {
"deleted": [
{
"line_no": 10,
"char_start": 495,
"char_end": 547,
"line": " 'authmethod chap',\n"
}
],
"added": [
{
"line_no": 10,
"char_start": 495,
"char_end": 550,
"line": " 'authmethod... | {
"deleted": [],
"added": [
{
"char_start": 539,
"char_end": 541,
"chars": "',"
},
{
"char_start": 542,
"char_end": 543,
"chars": "'"
}
]
} | github.com/thatsdone/cinder/commit/9e858bebb89de05b1c9ecc27f5bd9fbff95a728e | cinder/tests/test_eqlx.py | cwe-078 |
test_create_invalid_host | def test_create_invalid_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain",
... | def test_create_invalid_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain",
... | {
"deleted": [
{
"line_no": 13,
"char_start": 505,
"char_end": 558,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n"
},
{
"line_no": 16,
"char_start": 639,
"char_end": 716,
"line": " create_host_cmd = ('createhost -persona 1 -domain (\... | {
"deleted": [
{
"char_start": 696,
"char_end": 710,
"chars": " (\\'OpenStack\\"
},
{
"char_start": 712,
"char_end": 715,
"chars": ") '"
}
],
"added": [
{
"char_start": 529,
"char_end": 530,
"chars": "["
},
{
"char_start": 539... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/tests/test_hp3par.py | cwe-078 |
get_logs | @app.route('/api/uploads/<sid>/logs')
def get_logs(sid):
if '/' not in sid:
path = os.path.join(app.config['UPLOAD_FOLDER'], sid)
if os.path.isfile(os.path.join(path, app.config['LOG_FILE'])):
return send_from_directory(directory=path,
filename=app... | @app.route('/api/uploads/<sid>/logs')
def get_logs(sid):
if utils.sid_is_valid(sid):
path = join(app.config['UPLOAD_FOLDER'], sid)
if os.path.isfile(join(path, app.config['LOG_FILE'])):
return send_from_directory(directory=path,
filename=app.confi... | {
"deleted": [
{
"line_no": 3,
"char_start": 57,
"char_end": 80,
"line": " if '/' not in sid:\n"
},
{
"line_no": 4,
"char_start": 80,
"char_end": 142,
"line": " path = os.path.join(app.config['UPLOAD_FOLDER'], sid)\n"
},
{
"line_no": ... | {
"deleted": [
{
"char_start": 64,
"char_end": 70,
"chars": "'/' no"
},
{
"char_start": 71,
"char_end": 72,
"chars": " "
},
{
"char_start": 73,
"char_end": 75,
"chars": "n "
},
{
"char_start": 95,
"char_end": 103,
"cha... | github.com/cheukyin699/genset-demo-site/commit/abb55b1a6786b0a995c2cdf77a7977a1d51cfc0d | app/views.py | cwe-078 |
_make_fc_map | def _make_fc_map(self, source, target, full_copy):
copyflag = '' if full_copy else '-copyrate 0'
fc_map_cli_cmd = ('svctask mkfcmap -source %(src)s -target %(tgt)s '
'-autodelete %(copyflag)s' %
{'src': source,
'tgt': tar... | def _make_fc_map(self, source, target, full_copy):
fc_map_cli_cmd = ['svctask', 'mkfcmap', '-source', source, '-target',
target, '-autodelete']
if not full_copy:
fc_map_cli_cmd.extend(['-copyrate', '0'])
out, err = self._run_ssh(fc_map_cli_cmd)
s... | {
"deleted": [
{
"line_no": 2,
"char_start": 55,
"char_end": 109,
"line": " copyflag = '' if full_copy else '-copyrate 0'\n"
},
{
"line_no": 3,
"char_start": 109,
"char_end": 186,
"line": " fc_map_cli_cmd = ('svctask mkfcmap -source %(src)s -ta... | {
"deleted": [
{
"char_start": 63,
"char_end": 117,
"chars": "copyflag = '' if full_copy else '-copyrate 0'\n "
},
{
"char_start": 134,
"char_end": 135,
"chars": "("
},
{
"char_start": 160,
"char_end": 162,
"chars": "%("
},
{
... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
test_get_iscsi_ip | def test_get_iscsi_ip(self):
self.flags(lock_path=self.tempdir)
#record driver set up
self.clear_mox()
_run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh)
show_port_cmd = 'showp... | def test_get_iscsi_ip(self):
self.flags(lock_path=self.tempdir)
#record driver set up
self.clear_mox()
_run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh)
show_port_cmd = ['show... | {
"deleted": [
{
"line_no": 9,
"char_start": 290,
"char_end": 325,
"line": " show_port_cmd = 'showport'\n"
},
{
"line_no": 12,
"char_start": 397,
"char_end": 441,
"line": " show_port_i_cmd = 'showport -iscsi'\n"
},
{
"line_no": 16... | {
"deleted": [],
"added": [
{
"char_start": 314,
"char_end": 315,
"chars": "["
},
{
"char_start": 325,
"char_end": 326,
"chars": "]"
},
{
"char_start": 425,
"char_end": 426,
"chars": "["
},
{
"char_start": 435,
"char_end":... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/tests/test_hp3par.py | cwe-078 |
usage | def usage(args=None):
'''
Return usage information for volumes mounted on this minion
CLI Example:
.. code-block:: bash
salt '*' disk.usage
'''
if __grains__['kernel'] == 'Linux':
cmd = 'df -P'
elif __grains__['kernel'] == 'OpenBSD':
cmd = 'df -kP'
else:
... | def usage(args=None):
'''
Return usage information for volumes mounted on this minion
CLI Example:
.. code-block:: bash
salt '*' disk.usage
'''
flags = ''
allowed = ('a', 'B', 'h', 'H', 'i', 'k', 'l', 'P', 't', 'T', 'x', 'v')
for flag in args:
if flag in allowed:
... | {
"deleted": [
{
"line_no": 18,
"char_start": 346,
"char_end": 378,
"line": " cmd = cmd + ' -' + args\n"
}
],
"added": [
{
"line_no": 11,
"char_start": 175,
"char_end": 190,
"line": " flags = ''\n"
},
{
"line_no": 12,
"char_... | {
"deleted": [
{
"char_start": 215,
"char_end": 215,
"chars": ""
},
{
"char_start": 359,
"char_end": 365,
"chars": " cmd +"
},
{
"char_start": 370,
"char_end": 373,
"chars": " + "
},
{
"char_start": 374,
"char_end": 375,
... | github.com/saltstack/salt/commit/ebdef37b7e5d2b95a01d34b211c61c61da67e46a | salt/modules/disk.py | cwe-078 |
_get_fc_wwpns | def _get_fc_wwpns(self):
for key in self._storage_nodes:
node = self._storage_nodes[key]
ssh_cmd = 'svcinfo lsnode -delim ! %s' % node['id']
raw = self._run_ssh(ssh_cmd)
resp = CLIResponse(raw, delim='!', with_header=False)
wwpns = set(node['WWPN']... | def _get_fc_wwpns(self):
for key in self._storage_nodes:
node = self._storage_nodes[key]
ssh_cmd = ['svcinfo', 'lsnode', '-delim', '!', node['id']]
raw = self._run_ssh(ssh_cmd)
resp = CLIResponse(raw, delim='!', with_header=False)
wwpns = set(node[... | {
"deleted": [
{
"line_no": 4,
"char_start": 113,
"char_end": 177,
"line": " ssh_cmd = 'svcinfo lsnode -delim ! %s' % node['id']\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 113,
"char_end": 184,
"line": " ssh_cmd = ['svcinfo', ... | {
"deleted": [
{
"char_start": 159,
"char_end": 162,
"chars": " %s"
},
{
"char_start": 163,
"char_end": 165,
"chars": " %"
}
],
"added": [
{
"char_start": 135,
"char_end": 136,
"chars": "["
},
{
"char_start": 144,
"char_... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
ls | def ls(self, data, path):
credentials = self._formatCredentials(data, name='current')
command = (
'{credentials} '
'rclone lsjson current:{path}'
).format(
credentials=credentials,
path=path,
)
try:
result = self._... | def ls(self, data, path):
credentials = self._formatCredentials(data, name='current')
command = [
'rclone',
'lsjson',
'current:{}'.format(path),
]
try:
result = self._execute(command, credentials)
result = json.loads(result... | {
"deleted": [
{
"line_no": 3,
"char_start": 98,
"char_end": 99,
"line": "\n"
},
{
"line_no": 4,
"char_start": 99,
"char_end": 119,
"line": " command = (\n"
},
{
"line_no": 5,
"char_start": 119,
"char_end": 148,
"line":... | {
"deleted": [
{
"char_start": 98,
"char_end": 99,
"chars": "\n"
},
{
"char_start": 117,
"char_end": 118,
"chars": "("
},
{
"char_start": 132,
"char_end": 134,
"chars": "{c"
},
{
"char_start": 135,
"char_end": 142,
"ch... | github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db | src/backend/api/utils/rclone_connection.py | cwe-078 |
_run_ssh | def _run_ssh(self, command, check_exit=True, attempts=1):
if not self.sshpool:
self.sshpool = utils.SSHPool(self.config.san_ip,
self.config.san_ssh_port,
self.config.ssh_conn_timeout,
... | def _run_ssh(self, cmd_list, check_exit=True, attempts=1):
utils.check_ssh_injection(cmd_list)
command = ' '. join(cmd_list)
if not self.sshpool:
self.sshpool = utils.SSHPool(self.config.san_ip,
self.config.san_ssh_port,
... | {
"deleted": [
{
"line_no": 1,
"char_start": 0,
"char_end": 62,
"line": " def _run_ssh(self, command, check_exit=True, attempts=1):\n"
}
],
"added": [
{
"line_no": 1,
"char_start": 0,
"char_end": 63,
"line": " def _run_ssh(self, cmd_list, check_exi... | {
"deleted": [
{
"char_start": 24,
"char_end": 25,
"chars": "o"
},
{
"char_start": 26,
"char_end": 29,
"chars": "man"
}
],
"added": [
{
"char_start": 26,
"char_end": 31,
"chars": "_list"
},
{
"char_start": 62,
"char_end"... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
verify | def verify(self, data):
credentials = self._formatCredentials(data, name='current')
command = '{} rclone lsjson current:'.format(credentials)
try:
result = self._execute(command)
return {
'result': True,
'message': 'Success',
... | def verify(self, data):
credentials = self._formatCredentials(data, name='current')
command = [
'rclone',
'lsjson',
'current:',
]
try:
result = self._execute(command, credentials)
return {
'result': True,
... | {
"deleted": [
{
"line_no": 3,
"char_start": 96,
"char_end": 162,
"line": " command = '{} rclone lsjson current:'.format(credentials)\n"
},
{
"line_no": 6,
"char_start": 176,
"char_end": 220,
"line": " result = self._execute(command)\n"
... | {
"deleted": [
{
"char_start": 115,
"char_end": 118,
"chars": "{} "
},
{
"char_start": 141,
"char_end": 161,
"chars": ".format(credentials)"
}
],
"added": [
{
"char_start": 114,
"char_end": 123,
"chars": "[\n "
},
{
"cha... | github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db | src/backend/api/utils/rclone_connection.py | cwe-078 |
add_extra_args | def add_extra_args(self, args=None):
"""Add more args depending on how known args are set."""
parsed = vars(self.parse_known_args(nohelp=True)[0])
# find which image mode specified if any, and add additional arguments
image_mode = parsed.get('image_mode', None)
if image_mode... | def add_extra_args(self, args=None):
"""Add more args depending on how known args are set."""
parsed = vars(self.parse_known_args(args, nohelp=True)[0])
# find which image mode specified if any, and add additional arguments
image_mode = parsed.get('image_mode', None)
if imag... | {
"deleted": [
{
"line_no": 3,
"char_start": 106,
"char_end": 167,
"line": " parsed = vars(self.parse_known_args(nohelp=True)[0])\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 106,
"char_end": 173,
"line": " parsed = vars(self.parse_know... | {
"deleted": [],
"added": [
{
"char_start": 150,
"char_end": 156,
"chars": "args, "
}
]
} | github.com/freedombenLiu/ParlAI/commit/601668d569e1276e0b8bf2bf8fb43e391e10d170 | parlai/core/params.py | cwe-078 |
_get_vdisk_fc_mappings | def _get_vdisk_fc_mappings(self, vdisk_name):
"""Return FlashCopy mappings that this vdisk is associated with."""
ssh_cmd = 'svcinfo lsvdiskfcmappings -nohdr %s' % vdisk_name
out, err = self._run_ssh(ssh_cmd)
mapping_ids = []
if (len(out.strip())):
lines = out.s... | def _get_vdisk_fc_mappings(self, vdisk_name):
"""Return FlashCopy mappings that this vdisk is associated with."""
ssh_cmd = ['svcinfo', 'lsvdiskfcmappings', '-nohdr', vdisk_name]
out, err = self._run_ssh(ssh_cmd)
mapping_ids = []
if (len(out.strip())):
lines = o... | {
"deleted": [
{
"line_no": 4,
"char_start": 127,
"char_end": 196,
"line": " ssh_cmd = 'svcinfo lsvdiskfcmappings -nohdr %s' % vdisk_name\n"
}
],
"added": [
{
"line_no": 4,
"char_start": 127,
"char_end": 200,
"line": " ssh_cmd = ['svcinfo',... | {
"deleted": [
{
"char_start": 178,
"char_end": 181,
"chars": " %s"
},
{
"char_start": 182,
"char_end": 184,
"chars": " %"
}
],
"added": [
{
"char_start": 145,
"char_end": 146,
"chars": "["
},
{
"char_start": 154,
"char_... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
test_create_host | def test_create_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain",
sel... | def test_create_host(self):
self.flags(lock_path=self.tempdir)
#record
self.clear_mox()
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg",
self.fake_get_cpg)
self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain",
sel... | {
"deleted": [
{
"line_no": 13,
"char_start": 497,
"char_end": 550,
"line": " show_host_cmd = 'showhost -verbose fakehost'\n"
},
{
"line_no": 16,
"char_start": 631,
"char_end": 698,
"line": " create_host_cmd = ('createhost -iscsi -persona 1 -do... | {
"deleted": [
{
"char_start": 695,
"char_end": 696,
"chars": " "
},
{
"char_start": 725,
"char_end": 726,
"chars": "'"
},
{
"char_start": 727,
"char_end": 728,
"chars": "\\"
},
{
"char_start": 738,
"char_end": 739,
"c... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/tests/test_hp3par.py | cwe-078 |
_copy_volume | def _copy_volume(self, src_name, dest_name, cpg=None, snap_cpg=None,
tpvv=True):
# Virtual volume sets are not supported with the -online option
cmd = 'createvvcopy -p %s -online ' % src_name
if snap_cpg:
cmd += '-snp_cpg %s ' % snap_cpg
if tpvv:
... | def _copy_volume(self, src_name, dest_name, cpg=None, snap_cpg=None,
tpvv=True):
# Virtual volume sets are not supported with the -online option
cmd = ['createvvcopy', '-p', src_name, '-online']
if snap_cpg:
cmd.extend(['-snp_cpg', snap_cpg])
if tpvv:... | {
"deleted": [
{
"line_no": 4,
"char_start": 178,
"char_end": 233,
"line": " cmd = 'createvvcopy -p %s -online ' % src_name\n"
},
{
"line_no": 6,
"char_start": 254,
"char_end": 299,
"line": " cmd += '-snp_cpg %s ' % snap_cpg\n"
},
{... | {
"deleted": [
{
"char_start": 209,
"char_end": 210,
"chars": "%"
},
{
"char_start": 219,
"char_end": 220,
"chars": " "
},
{
"char_start": 221,
"char_end": 232,
"chars": " % src_name"
},
{
"char_start": 269,
"char_end": 273,... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
_get_active_nsp | def _get_active_nsp(self, hostname):
"""Return the active nsp, if one exists, for the given host."""
result = self.common._cli_run('showvlun -a -host %s' % hostname, None)
if result:
# first line is header
result = result[1:]
for line in result:
... | def _get_active_nsp(self, hostname):
"""Return the active nsp, if one exists, for the given host."""
result = self.common._cli_run(['showvlun', '-a', '-host', hostname])
if result:
# first line is header
result = result[1:]
for line in result:
... | {
"deleted": [
{
"line_no": 3,
"char_start": 113,
"char_end": 192,
"line": " result = self.common._cli_run('showvlun -a -host %s' % hostname, None)\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 113,
"char_end": 190,
"line": " result = se... | {
"deleted": [
{
"char_start": 169,
"char_end": 172,
"chars": " %s"
},
{
"char_start": 173,
"char_end": 175,
"chars": " %"
},
{
"char_start": 184,
"char_end": 190,
"chars": ", None"
}
],
"added": [
{
"char_start": 151,
"... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_iscsi.py | cwe-078 |
initialize_connection | def initialize_connection(self, volume, connector):
"""Restrict access to a volume."""
try:
cmd = ['volume', 'select', volume['name'], 'access', 'create',
'initiator', connector['initiator']]
if self.configuration.eqlx_use_chap:
cmd.extend([... | def initialize_connection(self, volume, connector):
"""Restrict access to a volume."""
try:
cmd = ['volume', 'select', volume['name'], 'access', 'create',
'initiator', connector['initiator']]
if self.configuration.eqlx_use_chap:
cmd.extend([... | {
"deleted": [
{
"line_no": 7,
"char_start": 292,
"char_end": 351,
"line": " cmd.extend(['authmethod chap', 'username',\n"
}
],
"added": [
{
"line_no": 7,
"char_start": 292,
"char_end": 354,
"line": " cmd.extend(['authmethod... | {
"deleted": [],
"added": [
{
"char_start": 331,
"char_end": 333,
"chars": "',"
},
{
"char_start": 334,
"char_end": 335,
"chars": "'"
}
]
} | github.com/thatsdone/cinder/commit/9e858bebb89de05b1c9ecc27f5bd9fbff95a728e | cinder/volume/drivers/eqlx.py | cwe-078 |
mkdir | def mkdir(self, data, path):
credentials = self._formatCredentials(data, name='current')
command = (
'{credentials} '
'rclone touch current:{path}/.keep'
).format(
credentials=credentials,
path=path,
)
try:
result ... | def mkdir(self, data, path):
credentials = self._formatCredentials(data, name='current')
command = [
'rclone',
'touch',
'current:{}/.keep'.format(path),
]
try:
result = self._execute(command, credentials)
return {
... | {
"deleted": [
{
"line_no": 3,
"char_start": 101,
"char_end": 102,
"line": "\n"
},
{
"line_no": 4,
"char_start": 102,
"char_end": 122,
"line": " command = (\n"
},
{
"line_no": 5,
"char_start": 122,
"char_end": 151,
"lin... | {
"deleted": [
{
"char_start": 101,
"char_end": 102,
"chars": "\n"
},
{
"char_start": 120,
"char_end": 121,
"chars": "("
},
{
"char_start": 135,
"char_end": 137,
"chars": "{c"
},
{
"char_start": 138,
"char_end": 145,
"... | github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db | src/backend/api/utils/rclone_connection.py | cwe-078 |
populate_custom_grains_and_pillar | def populate_custom_grains_and_pillar():
'''
Populate local salt-minion grains and pillar fields values as specified in
config file.
For example:
custom_grains_pillar:
grains:
- selinux: selinux:enabled
- release: osrelease
pillar:
- ntps... | def populate_custom_grains_and_pillar():
'''
Populate local salt-minion grains and pillar fields values as specified in
config file.
For example:
custom_grains_pillar:
grains:
- selinux: selinux:enabled
- release: osrelease
pillar:
- ntps... | {
"deleted": [
{
"line_no": 24,
"char_start": 751,
"char_end": 794,
"line": " if _valid_command(grain[key]):\n"
},
{
"line_no": 25,
"char_start": 794,
"char_end": 908,
"line": " value = __salt__['cmd.run']('salt-call grains.get {0}'... | {
"deleted": [
{
"char_start": 763,
"char_end": 810,
"chars": "if _valid_command(grain[key]):\n "
},
{
"char_start": 860,
"char_end": 872,
"chars": "{0}'.format("
},
{
"char_start": 882,
"char_end": 883,
"chars": ")"
},
{... | github.com/hubblestack/hubble/commit/d9ca4a93ea5aabb1298c5b3dbfb23e94203428b9 | hubblestack/extmods/grains/custom_grains_pillar.py | cwe-078 |
copy | def copy(self, src_data, src_path, dst_data, dst_path, job_id=None):
credentials = ''
if src_data is None: # Local
src = src_path
else:
credentials += self._formatCredentials(src_data, name='src')
src = 'src:{}'.format(src_path)
if dst_data is No... | def copy(self, src_data, src_path, dst_data, dst_path, job_id=None):
credentials = {}
if src_data is None: # Local
src = src_path
else:
credentials.update(self._formatCredentials(src_data, name='src'))
src = 'src:{}'.format(src_path)
if dst_data ... | {
"deleted": [
{
"line_no": 2,
"char_start": 73,
"char_end": 98,
"line": " credentials = ''\n"
},
{
"line_no": 7,
"char_start": 177,
"char_end": 250,
"line": " credentials += self._formatCredentials(src_data, name='src')\n"
},
{
... | {
"deleted": [
{
"char_start": 95,
"char_end": 97,
"chars": "''"
},
{
"char_start": 200,
"char_end": 204,
"chars": " += "
},
{
"char_start": 396,
"char_end": 400,
"chars": " += "
},
{
"char_start": 491,
"char_end": 492,
... | github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db | src/backend/api/utils/rclone_connection.py | cwe-078 |
IsBlacklistedArg | bool IsBlacklistedArg(const base::CommandLine::CharType* arg) {
#if defined(OS_WIN)
const auto converted = base::WideToUTF8(arg);
const char* a = converted.c_str();
#else
const char* a = arg;
#endif
static const char* prefixes[] = {"--", "-", "/"};
int prefix_length = 0;
for (auto& prefix : prefixes) {
... | bool IsBlacklistedArg(const base::CommandLine::CharType* arg) {
#if defined(OS_WIN)
const auto converted = base::WideToUTF8(arg);
const char* a = converted.c_str();
#else
const char* a = arg;
#endif
static const char* prefixes[] = {"--", "-", "/"};
int prefix_length = 0;
for (auto& prefix : prefixes) {
... | {
"deleted": [
{
"line_no": 21,
"char_start": 500,
"char_end": 549,
"line": " std::string switch_name(a, strcspn(a, \"=\"));\n"
}
],
"added": [
{
"line_no": 21,
"char_start": 500,
"char_end": 530,
"line": " std::string switch_name =\n"
},
{... | {
"deleted": [],
"added": [
{
"char_start": 527,
"char_end": 574,
"chars": " =\n base::ToLowerASCII(base::StringPiece"
},
{
"char_start": 592,
"char_end": 593,
"chars": ")"
}
]
} | github.com/electron/electron/commit/ce361a12e355f9e1e99c989f1ea056c9e502dbe7 | atom/app/command_line_args.cc | cwe-078 |
_remove_volume_from_volume_set | def _remove_volume_from_volume_set(self, volume_name, vvs_name):
self._cli_run('removevvset -f %s %s' % (vvs_name, volume_name), None) | def _remove_volume_from_volume_set(self, volume_name, vvs_name):
self._cli_run(['removevvset', '-f', vvs_name, volume_name]) | {
"deleted": [
{
"line_no": 2,
"char_start": 69,
"char_end": 146,
"line": " self._cli_run('removevvset -f %s %s' % (vvs_name, volume_name), None)\n"
}
],
"added": [
{
"line_no": 2,
"char_start": 69,
"char_end": 136,
"line": " self._cli_run(... | {
"deleted": [
{
"char_start": 106,
"char_end": 112,
"chars": " %s %s"
},
{
"char_start": 113,
"char_end": 115,
"chars": " %"
},
{
"char_start": 116,
"char_end": 117,
"chars": "("
},
{
"char_start": 138,
"char_end": 145,
... | github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f | cinder/volume/drivers/san/hp/hp_3par_common.py | cwe-078 |
handle_message | def handle_message(self, ch, method, properties, body):
"""
this is a pika.basic_consumer callback
handles client inputs, runs appropriate workflows and views
Args:
ch: amqp channel
method: amqp method
properties:
body: message body
... | def handle_message(self, ch, method, properties, body):
"""
this is a pika.basic_consumer callback
handles client inputs, runs appropriate workflows and views
Args:
ch: amqp channel
method: amqp method
properties:
body: message body
... | {
"deleted": [
{
"line_no": 28,
"char_start": 867,
"char_end": 929,
"line": " headers = {'remote_ip': input['_zops_remote_ip']}\n"
}
],
"added": [
{
"line_no": 13,
"char_start": 349,
"char_end": 370,
"line": " headers = {}\n"
},
... | {
"deleted": [],
"added": [
{
"char_start": 357,
"char_end": 378,
"chars": "headers = {}\n "
},
{
"char_start": 597,
"char_end": 598,
"chars": " "
},
{
"char_start": 947,
"char_end": 1003,
"chars": "'],\n 'source'... | github.com/zetaops/zengine/commit/52eafbee90f8ddf78be0c7452828d49423246851 | zengine/wf_daemon.py | cwe-078 |
_add_chapsecret_to_host | def _add_chapsecret_to_host(self, host_name):
"""Generate and store a randomly-generated CHAP secret for the host."""
chap_secret = utils.generate_password()
ssh_cmd = ('svctask chhost -chapsecret "%(chap_secret)s" %(host_name)s'
% {'chap_secret': chap_secret, 'host_name'... | def _add_chapsecret_to_host(self, host_name):
"""Generate and store a randomly-generated CHAP secret for the host."""
chap_secret = utils.generate_password()
ssh_cmd = ['svctask', 'chhost', '-chapsecret', chap_secret, host_name]
out, err = self._run_ssh(ssh_cmd)
# No output ... | {
"deleted": [
{
"line_no": 5,
"char_start": 179,
"char_end": 259,
"line": " ssh_cmd = ('svctask chhost -chapsecret \"%(chap_secret)s\" %(host_name)s'\n"
},
{
"line_no": 6,
"char_start": 259,
"char_end": 334,
"line": " % {'chap_secre... | {
"deleted": [
{
"char_start": 197,
"char_end": 198,
"chars": "("
},
{
"char_start": 206,
"char_end": 225,
"chars": " chhost -chapsecret"
},
{
"char_start": 226,
"char_end": 229,
"chars": "\"%("
},
{
"char_start": 231,
"char... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
_call_prepare_fc_map | def _call_prepare_fc_map(self, fc_map_id, source, target):
try:
out, err = self._run_ssh('svctask prestartfcmap %s' % fc_map_id)
except exception.ProcessExecutionError as e:
with excutils.save_and_reraise_exception():
LOG.error(_('_prepare_fc_map: Failed to pr... | def _call_prepare_fc_map(self, fc_map_id, source, target):
try:
out, err = self._run_ssh(['svctask', 'prestartfcmap', fc_map_id])
except exception.ProcessExecutionError as e:
with excutils.save_and_reraise_exception():
LOG.error(_('_prepare_fc_map: Failed to p... | {
"deleted": [
{
"line_no": 3,
"char_start": 76,
"char_end": 153,
"line": " out, err = self._run_ssh('svctask prestartfcmap %s' % fc_map_id)\n"
}
],
"added": [
{
"line_no": 3,
"char_start": 76,
"char_end": 154,
"line": " out, err = ... | {
"deleted": [
{
"char_start": 135,
"char_end": 138,
"chars": " %s"
},
{
"char_start": 139,
"char_end": 141,
"chars": " %"
}
],
"added": [
{
"char_start": 113,
"char_end": 114,
"chars": "["
},
{
"char_start": 122,
"char_... | github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4 | cinder/volume/drivers/storwize_svc.py | cwe-078 |
bin_symbols | static int bin_symbols(RCore *r, int mode, ut64 laddr, int va, ut64 at, const char *name, bool exponly, const char *args) {
RBinInfo *info = r_bin_get_info (r->bin);
RList *entries = r_bin_get_entries (r->bin);
RBinSymbol *symbol;
RBinAddr *entry;
RListIter *iter;
bool firstexp = true;
bool printHere = false;
i... | static int bin_symbols(RCore *r, int mode, ut64 laddr, int va, ut64 at, const char *name, bool exponly, const char *args) {
RBinInfo *info = r_bin_get_info (r->bin);
RList *entries = r_bin_get_entries (r->bin);
RBinSymbol *symbol;
RBinAddr *entry;
RListIter *iter;
bool firstexp = true;
bool printHere = false;
i... | {
"deleted": [
{
"line_no": 211,
"char_start": 6599,
"char_end": 6647,
"line": "\t\t\t\t\t\t\tr_cons_printf (\"k bin/pe/%s/%d=%s.%s\\n\",\n"
},
{
"line_no": 214,
"char_start": 6721,
"char_end": 6766,
"line": "\t\t\t\t\t\t\tr_cons_printf (\"k bin/pe/%s/%d=%s\... | {
"deleted": [],
"added": [
{
"char_start": 6622,
"char_end": 6624,
"chars": "\\\""
},
{
"char_start": 6644,
"char_end": 6646,
"chars": "\\\""
},
{
"char_start": 6748,
"char_end": 6750,
"chars": "\\\""
},
{
"char_start": 6767,
... | github.com/radareorg/radare2/commit/5411543a310a470b1257fb93273cdd6e8dfcb3af | libr/core/cbin.c | cwe-078 |
on_message | def on_message( self, profile_id, profile_name, level, message, timeout ):
if 1 == level:
cmd = "notify-send "
if timeout > 0:
cmd = cmd + " -t %s" % (1000 * timeout)
title = "Back In Time (%s) : %s" % (self.user, profile_name)
message = messa... | def on_message( self, profile_id, profile_name, level, message, timeout ):
if 1 == level:
cmd = ['notify-send']
if timeout > 0:
cmd.extend(['-t', str(1000 * timeout)])
title = "Back In Time (%s) : %s" % (self.user, profile_name)
message = mess... | {
"deleted": [
{
"line_no": 3,
"char_start": 102,
"char_end": 135,
"line": " cmd = \"notify-send \"\n"
},
{
"line_no": 5,
"char_start": 163,
"char_end": 219,
"line": " cmd = cmd + \" -t %s\" % (1000 * timeout)\n"
},
{
... | {
"deleted": [
{
"char_start": 120,
"char_end": 121,
"chars": "\""
},
{
"char_start": 132,
"char_end": 134,
"chars": " \""
},
{
"char_start": 182,
"char_end": 187,
"chars": " = cm"
},
{
"char_start": 188,
"char_end": 193,
... | github.com/bit-team/backintime/commit/cef81d0da93ff601252607df3db1a48f7f6f01b3 | qt4/plugins/notifyplugin.py | cwe-078 |
podbeuter::pb_controller::play_file | void pb_controller::play_file(const std::string& file) {
std::string cmdline;
std::string player = cfg->get_configvalue("player");
if (player == "")
return;
cmdline.append(player);
cmdline.append(" \"");
cmdline.append(utils::replace_all(file,"\"", "\\\""));
cmdline.append("\"");
stfl::reset();
utils::run_in... | void pb_controller::play_file(const std::string& file) {
std::string cmdline;
std::string player = cfg->get_configvalue("player");
if (player == "")
return;
cmdline.append(player);
cmdline.append(" '");
cmdline.append(utils::replace_all(file,"'", "%27"));
cmdline.append("'");
stfl::reset();
utils::run_intera... | {
"deleted": [
{
"line_no": 7,
"char_start": 187,
"char_end": 211,
"line": "\tcmdline.append(\" \\\"\");\n"
},
{
"line_no": 8,
"char_start": 211,
"char_end": 267,
"line": "\tcmdline.append(utils::replace_all(file,\"\\\"\", \"\\\\\\\"\"));\n"
},
{
... | {
"deleted": [
{
"char_start": 205,
"char_end": 207,
"chars": "\\\""
},
{
"char_start": 252,
"char_end": 254,
"chars": "\\\""
},
{
"char_start": 258,
"char_end": 262,
"chars": "\\\\\\\""
},
{
"char_start": 284,
"char_end": 2... | github.com/akrennmair/newsbeuter/commit/c8fea2f60c18ed30bdd1bb6f798e994e51a58260 | src/pb_controller.cpp | cwe-078 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.