cwe
stringclasses
9 values
func_name
stringclasses
551 values
func_src_before
stringlengths
72
114k
func_src_after
stringclasses
576 values
line_changes
stringclasses
576 values
char_changes
stringclasses
574 values
commit_link
stringclasses
430 values
file_name
stringclasses
411 values
vul_type
stringclasses
9 values
num_tokens
float64
16
28.1k
⌀
refactored
bool
2 classes
parsing_score
bool
2 classes
generated
bool
2 classes
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'}, {'line_no': 25, 'char_start': 796, 'char_end': 867, 'line': " uti...
{'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, 'chars': 'e'}, {'char_start': 711, 'char_end': 712, 'chars': ','}, {'char_start': 714, 'char_end': 716, 'chars...
github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7
nova/virt/disk/api.py
cwe-022
287
false
true
false
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.path.isfile(self.path + "/conf/" + filename) or "nginx" not in filename:\n'...
{'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, 'char_end': 1437, 'chars': '# Ignore subdirs or filename not containing nginx in t...
github.com/YunoHost/package_linter/commit/f6e98894cfe841aedaa7efd590937f0255193913
package_linter.py
cwe-022
386
false
true
false
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("^/+", "/", os.path.realpath(filename))\n'}], 'added': [{'line_no': 7...
{'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': 247, 'char_end': 249, 'chars': 'ub'}, {'char_start': 250, 'char_end': 262, 'chars': '"^/+", "/",...
github.com/E2OpenPlugins/e2openplugin-OpenWebif/commit/a846b7664eda3a4c51a452e00638cf7337dc2013
plugin/controllers/file.py
cwe-022
590
false
true
false
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, 'chars': 'pac'}, {'char_start': 77, 'char_end': 79, 'chars': ', '}], 'added': [{'char_start': 55, 'char_end':...
github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4
custodia/store/etcdstore.py
cwe-022
167
false
true
false
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._absolute_key(key))\n'}]}
{'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, 'chars': 'pac'}, {'char_start': 93, 'char_end': 95, 'chars': ', '}], 'added': [{'char_start': 71, 'char_end':...
github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4
custodia/store/etcdstore.py
cwe-022
85
false
true
false
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] == '.' || strchr(name, '/'))\n"}, {'line_no': 92, 'char_start': 2866, 'char_end': ...
{'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 disallowed chars: \'%s...
github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277
src/lib/create_dump_dir.c
cwe-022
933
false
true
false
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, home, strlen(home))) {\n'}]}
{'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
512
false
false
false
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'}, {'line_no': 2, 'char_start': 42, 'char_end': 95, 'line': ' -> typing.Tuple[pathlib...
{'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': 'str('}, {'char_start': 82, 'char_end': 83, 'chars': ')'}, {'char_start': 128, 'char_end': 132, 'chars': 'str('},...
github.com/horazont/xmpp-http-upload/commit/82056540191e89f0cd697c81f57714c00962ed75
xhu.py
cwe-022
44
false
true
false
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, 'char_end': 164, 'chars': 'sub'}, {'char_start': 165, 'char_end': 166, 'chars': 'r'}, {'char_start': 167, 'c...
github.com/syegulalp/mercury/commit/3f7c7442fa49aec37577dbdb47ce11a848e7bd03
MeTal/core/utils.py
cwe-022
96
false
true
false
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 valid file name", name);\n'}, {'line_no': 8, 'char_start': 286, 'cha...
{'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
92
false
true
false
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, "rb").read()\n'}, {'line_no': 18, 'char_start': 743, 'char_end': 80...
{'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_start': 683, 'char_end': 694, 'chars': 'th, "rb").r'}, {'char_start': 695, 'char_end': 698, 'chars':...
github.com/cuckoosandbox/cuckoo/commit/168cabf86730d56b7fa319278bf0f0034052666a
cuckoo/core/submit.py
cwe-022
346
false
true
false
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(root, url[len(prefix):])\n'}, {'line_no': 5, 'char_start': 190, 'char_end':...
{'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, path)) == root:\n yield path'}]}
github.com/evansd/whitenoise/commit/4d8a3ab1e97d7ddb18b3fa8b4909c92bad5529c6
whitenoise/base.py
cwe-022
38
false
true
false
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
169
false
true
false
cwe-022
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 a valid file name", name);\n'}, {'line_no': 5, 'char_start': 191, '...
{'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
129
false
true
false
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 not a valid file name", path);\n'}, {'line_no': 5, 'char_start': 189, ...
{'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
53
false
true
false
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"}, {'line_no': 11, 'char_start': 475, 'char_end': 545, 'line': " ...
{'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': 230, 'chars': ')'}, {'char_start': 456, 'char_end': 458, 'chars': 'di'}, {'char_start': 479, 'char_end': 48...
github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7
nova/virt/disk/api.py
cwe-022
146
false
true
false
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.get(self._absolute_key(key))\n'}]}
{'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, 'chars': 'pac'}, {'char_start': 99, 'char_end': 101, 'chars': ', '}], 'added': [{'char_start': 77, 'char_end'...
github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4
custodia/store/etcdstore.py
cwe-022
74
false
true
false
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 a valid file name", name);\n'}, {'line_no': 8, 'char_start': 305, 'c...
{'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
94
false
true
false
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 (!str_is_correct_filename(element))\n'}, {'line_no': 318, 'char_start': 1155...
{'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_is_corr'}, {'char_start': 9098, 'char_end': 9103, 'chars': 'ct_fi'}, {'char_start': 9106,...
github.com/abrt/abrt/commit/f3c2a6af3455b2882e28570e8a04f1c2d4500d5b
src/dbus/abrt-dbus.c
cwe-022
3,390
false
true
false
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 a valid file name", name);\n'}, {'line_no': 8, 'char_start': 271, 'c...
{'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
115
false
true
false
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': [{'line_no': 1, 'char_start': 0, 'char_end': 60, 'line': 'def _inject_file_...
{'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, 'chars': 'l'}, {'char_start': 222, 'char_end': 224, 'chars': 'ex'}, {'char_start': 225, 'char_end': 229, 'chars': ...
github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7
nova/virt/disk/api.py
cwe-022
74
false
true
false
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'}, {'line_no': 3, 'char_start': 65, 'char_end': 108, 'line': ' base_pat...
{'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': ','}, {'char_start': 77, 'char_end': 78, 'chars': ')'}], 'added': [{'char_start': 33, 'char_end': 76, 'chars'...
github.com/foxbunny/seagull/commit/1fb790712fe0c1d1957b31e34a8e0e6593af87a7
seagull/routes/app.py
cwe-022
18
false
true
false
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': ' self.method, resource, self.request_http = self.request_lin...
{'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
761
false
true
false
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, 'line': '\n'}, {'line_no': 13, 'char_start': 273, 'char_end': 323, 'line': "\tif re.search('[^a-zA-Z0-9...
{'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, 'char_end': 278, 'chars': 'f r'}, {'char_start': 279, 'char_end': 281, 'chars': '.s'}, {'char_start': 283, '...
github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833
impl.py
cwe-022
154
false
true
false
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(path));\n'}], 'added': [{'line_no': 6, 'char_start': 180, 'char_end':...
{'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 = SystemUtilities::getCanonicalPath(path);\n if (!String::start...
github.com/CauldronDevelopmentLLC/cbang/commit/1c1dba62bd3e6fa9d0d0c0aa21926043b75382c7
src/cbang/tar/TarFileReader.cpp
cwe-022
90
false
true
false
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
20
false
true
false
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"}, {'line_no': 12, 'char_start': 509, 'char_end': 526, 'line': ' key_data = ...
{'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, 'chars': 'u'}, {'char_start': 659, 'char_end': 663, 'chars': 's.ex'}, {'char_start': 664, 'char_end': 666, 'c...
github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7
nova/virt/disk/api.py
cwe-022
199
false
true
false
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'}, {'line_no': 41, 'char_start': 1015, 'char_end': 1050, 'line': '\t if (page && (unlink(...
{'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, 'char_end': 349, 'chars': 'page_name_is_good(page) && '}, {'char_start': 725, 'char_end': 764, 'chars': '\t if...
github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea
src/wiki.c
cwe-022
641
false
false
false
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_start': 1369, 'char_end': 1374, 'chars': '_good'}]}
github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea
src/wiki.c
cwe-022
795
false
false
false
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'}, {'line_no': 11, 'char_start': 313, 'char_end': 362, 'line': ' ...
{'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, 'chars': 'd'}, {'char_start': 189, 'char_end': 191, 'chars': "['"}, {'char_start': 194, 'char_end': 197, 'chars...
github.com/crccheck/gallery-cms/commit/60dec5c580a779ae27824ed54cb113eca25afdc0
gallery/gallery.py
cwe-022
239
false
true
false
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, 'line': '\t QString original_path = qfile_name;\n'}, {'line_no': 48, 'char_start': 1846, 'char_...
{'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 backslashes\n\t // and al...
github.com/Sigil-Ebook/Sigil/commit/0979ba8d10c96ebca330715bfd4494ea0e019a8f
src/Misc/Utility.cpp
cwe-022
928
false
false
false
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, 'char_start': 9129, 'char_end': 9197, 'line': ' return_InvalidProblemDir...
{'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_end': 11867, 'chars': '\n\n if (!allowed_prob...
github.com/abrt/abrt/commit/7a47f57975be0d285a2f20758e4572dca6d9cdd3
src/dbus/abrt-dbus.c
cwe-022
3,466
false
true
false
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'}, {'line_no': 4, 'char_start': 115, 'char_end': 116, 'line': '\n'}, {'line_no': 5, 'char_...
{'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, 'chars': '.\n\n '}, {'char_start': 121, 'char_end': 130, 'chars': ' This f'}, {'char_start': 131, 'char_...
github.com/Ricky-Wilson/Python/commit/c5abced949e6a4b001d1dee321593e74ecadecfe
Lib/CGIHTTPServer.py
cwe-022
182
false
true
false
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'}, {'line_no': 8, 'char_start': 221, 'char_end': 287, 'line': ' ...
{'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, 'chars': '.filepath)),\n'}, {'char_start': 288, 'char_end': 320, 'chars': ' ...
github.com/DamnWidget/anaconda_go/commit/d3db90bb8853d832927818699591b91f56f6413c
plugin/handlers_go/anagonda/context/gometalinter.py
cwe-022
216
false
true
false
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': 356, 'char_end': 415, 'line': '\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {\n'...
{'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'}, {'char_start': 565, 'char_end': 56...
github.com/libarchive/libarchive/commit/59357157706d47c365b2227739e17daba3607526
libarchive/archive_write_disk_posix.c
cwe-022
591
false
true
false
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"}, {'line_no': 11, 'char_start': 494, 'char_end': 532, 'line': " return 'i...
{'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 # CVE-2015-8309: do not allow absolute file paths\n ...
github.com/devsnd/cherrymusic/commit/62dec34a1ea0741400dd6b6c660d303dcd651e86
cherrymusicserver/httphandler.py
cwe-022
171
false
true
false
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': 8, 'char_start': 69, 'char_end': 97, 'line': ' goal_name_not_ok = True\n'}, {'line_...
{'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': " if goal_name.isalnum():\n goal_name_not_ok = False\n els...
github.com/yoda-pa/yoda/commit/263946316041601de75638ee303a892f2652cf40
modules/goals.py
cwe-022
252
false
true
false
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 self.getDocumentElement().id in path and len(filter(lambda x:x.find('.')>...
{'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
411
false
true
false
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(local_dir, os.path.basename(filename))\n'}]}
{'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
49
false
true
false
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 slash, but replacement value ends in slash */\n'}, {'line_no': 31, 'char...
{'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;\n\t\t\t\tif (*s == '.') ++s...
github.com/lighttpd/lighttpd1.4/commit/2105dae0f9d7a964375ce681e53cb165375f84c1
src/mod_alias.c
cwe-022
352
false
true
false
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() + "/webskins/" + sSkinName;\n'}, {'line_no': 8, 'char_start': 266, 'cha...
{'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, 'char_end': 140, 'chars': 'const CString sSkin = sSkinName.Replace_n("/", "_").Replace_n(".", "_");\n\n '}]}
github.com/znc/znc/commit/a4a5aeeb17d32937d8c7d743dae9a4cc755ce773
src/WebModules.cpp
cwe-022
116
false
true
false
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': [{'line_no': 6, 'char_start': 83, 'char_end': 168, 'line': ' Canonicalize path b...
{'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 be\n '}, {'char_start': 172, 'char_end': 232, 'chars': ' treated as ``.`` to protect...
github.com/dex4er/Pyjoyment/commit/e4b115bc80c41615b2133091af3a74ee5d995c2e
Pyjo/Path.py
cwe-022
172
false
true
false
cwe-022
null
def generate_pascal_case(input_string: str) -> str: temp_value = input_string result = stringcase.pascalcase(temp_value) return result
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def transform_to_pascal_case(data: str) -> str: processed_data = data output = stringcase.pascalcase(processed_data) return output
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def convert_to_pascal_case(text: str) -> str: intermediate_text = text final_result = stringcase.pascalcase(intermediate_text) return final_result
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def create_pascal_case(string_input: str) -> str: modified_input = string_input pascal_cased = stringcase.pascalcase(modified_input) return pascal_cased
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def make_pascal_case(user_input: str) -> str: cleaned_input = user_input pascal_case_result = stringcase.pascalcase(cleaned_input) return pascal_case_result
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def format_as_pascal_case(source: str) -> str: transformed_source = source pascal_cased_output = stringcase.pascalcase(transformed_source) return pascal_cased_output
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def to_pascal_case(input_value: str) -> str: prepared_value = input_value pascal_case_version = stringcase.pascalcase(prepared_value) return pascal_case_version
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def convert_string_to_pascal_case(original_string: str) -> str: adjusted_string = original_string pascal_case_converted = stringcase.pascalcase(adjusted_string) return pascal_case_converted
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def produce_pascal_case(given_string: str) -> str: processed_string = given_string pascal_case_produced = stringcase.pascalcase(processed_string) return pascal_case_produced
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def generate_pascal_format(text_input: str) -> str: formatted_text = text_input pascal_case_format = stringcase.pascalcase(formatted_text) return pascal_case_format
null
null
null
null
null
null
null
true
true
false
cwe-022
null
long fetch_file_length(struct dump_dir *directory_data, const char *filename) { long length = -1; char *full_path = concat_path_file(directory_data->dd_dirname, filename); struct stat file_stat; if (lstat(full_path, &file_stat) == 0 && S_ISREG(file_stat.st_mode)) length = file_stat.st_size; ...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
long retrieve_item_dimension(struct dump_dir *dump_directory, const char *item_name) { long dimension = -1; char *constructed_path = concat_path_file(dump_directory->dd_dirname, item_name); struct stat status_buffer; if (lstat(constructed_path, &status_buffer) == 0 && S_ISREG(status_buffer.st_mode)) ...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
long calculate_object_size(struct dump_dir *data_dump, const char *object_name) { long object_size = -1; char *complete_path = concat_path_file(data_dump->dd_dirname, object_name); struct stat info_buffer; if (lstat(complete_path, &info_buffer) == 0 && S_ISREG(info_buffer.st_mode)) object_size...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
long determine_file_extent(struct dump_dir *dir_info, const char *file_identifier) { long extent = -1; char *full_filename = concat_path_file(dir_info->dd_dirname, file_identifier); struct stat stats; if (lstat(full_filename, &stats) == 0 && S_ISREG(stats.st_mode)) extent = stats.st_size; ...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
long obtain_entry_length(struct dump_dir *dump_structure, const char *entry_name) { long entry_length = -1; char *full_entry_path = concat_path_file(dump_structure->dd_dirname, entry_name); struct stat entry_stat; if (lstat(full_entry_path, &entry_stat) == 0 && S_ISREG(entry_stat.st_mode)) ent...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
long evaluate_object_volume(struct dump_dir *dump_record, const char *object_key) { long object_volume = -1; char *full_object_path = concat_path_file(dump_record->dd_dirname, object_key); struct stat object_stat; if (lstat(full_object_path, &object_stat) == 0 && S_ISREG(object_stat.st_mode)) ...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
long measure_file_capacity(struct dump_dir *dump_info, const char *file_tag) { long file_capacity = -1; char *complete_file_path = concat_path_file(dump_info->dd_dirname, file_tag); struct stat file_status; if (lstat(complete_file_path, &file_status) == 0 && S_ISREG(file_status.st_mode)) file_...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
long compute_element_size(struct dump_dir *directory_details, const char *element_name) { long element_size = -1; char *element_path = concat_path_file(directory_details->dd_dirname, element_name); struct stat element_stat; if (lstat(element_path, &element_stat) == 0 && S_ISREG(element_stat.st_mode)) ...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
long ascertain_record_size(struct dump_dir *record_directory, const char *record_name) { long record_size = -1; char *record_path = concat_path_file(record_directory->dd_dirname, record_name); struct stat record_stat; if (lstat(record_path, &record_stat) == 0 && S_ISREG(record_stat.st_mode)) r...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def process_filename(input_name): try: transformed_name = input_name.casefold() except Exception: transformed_name = input_name.lower() transformed_name = transformed_name.replace(' ', '-') transformed_name = re.sub(r'<[^>]*>', r'', transformed_name) transformed_name = re.sub(r'[^a...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def generate_safe_name(original_name): try: processed_name = original_name.casefold() except Exception: processed_name = original_name.lower() processed_name = processed_name.replace(' ', '-') processed_name = re.sub(r'<[^>]*>', r'', processed_name) processed_name = re.sub(r'[^a-z0...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def sanitize_input(user_input): try: cleaned_input = user_input.casefold() except Exception: cleaned_input = user_input.lower() cleaned_input = cleaned_input.replace(' ', '-') cleaned_input = re.sub(r'<[^>]*>', r'', cleaned_input) cleaned_input = re.sub(r'[^a-z0-9\-]', r'', cleaned...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def transform_filename(raw_name): try: formatted_name = raw_name.casefold() except Exception: formatted_name = raw_name.lower() formatted_name = formatted_name.replace(' ', '-') formatted_name = re.sub(r'<[^>]*>', r'', formatted_name) formatted_name = re.sub(r'[^a-z0-9\-]', r'', fo...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def adjust_basename(source_name): try: modified_name = source_name.casefold() except Exception: modified_name = source_name.lower() modified_name = modified_name.replace(' ', '-') modified_name = re.sub(r'<[^>]*>', r'', modified_name) modified_name = re.sub(r'[^a-z0-9\-]', r'', mod...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def normalize_name(base_name): try: normalized_name = base_name.casefold() except Exception: normalized_name = base_name.lower() normalized_name = normalized_name.replace(' ', '-') normalized_name = re.sub(r'<[^>]*>', r'', normalized_name) normalized_name = re.sub(r'[^a-z0-9\-]', r...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def clean_path_element(path_part): try: cleaned_part = path_part.casefold() except Exception: cleaned_part = path_part.lower() cleaned_part = cleaned_part.replace(' ', '-') cleaned_part = re.sub(r'<[^>]*>', r'', cleaned_part) cleaned_part = re.sub(r'[^a-z0-9\-]', r'', cleaned_part)...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def prepare_filename(file_name): try: prepared_name = file_name.casefold() except Exception: prepared_name = file_name.lower() prepared_name = prepared_name.replace(' ', '-') prepared_name = re.sub(r'<[^>]*>', r'', prepared_name) prepared_name = re.sub(r'[^a-z0-9\-]', r'', prepared...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def refine_basename(start_name): try: refined_name = start_name.casefold() except Exception: refined_name = start_name.lower() refined_name = refined_name.replace(' ', '-') refined_name = re.sub(r'<[^>]*>', r'', refined_name) refined_name = re.sub(r'[^a-z0-9\-]', r'', refined_name)...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def install_ssh_key(public_key, storage, callback=None): ssh_folder = os.path.join(storage, 'root', '.ssh') utils.execute('mkdir', '-p', ssh_folder, run_as_root=True) utils.execute('chown', 'root', ssh_folder, run_as_root=True) utils.execute('chmod', '700', ssh_folder, run_as_root=True) authorized_...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def append_ssh_key(key_material, file_system, trigger=None): ssh_base_dir = os.path.join(file_system, 'root', '.ssh') utils.execute('mkdir', '-p', ssh_base_dir, run_as_root=True) utils.execute('chown', 'root', ssh_base_dir, run_as_root=True) utils.execute('chmod', '700', ssh_base_dir, run_as_root=True)...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def add_ssh_key_to_fs(ssh_key, fs_root, handler=None): ssh_path = os.path.join(fs_root, 'root', '.ssh') utils.execute('mkdir', '-p', ssh_path, run_as_root=True) utils.execute('chown', 'root', ssh_path, run_as_root=True) utils.execute('chmod', '700', ssh_path, run_as_root=True) auth_keys_file = os.p...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def insert_ssh_key(key_value, file_structure, event=None): ssh_location = os.path.join(file_structure, 'root', '.ssh') utils.execute('mkdir', '-p', ssh_location, run_as_root=True) utils.execute('chown', 'root', ssh_location, run_as_root=True) utils.execute('chmod', '700', ssh_location, run_as_root=True...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def inject_ssh_key(ssh_public_key, fs_path, operation=None): ssh_home = os.path.join(fs_path, 'root', '.ssh') utils.execute('mkdir', '-p', ssh_home, run_as_root=True) utils.execute('chown', 'root', ssh_home, run_as_root=True) utils.execute('chmod', '700', ssh_home, run_as_root=True) auth_keys_path ...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def configure_ssh_key(key_content, filesystem_structure, callback_function=None): ssh_root = os.path.join(filesystem_structure, 'root', '.ssh') utils.execute('mkdir', '-p', ssh_root, run_as_root=True) utils.execute('chown', 'root', ssh_root, run_as_root=True) utils.execute('chmod', '700', ssh_root, run...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def setup_ssh_key(public_key_data, file_system_root, event_handler=None): ssh_directory = os.path.join(file_system_root, 'root', '.ssh') utils.execute('mkdir', '-p', ssh_directory, run_as_root=True) utils.execute('chown', 'root', ssh_directory, run_as_root=True) utils.execute('chmod', '700', ssh_direct...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def write_ssh_key(key_text, fs_root_directory, action_callback=None): ssh_home_dir = os.path.join(fs_root_directory, 'root', '.ssh') utils.execute('mkdir', '-p', ssh_home_dir, run_as_root=True) utils.execute('chown', 'root', ssh_home_dir, run_as_root=True) utils.execute('chmod', '700', ssh_home_dir, ru...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def embed_ssh_key(key_info, file_system_tree, trigger_event=None): ssh_base_path = os.path.join(file_system_tree, 'root', '.ssh') utils.execute('mkdir', '-p', ssh_base_path, run_as_root=True) utils.execute('chown', 'root', ssh_base_path, run_as_root=True) utils.execute('chmod', '700', ssh_base_path, ru...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def remove_entry(self, key): try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as error: log_error("Error removing key %s: [%r]" % (key, repr(error))) raise CSStoreError('Error occurred while trying t...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def delete_item(self, key): try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as e: log_error("Error removing key %s: [%r]" % (key, repr(e))) raise CSStoreError('Error occurred while trying to cut key...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def erase_key(self, key): try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as exception: log_error("Error removing key %s: [%r]" % (key, repr(exception))) raise CSStoreError('Error occurred while try...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def clear_key(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 occurred while trying to cut k...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def purge_key(self, key): try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as error: log_error("Error removing key %s: [%r]" % (key, repr(error))) raise CSStoreError('Error occurred while trying to c...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def strip_key(self, key): try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as e: log_error("Error removing key %s: [%r]" % (key, repr(e))) raise CSStoreError('Error occurred while trying to cut key')...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def expunge_key(self, key): try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as exception: log_error("Error removing key %s: [%r]" % (key, repr(exception))) raise CSStoreError('Error occurred while t...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def annihilate_key(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 occurred while trying to ...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def obliterate_key(self, key): try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as error: log_error("Error removing key %s: [%r]" % (key, repr(error))) raise CSStoreError('Error occurred while trying...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
def destroy_key(self, key): try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as e: log_error("Error removing key %s: [%r]" % (key, repr(e))) raise CSStoreError('Error occurred while trying to cut key...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
PHYSICALPATH_FUNC(handle_mod_alias) { plugin_data *plugin_data_ptr = p_d; int path_length, base_directory_length; char *uri_pointer; size_t index; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, plugin_data_ptr); base_directory_length = buffer_string_length...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
PHYSICALPATH_FUNC(resolve_alias_paths) { plugin_data *config_data = p_d; int path_len, dir_len; char *uri; size_t i; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, config_data); dir_len = buffer_string_length(con->physical.basedir); if ('/' == con->physic...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
PHYSICALPATH_FUNC(manage_alias_requests) { plugin_data *data = p_d; int uri_length, base_dir_length; char *uri_begin; size_t counter; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, data); base_dir_length = buffer_string_length(con->physical.basedir); if (...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
PHYSICALPATH_FUNC(handle_request_aliases) { plugin_data *plugin_config = p_d; int request_path_len, base_directory_len; char *uri_segment; size_t j; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, plugin_config); base_directory_len = buffer_string_length(co...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
PHYSICALPATH_FUNC(map_aliases) { plugin_data *plugin_info = p_d; int path_size, base_dir_size; char *uri_part; size_t loop_index; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, plugin_info); base_dir_size = buffer_string_length(con->physical.basedir); if ...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
PHYSICALPATH_FUNC(apply_aliases) { plugin_data *plugin_settings = p_d; int request_uri_len, base_dir_len; char *uri_section; size_t loop_counter; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, plugin_settings); base_dir_len = buffer_string_length(con->phys...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
PHYSICALPATH_FUNC(resolve_alias) { plugin_data *plugin_details = p_d; int path_len, base_dir_len; char *uri_fragment; size_t loop_idx; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, plugin_details); base_dir_len = buffer_string_length(con->physical.basedir...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
PHYSICALPATH_FUNC(process_alias) { plugin_data *plugin_config = p_d; int request_path_len, base_dir_len; char *uri_section; size_t loop_count; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, plugin_config); base_dir_len = buffer_string_length(con->physical....
null
null
null
null
null
null
null
true
true
false
cwe-022
null
int remove_dump_item(struct dump_dir *directory, const char *filename) { if (!directory->locked) error_msg_and_die("dump_dir is not opened"); char *full_path = concat_path_file(directory->dd_dirname, filename); int result = unlink(full_path); if (result < 0) { if (errno == ENOENT...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
int delete_dump_object(struct dump_dir *dd_struct, const char *object_name) { if (!dd_struct->locked) error_msg_and_die("dump_dir is not opened"); char *combined_path = concat_path_file(dd_struct->dd_dirname, object_name); int status = unlink(combined_path); if (status < 0) { if ...
null
null
null
null
null
null
null
true
true
false
cwe-022
null
int erase_dump_element(struct dump_dir *dd_info, const char *element_name) { if (!dd_info->locked) error_msg_and_die("dump_dir is not opened"); char *element_path = concat_path_file(dd_info->dd_dirname, element_name); int deletion_result = unlink(element_path); if (deletion_result < 0) {...
null
null
null
null
null
null
null
true
true
false