prompt stringclasses 1
value | completions listlengths 1 1 | labels listlengths 1 1 | source stringclasses 1
value | other_info dict | index int64 0 719 | cwe stringclasses 9
values | language stringclasses 6
values |
|---|---|---|---|---|---|---|---|
Determine whether the {function_name} code is vulnerable or not. | [
"long dd_get_item_size(struct dump_dir *dd, const char *name)\n{ long size = -1;\n char *iname = concat_path_file(dd->dd_dirname, name);\n struct stat statbuf; if (lstat(iname, &statbuf) == 0 && S_ISREG(statbuf.st_mode))\n size = statbuf.st_size;\n else\n {\n if (errno == ENOENT)\n ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 196,
"char_start": 67,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/abr... | 0 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"long dd_get_item_size(struct dump_dir *dd, const char *name)\n{ if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot get item size. '%s' is not a valid file name\", name);\n long size = -1;\n char *iname = concat_path_file(dd->dd_dirname, name);\n struct stat statbuf; if (lstat(in... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 196,
"char_start": 67,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/abr... | 0 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def zmi_page_request(self, *args, **kwargs):\r\n request = self.REQUEST\r\n RESPONSE = request.RESPONSE\r\n SESSION = request.SESSION\r\n self._zmi_page_request()\r\n RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822())\r\n RESPONSE.setHeader('Cac... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1363,
"char_start": 1322,
"chars": "self.getDocumentElement().id in path and "
}
],
"deleted": []
},
"commit_link": "github.com/zms-publishing/zms4/commit/3f28620d475220dfdb06f79787158ac50727c61a",
"file_name": "ZMSItem... | 1 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def zmi_page_request(self, *args, **kwargs):\r\n request = self.REQUEST\r\n RESPONSE = request.RESPONSE\r\n SESSION = request.SESSION\r\n self._zmi_page_request()\r\n RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822())\r\n RESPONSE.setHeader('Cac... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1363,
"char_start": 1322,
"chars": "self.getDocumentElement().id in path and "
}
],
"deleted": []
},
"commit_link": "github.com/zms-publishing/zms4/commit/3f28620d475220dfdb06f79787158ac50727c61a",
"file_name": "ZMSItem... | 1 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)\n{ return snprintf(dest, destlen, \"%s.hcache\", path);}"
] | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 81,
"char_start": 79,
"chars": "in"
},
{
"char_end": 85,
"char_start": 82,
"chars": " co"
},
{
"char_end": 90,
"char_start": 87,
"chars": "t ="
},
{
... | 2 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)\n{ int count = snprintf(dest, destlen, \"%s.hcache\", path); /* Strip out any directories in the path */\n char *first = strchr(dest, '/');\n char *last = strrchr(dest, '/');\n if (first && last && (last > first))\n {\n memmove(fir... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 81,
"char_start": 79,
"chars": "in"
},
{
"char_end": 85,
"char_start": 82,
"chars": " co"
},
{
"char_end": 90,
"char_start": 87,
"chars": "t ="
},
{
... | 2 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"std::string TarFileReader::extract(const string &_path) {\n if (_path.empty()) THROW(\"path cannot be empty\");\n if (!hasMore()) THROW(\"No more tar files\"); string path = _path; if (SystemUtilities::isDirectory(path)) path += \"/\" + getFilename();\n LOG_DEBUG(5, \"Extracting: \" << path);\n return extrac... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 228,
"char_start": 222,
"chars": "{\n "
},
{
"char_end": 544,
"char_start": 260,
"chars": " // Check that path is under the target directory\n string a = SystemUtilities::getCanonicalPath(_path);\... | 3 | cwe-022 | cpp |
Determine whether the {function_name} code is vulnerable or not. | [
"std::string TarFileReader::extract(const string &_path) {\n if (_path.empty()) THROW(\"path cannot be empty\");\n if (!hasMore()) THROW(\"No more tar files\"); string path = _path; if (SystemUtilities::isDirectory(path)) {\n path += \"/\" + getFilename(); // Check that path is under the target directory\... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 228,
"char_start": 222,
"chars": "{\n "
},
{
"char_end": 544,
"char_start": 260,
"chars": " // Check that path is under the target directory\n string a = SystemUtilities::getCanonicalPath(_path);\... | 3 | cwe-022 | cpp |
Determine whether the {function_name} code is vulnerable or not. | [
"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 9241,
"char_start": 9086,
"chars": "allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }\n\n if (!"
},
{
"char_end": 118... | 4 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 9241,
"char_start": 9086,
"chars": "allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }\n\n if (!"
},
{
"char_end": 118... | 4 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def _inject_file_into_fs(fs, path, contents):\n absolute_path = os.path.join(fs, path.lstrip('/')) parent_dir = os.path.dirname(absolute_path)\n utils.execute('mkdir', '-p', parent_dir, run_as_root=True) utils.execute('tee', absolute_path, process_input=contents,\n run_as_root=True)"
] | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 57,
"char_start": 43,
"chars": ", append=False"
},
{
"char_end": 82,
"char_start": 80,
"chars": "_j"
},
{
"char_end": 96,
"char_start": 83,
"chars": "in_and_check_"
... | 5 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def _inject_file_into_fs(fs, path, contents, append=False):\n absolute_path = _join_and_check_path_within_fs(fs, path.lstrip('/'))\n parent_dir = os.path.dirname(absolute_path)\n utils.execute('mkdir', '-p', parent_dir, run_as_root=True)\n args = []\n if append:\n args.append('-a')\n args.... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 57,
"char_start": 43,
"chars": ", append=False"
},
{
"char_end": 82,
"char_start": 80,
"chars": "_j"
},
{
"char_end": 96,
"char_start": 83,
"chars": "in_and_check_"
... | 5 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"set_interface_var(const char *iface,\n\t\t const char *var, const char *name,\n\t\t uint32_t val)\n{\n\tFILE *fp;\n\tchar spath[64+IFNAMSIZ];\t/* XXX: magic constant */\n\tif (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))\t\treturn -1;\tif (access(spath, F_OK) != 0)\n\t\treturn -1;\tfp = fopen(spa... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 325,
"char_start": 240,
"chars": "/* No path traversal */\n\tif (strstr(name, \"..\") || strchr(name, '/'))\n\t\treturn -1;\n\n\t"
}
],
"deleted": []
},
"commit_link": "github.com/reubenhwk/radvd/commit/92e22ca23e52066da2... | 6 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"set_interface_var(const char *iface,\n\t\t const char *var, const char *name,\n\t\t uint32_t val)\n{\n\tFILE *fp;\n\tchar spath[64+IFNAMSIZ];\t/* XXX: magic constant */\n\tif (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))\t\treturn -1;\t/* No path traversal */\n\tif (strstr(name, \"..\") || strchr... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 325,
"char_start": 240,
"chars": "/* No path traversal */\n\tif (strstr(name, \"..\") || strchr(name, '/'))\n\t\treturn -1;\n\n\t"
}
],
"deleted": []
},
"commit_link": "github.com/reubenhwk/radvd/commit/92e22ca23e52066da2... | 6 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def cut(self, key):\n try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound:\n return False\n except etcd.EtcdException as err:\n log_error(\"Error removing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 72,
"char_start": 71,
"chars": "_"
},
{
"char_end": 79,
"char_start": 73,
"chars": "bsolut"
},
{
"char_end": 82,
"char_start": 80,
"chars": "_k"
},
{
... | 7 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def cut(self, key):\n try: self.etcd.delete(self._absolute_key(key)) except etcd.EtcdKeyNotFound:\n return False\n except etcd.EtcdException as err:\n log_error(\"Error removing key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 72,
"char_start": 71,
"chars": "_"
},
{
"char_end": 79,
"char_start": 73,
"chars": "bsolut"
},
{
"char_end": 82,
"char_start": 80,
"chars": "_k"
},
{
... | 7 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"wiki_handle_http_request(HttpRequest *req)\n{\n HttpResponse *res = http_response_new(req);\n char *page = http_request_get_path_info(req); \n char *command = http_request_get_query_string(req); \n char *wikitext = \"\"; util_dehttpize(page); \t/* remove any encoding on the r... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1368,
"char_start": 1356,
"chars": "!page_name_i"
},
{
"char_end": 1374,
"char_start": 1369,
"chars": "_good"
}
],
"deleted": [
{
"char_end": 1362,
"char_start": 1357,... | 8 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"wiki_handle_http_request(HttpRequest *req)\n{\n HttpResponse *res = http_response_new(req);\n char *page = http_request_get_path_info(req); \n char *command = http_request_get_query_string(req); \n char *wikitext = \"\"; util_dehttpize(page); \t/* remove any encoding on the r... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1368,
"char_start": 1356,
"chars": "!page_name_i"
},
{
"char_end": 1374,
"char_start": 1369,
"chars": "_good"
}
],
"deleted": [
{
"char_end": 1362,
"char_start": 1357,... | 8 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def candidate_paths_for_url(self, url):\n for root, prefix in self.directories:\n if url.startswith(prefix): yield os.path.join(root, url[len(prefix):])"
] | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 151,
"char_start": 145,
"chars": "path ="
},
{
"char_end": 283,
"char_start": 189,
"chars": "\n if os.path.commonprefix((root, path)) == root:\n yield path"
}
... | 9 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def candidate_paths_for_url(self, url):\n for root, prefix in self.directories:\n if url.startswith(prefix): path = os.path.join(root, url[len(prefix):])\n if os.path.commonprefix((root, path)) == root:\n yield path"
] | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 151,
"char_start": 145,
"chars": "path ="
},
{
"char_end": 283,
"char_start": 189,
"chars": "\n if os.path.commonprefix((root, path)) == root:\n yield path"
}
... | 9 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def updateKey(client):\n\t\"\"\"Updates the contents of a key that already exists in our system.\n\tReturns an error if the specified key doesn't exist for the specified user.\n\t\"\"\"\n\tglobal NOT_FOUND\n\tglobal CREATED\tvalidateClient(client)\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRe... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 406,
"char_start": 369,
"chars": ")\n\tvalidateKeyName(token_data['name']"
}
],
"deleted": [
{
"char_end": 234,
"char_start": 233,
"chars": "\n"
}
]
},
"commit_link": "github.com/Mi... | 10 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def updateKey(client):\n\t\"\"\"Updates the contents of a key that already exists in our system.\n\tReturns an error if the specified key doesn't exist for the specified user.\n\t\"\"\"\n\tglobal NOT_FOUND\n\tglobal CREATED\tvalidateClient(client)\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRe... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 406,
"char_start": 369,
"chars": ")\n\tvalidateKeyName(token_data['name']"
}
],
"deleted": [
{
"char_end": 234,
"char_start": 233,
"chars": "\n"
}
]
},
"commit_link": "github.com/Mi... | 10 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def create_basename_core(basename):\n try:\n basename = basename.casefold()\n except Exception:\n basename = basename.lower()\n basename = basename.replace(' ', '-') basename = re.sub(r'<[^>]*>', r'', basename)\n basename = re.sub(r'[^a-z0-9\\-]', r'', basename)\n basename = re.sub(... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 159,
"char_start": 158,
"chars": "r"
},
{
"char_end": 164,
"char_start": 161,
"chars": "sub"
},
{
"char_end": 166,
"char_start": 165,
"chars": "r"
},
{
... | 11 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def create_basename_core(basename):\n try:\n basename = basename.casefold()\n except Exception:\n basename = basename.lower()\n basename = re.sub(r'[ \\./]', r'-', basename) basename = re.sub(r'<[^>]*>', r'', basename)\n basename = re.sub(r'[^a-z0-9\\-]', r'', basename)\n basename =... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 159,
"char_start": 158,
"chars": "r"
},
{
"char_end": 164,
"char_start": 161,
"chars": "sub"
},
{
"char_end": 166,
"char_start": 165,
"chars": "r"
},
{
... | 11 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get(self, key):\n try: result = self.etcd.get(os.path.join(self.namespace, key)) except etcd.EtcdException as err:\n log_error(\"Error fetching key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to get key')\n return result... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 78,
"char_start": 77,
"chars": "_"
},
{
"char_end": 85,
"char_start": 79,
"chars": "bsolut"
},
{
"char_end": 88,
"char_start": 86,
"chars": "_k"
},
{
... | 12 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get(self, key):\n try: result = self.etcd.get(self._absolute_key(key)) except etcd.EtcdException as err:\n log_error(\"Error fetching key %s: [%r]\" % (key, repr(err)))\n raise CSStoreError('Error occurred while trying to get key')\n return result.value"
] | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 78,
"char_start": 77,
"chars": "_"
},
{
"char_end": 85,
"char_start": 79,
"chars": "bsolut"
},
{
"char_end": 88,
"char_start": 86,
"chars": "_k"
},
{
... | 12 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"PHYSICALPATH_FUNC(mod_alias_physical_handler) {\n\tplugin_data *p = p_d;\n\tint uri_len, basedir_len;\n\tchar *uri_ptr;\n\tsize_t k;\tif (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON;\tmod_alias_patch_connection(srv, con, p);\t/* not to include the tailing slash */\n\tbasedir_len = buffer_string_lengt... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1449,
"char_start": 931,
"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 + ... | 13 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"PHYSICALPATH_FUNC(mod_alias_physical_handler) {\n\tplugin_data *p = p_d;\n\tint uri_len, basedir_len;\n\tchar *uri_ptr;\n\tsize_t k;\tif (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON;\tmod_alias_patch_connection(srv, con, p);\t/* not to include the tailing slash */\n\tbasedir_len = buffer_string_lengt... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1449,
"char_start": 931,
"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 + ... | 13 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def download_check_files(self, filelist):\n # only admins and allowed users may download\n if not cherrypy.session['admin']:\n uo = self.useroptions.forUser(self.getUserId())\n if not uo.getOptionValue('media.may_download'):\n return 'not_permitted'\n # mak... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 455,
"char_start": 395,
"chars": "# don't allow to traverse up in the file system\n "
},
{
"char_end": 625,
"char_start": 469,
"chars": " or f.startswith('../'):\n return 'inval... | 14 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def download_check_files(self, filelist):\n # only admins and allowed users may download\n if not cherrypy.session['admin']:\n uo = self.useroptions.forUser(self.getUserId())\n if not uo.getOptionValue('media.may_download'):\n return 'not_permitted'\n # mak... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 455,
"char_start": 395,
"chars": "# don't allow to traverse up in the file system\n "
},
{
"char_end": 625,
"char_start": 469,
"chars": " or f.startswith('../'):\n return 'inval... | 14 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_files(self, submit_id, password=None, astree=False):\n \"\"\"\n Returns files from a submitted analysis.\n @param password: The password to unlock container archives with\n @param astree: sflock option; determines the format in which the files are returned\n @return: A tr... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 638,
"char_start": 637,
"chars": "m"
},
{
"char_end": 718,
"char_start": 717,
"chars": "p"
},
{
"char_end": 721,
"char_start": 720,
"chars": "h"
},
{
... | 15 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_files(self, submit_id, password=None, astree=False):\n \"\"\"\n Returns files from a submitted analysis.\n @param password: The password to unlock container archives with\n @param astree: sflock option; determines the format in which the files are returned\n @return: A tr... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 638,
"char_start": 637,
"chars": "m"
},
{
"char_end": 718,
"char_start": 717,
"chars": "p"
},
{
"char_end": 721,
"char_start": 720,
"chars": "h"
},
{
... | 15 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def handle(self, keepalive=True, initial_timeout=None):\n # we are requested to skip processing and keep the previous values\n if self.skip:\n return self.response.handle() # default to no keepalive in case something happens while even trying ensure we have a request\n self.k... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1890,
"char_start": 1827,
"chars": ")\n self.resource = urllib.parse.unquote(resource"
}
],
"deleted": [
{
"char_end": 1778,
"char_start": 1773,
"chars": "self."
}
]
},... | 16 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def handle(self, keepalive=True, initial_timeout=None):\n # we are requested to skip processing and keep the previous values\n if self.skip:\n return self.response.handle() # default to no keepalive in case something happens while even trying ensure we have a request\n self.k... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1890,
"char_start": 1827,
"chars": ")\n self.resource = urllib.parse.unquote(resource"
}
],
"deleted": [
{
"char_end": 1778,
"char_start": 1773,
"chars": "self."
}
]
},... | 16 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"int dd_delete_item(struct dump_dir *dd, const char *name)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n char *path = concat_path_file(dd->dd_dirname, name);\n int res = unlink(path); if (res < 0)\n {\n if (errno == ENOENT)\n errno = res =... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 276,
"char_start": 149,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/abrt... | 17 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"int dd_delete_item(struct dump_dir *dd, const char *name)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot delete item. '%s' is not a valid file name\", name);\n char *path = concat_path_file(d... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 276,
"char_start": 149,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/abrt... | 17 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def render(self, request):\n\t\taction = \"download\"\n\t\tif \"action\" in request.args:\n\t\t\taction = request.args[\"action\"][0]\t\tif \"file\" in request.args:\t\t\tfilename = request.args[\"file\"][0].decode('utf-8', 'ignore').encode('utf-8')\n\t\t\tfilename = re.sub(\"^/+\", \"/\", os.path.realpath(filenam... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 183,
"char_start": 163,
"chars": "lenient_force_utf_8("
},
{
"char_end": 238,
"char_start": 222,
"chars": "sanitise_filenam"
},
{
"char_end": 240,
"char_start": 239,
"... | 18 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def render(self, request):\n\t\taction = \"download\"\n\t\tif \"action\" in request.args:\n\t\t\taction = request.args[\"action\"][0]\t\tif \"file\" in request.args:\t\t\tfilename = lenient_force_utf_8(request.args[\"file\"][0])\n\t\t\tfilename = sanitise_filename_slashes(os.path.realpath(filename))\n\t\t\tif not ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 183,
"char_start": 163,
"chars": "lenient_force_utf_8("
},
{
"char_end": 238,
"char_start": 222,
"chars": "sanitise_filenam"
},
{
"char_end": 240,
"char_start": 239,
"... | 18 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def _inject_net_into_fs(net, fs, execute=None):\n \"\"\"Inject /etc/network/interfaces into the filesystem rooted at fs. net is the contents of /etc/network/interfaces.\n \"\"\" netdir = os.path.join(os.path.join(fs, 'etc'), 'network') utils.execute('mkdir', '-p', netdir, run_as_root=True)\n util... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 196,
"char_start": 194,
"chars": "_j"
},
{
"char_end": 210,
"char_start": 197,
"chars": "in_and_check_"
},
{
"char_end": 216,
"char_start": 214,
"chars": "_w"
},... | 19 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def _inject_net_into_fs(net, fs, execute=None):\n \"\"\"Inject /etc/network/interfaces into the filesystem rooted at fs. net is the contents of /etc/network/interfaces.\n \"\"\" netdir = _join_and_check_path_within_fs(fs, 'etc', 'network') utils.execute('mkdir', '-p', netdir, run_as_root=True)\n ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 196,
"char_start": 194,
"chars": "_j"
},
{
"char_end": 210,
"char_start": 197,
"chars": "in_and_check_"
},
{
"char_end": 216,
"char_start": 214,
"chars": "_w"
},... | 19 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def canonicalize(self):\n \"\"\":: path = path.canonicalize()\n Canonicalize path. ::\n # \"/foo/baz\"\n Pyjo.Path.new('/foo/./bar/../baz').canonicalize() # \"/../baz\"\n Pyjo.Path.new('/foo/../bar/../../baz').canonicalize() \"\"\"\n ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 124,
"char_start": 108,
"chars": " by resolving ``"
},
{
"char_end": 171,
"char_start": 125,
"chars": "`` and ``..``, in addition ``...`` will be\n "
},
{
"char_end": 232,
"... | 20 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def canonicalize(self):\n \"\"\":: path = path.canonicalize()\n Canonicalize path by resolving ``.`` and ``..``, in addition ``...`` will be\n treated as ``.`` to protect from path traversal attacks.\n # \"/foo/baz\"\n Pyjo.Path.new('/foo/./bar/../baz').canonic... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 124,
"char_start": 108,
"chars": " by resolving ``"
},
{
"char_end": 171,
"char_start": 125,
"chars": "`` and ``..``, in addition ``...`` will be\n "
},
{
"char_end": 232,
"... | 20 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"CString CWebSock::GetSkinPath(const CString& sSkinName) { CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkinName;\n if (!CFile::IsDir(sRet)) { sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkinName;\n if (!CFile::IsDir(sRet)) { sRet = CString(_SKINDIR_) + \"/\" + ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 140,
"char_start": 62,
"chars": "const CString sSkin = sSkinName.Replace_n(\"/\", \"_\").Replace_n(\".\", \"_\");\n\n "
}
],
"deleted": [
{
"char_end": 128,
"char_start": 124,
"chars": "Name"
... | 21 | cwe-022 | cpp |
Determine whether the {function_name} code is vulnerable or not. | [
"CString CWebSock::GetSkinPath(const CString& sSkinName) { const CString sSkin = sSkinName.Replace_n(\"/\", \"_\").Replace_n(\".\", \"_\"); CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkin;\n if (!CFile::IsDir(sRet)) { sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkin;\n ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 140,
"char_start": 62,
"chars": "const CString sSkin = sSkinName.Replace_n(\"/\", \"_\").Replace_n(\".\", \"_\");\n\n "
}
],
"deleted": [
{
"char_end": 128,
"char_start": 124,
"chars": "Name"
... | 21 | cwe-022 | cpp |
Determine whether the {function_name} code is vulnerable or not. | [
"def addKey(client):\n\t\"\"\"Adds a new key with the specified name and contents.\n\tReturns an error if a key with the specified name already exists.\n\t\"\"\"\n\tglobal BAD_REQUEST\n\tglobal CREATED\tvalidateClient(client)\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 383,
"char_start": 346,
"chars": ")\n\tvalidateKeyName(token_data['name']"
}
],
"deleted": [
{
"char_end": 211,
"char_start": 210,
"chars": "\n"
}
]
},
"commit_link": "github.com/Mi... | 22 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def addKey(client):\n\t\"\"\"Adds a new key with the specified name and contents.\n\tReturns an error if a key with the specified name already exists.\n\t\"\"\"\n\tglobal BAD_REQUEST\n\tglobal CREATED\tvalidateClient(client)\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 383,
"char_start": 346,
"chars": ")\n\tvalidateKeyName(token_data['name']"
}
],
"deleted": [
{
"char_end": 211,
"char_start": 210,
"chars": "\n"
}
]
},
"commit_link": "github.com/Mi... | 22 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"void dd_save_text(struct dump_dir *dd, const char *name, const char *data)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, strlen(data), dd->dd_uid, dd->dd_gid, dd->mode)... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 291,
"char_start": 166,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/abrt/l... | 23 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"void dd_save_text(struct dump_dir *dd, const char *name, const char *data)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save text. '%s' is not a valid file name\", name);\n char *full_path ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 291,
"char_start": 166,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/abrt/l... | 23 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def misc_file_checks(self): print_header(\"MISC FILE CHECKS\") #\n # Check for recommended and mandatory files\n # filenames = (\"manifest.json\", \"LICENSE\", \"README.md\",\n \"scripts/install\", \"scripts/remove\",\n \"scripts/upgrade\",... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1184,
"char_start": 1153,
"chars": "Analyze nginx conf\n # - "
},
{
"char_end": 1292,
"char_start": 1240,
"chars": " - Spot path traversal issue vulnerability\n #"
},
{
... | 24 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def misc_file_checks(self): print_header(\"MISC FILE CHECKS\") #\n # Check for recommended and mandatory files\n # filenames = (\"manifest.json\", \"LICENSE\", \"README.md\",\n \"scripts/install\", \"scripts/remove\",\n \"scripts/upgrade\",... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1184,
"char_start": 1153,
"chars": "Analyze nginx conf\n # - "
},
{
"char_end": 1292,
"char_start": 1240,
"chars": " - Spot path traversal issue vulnerability\n #"
},
{
... | 24 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n char *full_path = concat_path_file(dd->dd_dirname, name);\n save_binary_file(full_path, data, size, dd->dd_uid, dd->dd_gid, ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 310,
"char_start": 183,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/abrt... | 25 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size)\n{\n if (!dd->locked)\n error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save binary. '%s' is not a valid file name\", name);\n ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 310,
"char_start": 183,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/abrt... | 25 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def pascal_case(value: str) -> str: return stringcase.pascalcase(value)"
] | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 79,
"char_start": 69,
"chars": "_sanitize("
},
{
"char_end": 86,
"char_start": 85,
"chars": ")"
}
],
"deleted": []
},
"commit_link": "github.com/openapi-generators/openapi-python-client... | 26 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def pascal_case(value: str) -> str: return stringcase.pascalcase(_sanitize(value))"
] | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 79,
"char_start": 69,
"chars": "_sanitize("
},
{
"char_end": 86,
"char_start": 85,
"chars": ")"
}
],
"deleted": []
},
"commit_link": "github.com/openapi-generators/openapi-python-client... | 26 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"cleanup_pathname(struct archive_write_disk *a)\n{\n\tchar *dest, *src;\n\tchar separator = '\\0';\tdest = src = a->name;\n\tif (*src == '\\0') {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Invalid empty pathname\");\n\t\treturn (ARCHIVE_FAILED);\n\t}#if defined(__CYGWIN__)\n\tcleanup_pathnam... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 543,
"char_start": 353,
"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\... | 27 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"cleanup_pathname(struct archive_write_disk *a)\n{\n\tchar *dest, *src;\n\tchar separator = '\\0';\tdest = src = a->name;\n\tif (*src == '\\0') {\n\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t \"Invalid empty pathname\");\n\t\treturn (ARCHIVE_FAILED);\n\t}#if defined(__CYGWIN__)\n\tcleanup_pathnam... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 543,
"char_start": 353,
"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\... | 27 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)\n{\n INITIALIZE_LIBREPORT(); char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER); if (!type)\n {\n error_msg(_(\"Missing required item: '%s'\"), FILENAME_ANALYZE... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 497,
"char_start": 349,
"chars": "if (!str_is_correct_filename(type))\n {\n error_msg(_(\"'%s' is not correct file name\"), FILENAME_ANALYZER);\n return NULL;\n }\n\n "
},
{
"char_end": 2558,
... | 28 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)\n{\n INITIALIZE_LIBREPORT(); char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER); if (!type)\n {\n error_msg(_(\"Missing required item: '%s'\"), FILENAME_ANALYZE... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 497,
"char_start": 349,
"chars": "if (!str_is_correct_filename(type))\n {\n error_msg(_(\"'%s' is not correct file name\"), FILENAME_ANALYZER);\n return NULL;\n }\n\n "
},
{
"char_end": 2558,
... | 28 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def list(self, keyfilter='/'): path = os.path.join(self.namespace, keyfilter) if path != '/':\n path = path.rstrip('/')\n try:\n result = self.etcd.read(path, recursive=True)\n except etcd.EtcdKeyNotFound:\n return None\n except etcd.EtcdException... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 56,
"char_start": 55,
"chars": "_"
},
{
"char_end": 63,
"char_start": 57,
"chars": "bsolut"
},
{
"char_end": 66,
"char_start": 64,
"chars": "_k"
},
{
... | 29 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def list(self, keyfilter='/'): path = self._absolute_key(keyfilter) if path != '/':\n path = path.rstrip('/')\n try:\n result = self.etcd.read(path, recursive=True)\n except etcd.EtcdKeyNotFound:\n return None\n except etcd.EtcdException as err:\n... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 56,
"char_start": 55,
"chars": "_"
},
{
"char_end": 63,
"char_start": 57,
"chars": "bsolut"
},
{
"char_end": 66,
"char_start": 64,
"chars": "_k"
},
{
... | 29 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"local void process(char *path)\n{\n int method = -1; /* get_header() return value */\n size_t len; /* length of base name (minus suffix) */\n struct stat st; /* to get file type and mod time */\n /* all compressed suffixes for decoding search, in lengt... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 8057,
"char_start": 8049,
"chars": " = g.inf"
},
{
"char_end": 8087,
"char_start": 8060,
"chars": "sufx = \"\";\n size_t p"
},
{
"char_end": 8093,
"char_start": 8089,
... | 30 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"local void process(char *path)\n{\n int method = -1; /* get_header() return value */\n size_t len; /* length of base name (minus suffix) */\n struct stat st; /* to get file type and mod time */\n /* all compressed suffixes for decoding search, in lengt... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 8057,
"char_start": 8049,
"chars": " = g.inf"
},
{
"char_end": 8087,
"char_start": 8060,
"chars": "sufx = \"\";\n size_t p"
},
{
"char_end": 8093,
"char_start": 8089,
... | 30 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)\n{\n struct ImapMbox mx;\n struct Url url;\n char cachepath[PATH_MAX];\n char mbox[PATH_MAX]; if (path)\n imap_cachepath(idata, path, mbox, sizeof(mbox));\n else\n {\n if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) <... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 627,
"char_start": 415,
"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 ... | 31 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)\n{\n struct ImapMbox mx;\n struct Url url;\n char cachepath[PATH_MAX];\n char mbox[PATH_MAX]; if (path)\n imap_cachepath(idata, path, mbox, sizeof(mbox));\n else\n {\n if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) <... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 627,
"char_start": 415,
"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 ... | 31 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def _normalize(self, metaerrors):\n \"\"\"Normalize output format to be usable by Anaconda's linting frontend\n \"\"\" errors = []\n for error in metaerrors: if self.filepath not in error.get('path', ''): continue error_type = error.get('severity', '... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 217,
"char_start": 195,
"chars": "last_path = os.path.jo"
},
{
"char_end": 273,
"char_start": 218,
"chars": "n(\n os.path.basename(os.path.dirname(sel"
},
{
"char_end":... | 32 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def _normalize(self, metaerrors):\n \"\"\"Normalize output format to be usable by Anaconda's linting frontend\n \"\"\" errors = []\n for error in metaerrors: last_path = os.path.join(\n os.path.basename(os.path.dirname(self.filepath)),\n os.path.... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 217,
"char_start": 195,
"chars": "last_path = os.path.jo"
},
{
"char_end": 273,
"char_start": 218,
"chars": "n(\n os.path.basename(os.path.dirname(sel"
},
{
"char_end":... | 32 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags)\n{\n// if (!dd->locked)\n// error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n /* Compat with old abrt dumps. Remove in abrt-2.1 */\n if (strcmp(name, \"release\") == 0)\n name = FILENAME_OS_RELEASE; ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 393,
"char_start": 179,
"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... | 33 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags)\n{\n// if (!dd->locked)\n// error_msg_and_die(\"dump_dir is not opened\"); /* bug */\n if (!str_is_correct_filename(name))\n {\n error_msg(\"Cannot load text. '%s' is not a valid file name\", name);\n ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 393,
"char_start": 179,
"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... | 33 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"@staticmethod\n def _download_file(bucket, filename, local_dir):\n key = bucket.get_key(filename) local_filename = os.path.join(local_dir, filename) key.get_contents_to_filename(local_filename)\n return local_filename"
] | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 176,
"char_start": 159,
"chars": "os.path.basename("
},
{
"char_end": 185,
"char_start": 184,
"chars": ")"
}
],
"deleted": []
},
"commit_link": "github.com/openstack/nova/commit/7636322... | 34 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"@staticmethod\n def _download_file(bucket, filename, local_dir):\n key = bucket.get_key(filename) local_filename = os.path.join(local_dir, os.path.basename(filename)) key.get_contents_to_filename(local_filename)\n return local_filename"
] | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 176,
"char_start": 159,
"chars": "os.path.basename("
},
{
"char_end": 185,
"char_start": 184,
"chars": ")"
}
],
"deleted": []
},
"commit_link": "github.com/openstack/nova/commit/7636322... | 34 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"bool Utility::UnZip(const QString &zippath, const QString &destpath)\n{\n int res = 0;\n QDir dir(destpath);\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QS... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 2937,
"char_start": 1400,
"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 al... | 35 | cwe-022 | cpp |
Determine whether the {function_name} code is vulnerable or not. | [
"bool Utility::UnZip(const QString &zippath, const QString &destpath)\n{\n int res = 0;\n QDir dir(destpath);\n if (!cp437) {\n cp437 = new QCodePage437Codec();\n }\n#ifdef Q_OS_WIN32\n zlib_filefunc64_def ffunc;\n fill_win32_filefunc64W(&ffunc);\n unzFile zfile = unzOpen2_64(Utility::QS... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 2937,
"char_start": 1400,
"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 al... | 35 | cwe-022 | cpp |
Determine whether the {function_name} code is vulnerable or not. | [
"async def save(request):\n # TODO csrf\n data = await request.post()\n item = Item(data['src']) # Update name\n new_src = data.get('new_src') if new_src and new_src != data['src']:\n # don't need to worry about html unquote\n shutil.move(item.abspath, settings.STORAGE_DIR + new_src)... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 171,
"char_start": 169,
"chars": ":\n"
},
{
"char_end": 178,
"char_start": 172,
"chars": " "
},
{
"char_end": 185,
"char_start": 183,
"chars": "ab"
},
... | 36 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"async def save(request):\n # TODO csrf\n data = await request.post()\n item = Item(data['src']) # Update name\n new_src = data.get('new_src') if new_src:\n new_abspath = os.path.abspath(settings.STORAGE_DIR + new_src)\n if not new_abspath.startswith(settings.STORAGE_DIR):\n ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 171,
"char_start": 169,
"chars": ":\n"
},
{
"char_end": 178,
"char_start": 172,
"chars": " "
},
{
"char_end": 185,
"char_start": 183,
"chars": "ab"
},
... | 36 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"wiki_handle_rest_call(HttpRequest *req, \n\t\t HttpResponse *res,\n\t\t char *func)\n{ if (func != NULL && *func != '\\0')\n {\n if (!strcmp(func, \"page/get\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\t if (page == NULL)\n\t page = http_request_get_query_strin... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 349,
"char_start": 322,
"chars": "page_name_is_good(page) && "
},
{
"char_end": 764,
"char_start": 725,
"chars": "\t if (page_name_is_good(page))\n\t {\n"
},
{
"char_end": 905,
... | 37 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"wiki_handle_rest_call(HttpRequest *req, \n\t\t HttpResponse *res,\n\t\t char *func)\n{ if (func != NULL && *func != '\\0')\n {\n if (!strcmp(func, \"page/get\"))\n\t{\n\t char *page = http_request_param_get(req, \"page\");\t if (page == NULL)\n\t page = http_request_get_query_strin... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 349,
"char_start": 322,
"chars": "page_name_is_good(page) && "
},
{
"char_end": 764,
"char_start": 725,
"chars": "\t if (page_name_is_good(page))\n\t {\n"
},
{
"char_end": 905,
... | 37 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 9097,
"char_start": 9085,
"chars": "!str_is_corr"
},
{
"char_end": 9103,
"char_start": 9098,
"chars": "ct_fi"
},
{
"char_end": 9107,
"char_start": 9106,
"chars": "a"
... | 38 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"static void handle_method_call(GDBusConnection *connection,\n const gchar *caller,\n const gchar *object_path,\n const gchar *interface_name,\n const gchar *method_name,\n GVariant *parameters,\n ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 9097,
"char_start": 9085,
"chars": "!str_is_corr"
},
{
"char_end": 9103,
"char_start": 9098,
"chars": "ct_fi"
},
{
"char_end": 9107,
"char_start": 9106,
"chars": "a"
... | 38 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"static bool extractFileTo(zip* zip, const std::string &file, std::string& to,\n 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)) {\n retur... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 326,
"char_start": 129,
"chars": "\n struct zip_stat zipStat;\n // Verify the file to be extracted is actually in the zip file\n if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n return false;\n }\n\n auto clean_file = file;\n... | 39 | cwe-022 | cpp |
Determine whether the {function_name} code is vulnerable or not. | [
"static bool extractFileTo(zip* zip, const std::string &file, std::string& to,\n char* buf, size_t len) {\n struct zip_stat zipStat;\n // Verify the file to be extracted is actually in the zip file\n if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n return false;\n } auto clean... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 326,
"char_start": 129,
"chars": "\n struct zip_stat zipStat;\n // Verify the file to be extracted is actually in the zip file\n if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n return false;\n }\n\n auto clean_file = file;\n... | 39 | cwe-022 | cpp |
Determine whether the {function_name} code is vulnerable or not. | [
"def new_goal():\n \"\"\"\n new goal\n \"\"\" goals_dir_check()\n click.echo(chalk.blue('Input a single-word name of the goal:')) goal_name = input().strip()\n if goal_name_exists(goal_name):\n click.echo(chalk.red(\n 'A goal with this name already exists. Please type \"yoda g... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 102,
"char_start": 73,
"chars": "goal_name_not_ok = True\n\n "
},
{
"char_end": 202,
"char_start": 170,
"chars": "while goal_name_not_ok:\n "
},
{
"char_end": 420,
"... | 40 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def new_goal():\n \"\"\"\n new goal\n \"\"\" goals_dir_check()\n goal_name_not_ok = True\n click.echo(chalk.blue('Input a single-word name of the goal:')) while goal_name_not_ok:\n goal_name = input().strip()\n if goal_name.isalnum():\n goal_name_not_ok = False\n ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 102,
"char_start": 73,
"chars": "goal_name_not_ok = True\n\n "
},
{
"char_end": 202,
"char_start": 170,
"chars": "while goal_name_not_ok:\n "
},
{
"char_end": 420,
"... | 40 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def _inject_admin_password_into_fs(admin_passwd, fs, execute=None):\n \"\"\"Set the root password to admin_passwd admin_password is a root password\n fs is the path to the base of the filesystem into which to inject\n the key. This method modifies the instance filesystem directly,\n and does not ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 702,
"char_start": 693,
"chars": "passwd_pa"
},
{
"char_end": 710,
"char_start": 703,
"chars": "h = _jo"
},
{
"char_end": 719,
"char_start": 711,
"chars": "n_and_ch"
... | 41 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def _inject_admin_password_into_fs(admin_passwd, fs, execute=None):\n \"\"\"Set the root password to admin_passwd admin_password is a root password\n fs is the path to the base of the filesystem into which to inject\n the key. This method modifies the instance filesystem directly,\n and does not ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 702,
"char_start": 693,
"chars": "passwd_pa"
},
{
"char_end": 710,
"char_start": 703,
"chars": "h = _jo"
},
{
"char_end": 719,
"char_start": 711,
"chars": "n_and_ch"
... | 41 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_paths(base_path: pathlib.Path):\n data_file = pathlib.Path(str(base_path) + \".data\")\n metadata_file = pathlib.Path(str(base_path) + \".meta\")\n return data_file, metadata_file"
] | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 27,
"char_start": 14,
"chars": "root: str, su"
},
{
"char_end": 30,
"char_start": 28,
"chars": "_p"
},
{
"char_end": 35,
"char_start": 31,
"chars": "th: "
},
... | 42 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get_paths(root: str, sub_path: str) \\\n -> typing.Tuple[pathlib.Path, pathlib.Path]:\n base_path = flask.safe_join(root, sub_path)\n data_file = pathlib.Path(base_path + \".data\")\n metadata_file = pathlib.Path(base_path + \".meta\")\n return data_file, metadata_file"
] | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 27,
"char_start": 14,
"chars": "root: str, su"
},
{
"char_end": 30,
"char_start": 28,
"chars": "_p"
},
{
"char_end": 35,
"char_start": 31,
"chars": "th: "
},
... | 42 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"char *compose_path(ctrl_t *ctrl, char *path)\n{\n\tstruct stat st;\n\tstatic char rpath[PATH_MAX];\n\tchar *name, *ptr;\n\tchar dir[PATH_MAX] = { 0 };\tstrlcpy(dir, ctrl->cwd, sizeof(dir));\n\tDBG(\"Compose path from cwd: %s, arg: %s\", ctrl->cwd, path ?: \"\");\n\tif (!path || !strlen(path))\n\t\tgoto check;\tif ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1491,
"char_start": 1487,
"chars": "path"
}
],
"deleted": [
{
"char_end": 1488,
"char_start": 1486,
"chars": "di"
}
]
},
"commit_link": "github.com/troglobit/uftpd/commit/455b47d375... | 43 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"char *compose_path(ctrl_t *ctrl, char *path)\n{\n\tstruct stat st;\n\tstatic char rpath[PATH_MAX];\n\tchar *name, *ptr;\n\tchar dir[PATH_MAX] = { 0 };\tstrlcpy(dir, ctrl->cwd, sizeof(dir));\n\tDBG(\"Compose path from cwd: %s, arg: %s\", ctrl->cwd, path ?: \"\");\n\tif (!path || !strlen(path))\n\t\tgoto check;\tif ... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 1491,
"char_start": 1487,
"chars": "path"
}
],
"deleted": [
{
"char_end": 1488,
"char_start": 1486,
"chars": "di"
}
]
},
"commit_link": "github.com/troglobit/uftpd/commit/455b47d375... | 43 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def valid_id(opts, id_):\n '''\n Returns if the passed id is valid\n '''\n try: return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)\n except (AttributeError, KeyError, TypeError) as e: return False"
] | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 174,
"char_start": 96,
"chars": "if any(x in id_ for x in ('/', '\\\\', '\\0')):\n return False\n "
}
],
"deleted": [
{
"char_end": 159,
"char_start": 141,
"chars": " and clean_... | 44 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def valid_id(opts, id_):\n '''\n Returns if the passed id is valid\n '''\n try: if any(x in id_ for x in ('/', '\\\\', '\\0')):\n return False\n return bool(clean_path(opts['pki_dir'], id_))\n except (AttributeError, KeyError, TypeError): return False"
] | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 174,
"char_start": 96,
"chars": "if any(x in id_ for x in ('/', '\\\\', '\\0')):\n return False\n "
}
],
"deleted": [
{
"char_end": 159,
"char_start": 141,
"chars": " and clean_... | 44 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get(self, path): return static_file(path, self.get_base_path())"
] | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 76,
"char_start": 33,
"chars": "path = self.sanitize_path(path)\n bas"
},
{
"char_end": 80,
"char_start": 77,
"chars": "_pa"
},
{
"char_end": 85,
"char_start": 81,
... | 45 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def get(self, path): path = self.sanitize_path(path)\n base_paths = self.get_base_paths()\n if hasattr(base_paths, 'split'):\n # String, so go simple\n base_path = base_paths\n else:\n base_path = self.get_first_base(base_paths, path)\n return sta... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 76,
"char_start": 33,
"chars": "path = self.sanitize_path(path)\n bas"
},
{
"char_end": 80,
"char_start": 77,
"chars": "_pa"
},
{
"char_end": 85,
"char_start": 81,
... | 45 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"int dd_exist(const struct dump_dir *dd, const char *path)\n{ char *full_path = concat_path_file(dd->dd_dirname, path);\n int ret = exist_file_dir(full_path);\n free(full_path);\n return ret;\n}"
] | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 194,
"char_start": 64,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/ab... | 46 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"int dd_exist(const struct dump_dir *dd, const char *path)\n{ if (!str_is_correct_filename(path))\n error_msg_and_die(\"Cannot test existence. '%s' is not a valid file name\", path);\n char *full_path = concat_path_file(dd->dd_dirname, path);\n int ret = exist_file_dir(full_path);\n free(full_pat... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 194,
"char_start": 64,
"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 "
}
],
"deleted": []
},
"commit_link": "github.com/ab... | 46 | cwe-022 | c |
Determine whether the {function_name} code is vulnerable or not. | [
"def is_cgi(self): \"\"\"Test whether self.path corresponds to a CGI script,\n and return a boolean. This function sets self.cgi_info to a tuple (dir, rest)\n when it returns True, where dir is the directory part before\n the CGI script name. Note that rest begins with a\n ... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 85,
"char_start": 83,
"chars": ".\n"
},
{
"char_end": 95,
"char_start": 94,
"chars": "R"
},
{
"char_end": 101,
"char_start": 100,
"chars": "s"
},
{
... | 47 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def is_cgi(self): \"\"\"Test whether self.path corresponds to a CGI script. Returns True and updates the cgi_info attribute to the tuple\n (dir, rest) if self.path requires running a CGI script.\n Returns False otherwise. The default implementation tests whether the normalized ur... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 85,
"char_start": 83,
"chars": ".\n"
},
{
"char_end": 95,
"char_start": 94,
"chars": "R"
},
{
"char_end": 101,
"char_start": 100,
"chars": "s"
},
{
... | 47 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def deleteKey(client):\n\t\"\"\"Deletes the specified key.\n\tReturns an error if the key doesn't exist\n\t\"\"\"\tglobal BAD_REQUEST\tglobal NOT_FOUND\tvalidateClient(client)\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\n\tif re.search('[^a-zA-Z0-9]',... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 120,
"char_start": 120,
"chars": ""
},
{
"char_end": 255,
"char_start": 252,
"chars": "val"
},
{
"char_end": 259,
"char_start": 256,
"chars": "dat"
},
{
... | 48 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def deleteKey(client):\n\t\"\"\"Deletes the specified key.\n\tReturns an error if the key doesn't exist\n\t\"\"\"\tglobal NOT_FOUND\tvalidateClient(client)\tclient_pub_key = loadClientRSAKey(client)\n\ttoken_data = decodeRequestToken(request.data, client_pub_key)\tvalidateKeyName(token_data['key'])\n\ttry:\n\t\tos... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 120,
"char_start": 120,
"chars": ""
},
{
"char_end": 255,
"char_start": 252,
"chars": "val"
},
{
"char_end": 259,
"char_start": 256,
"chars": "dat"
},
{
... | 48 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def set(self, key, value, replace=False): path = os.path.join(self.namespace, key) try:\n self.etcd.write(path, value, prevExist=replace)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_err... | [
0
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 67,
"char_start": 66,
"chars": "_"
},
{
"char_end": 74,
"char_start": 68,
"chars": "bsolut"
},
{
"char_end": 77,
"char_start": 75,
"chars": "_k"
},
{
... | 49 | cwe-022 | py |
Determine whether the {function_name} code is vulnerable or not. | [
"def set(self, key, value, replace=False): path = self._absolute_key(key) try:\n self.etcd.write(path, value, prevExist=replace)\n except etcd.EtcdAlreadyExist as err:\n raise CSStoreExists(str(err))\n except etcd.EtcdException as err:\n log_error(\"Error... | [
1
] | SVEN | {
"char_changes": {
"added": [
{
"char_end": 67,
"char_start": 66,
"chars": "_"
},
{
"char_end": 74,
"char_start": 68,
"chars": "bsolut"
},
{
"char_end": 77,
"char_start": 75,
"chars": "_k"
},
{
... | 49 | cwe-022 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.