prompt
stringclasses
1 value
completions
listlengths
2
1.33k
labels
listlengths
2
1.33k
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 (er...
[ 1, 0, 1, 1, 1, 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/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_get_item_size", "line_changes": { "added": [ { "char_end": 103, "char_start": 63, "line": " if (!str_is_correct_filename(name))\n", "line_no": 3 }, { "char_end": 191, "char_start": 103, "line": " error_msg_and_die(\"Cannot get item size. '%s' is not a valid file name\", name);\n", "line_no": 4 }, { "char_end": 192, "char_start": 191, "line": "\n", "line_no": 5 } ], "deleted": [] }, "vul_type": "cwe-022" }
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;", ...
[ 1, 1, 1, 1, 1, 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/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_get_item_size", "line_changes": { "added": [ { "char_end": 103, "char_start": 63, "line": " if (!str_is_correct_filename(name))\n", "line_no": 3 }, { "char_end": 191, "char_start": 103, "line": " error_msg_and_die(\"Cannot get item size. '%s' is not a valid file name\", name);\n", "line_no": 4 }, { "char_end": 192, "char_start": 191, "line": "\n", "line_no": 5 } ], "deleted": [] }, "vul_type": "cwe-022" }
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...
[ 1, 0, 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.py", "func_name": "zmi_page_request", "line_changes": { "added": [ { "char_end": 1436, "char_start": 1313, "line": " if self.getDocumentElement().id in path and len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n", "line_no": 26 } ], "deleted": [ { "char_end": 1395, "char_start": 1313, "line": " if len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n", "line_no": 26 } ] }, "vul_type": "cwe-022" }
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, 1, 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.py", "func_name": "zmi_page_request", "line_changes": { "added": [ { "char_end": 1436, "char_start": 1313, "line": " if self.getDocumentElement().id in path and len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n", "line_no": 26 } ], "deleted": [ { "char_end": 1395, "char_start": 1313, "line": " if len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n", "line_no": 26 } ] }, "vul_type": "cwe-022" }
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);", "}" ]
[ 1, 0, 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 =" }, { "char_end": 387, "char_start": 133, "chars": ";\n\n /* 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(first, last, strlen(last) + 1);\n count -= (last - first);\n }\n\n return count" } ], "deleted": [ { "char_end": 81, "char_start": 79, "chars": "re" }, { "char_end": 84, "char_start": 83, "chars": "r" } ] }, "commit_link": "github.com/neomutt/neomutt/commit/9bfab35522301794483f8f9ed60820bdec9be59e", "file_name": "newsrc.c", "func_name": "nntp_hcache_namer", "line_changes": { "added": [ { "char_end": 135, "char_start": 77, "line": " int count = snprintf(dest, destlen, \"%s.hcache\", path);\n", "line_no": 3 }, { "char_end": 136, "char_start": 135, "line": "\n", "line_no": 4 }, { "char_end": 182, "char_start": 136, "line": " /* Strip out any directories in the path */\n", "line_no": 5 }, { "char_end": 217, "char_start": 182, "line": " char *first = strchr(dest, '/');\n", "line_no": 6 }, { "char_end": 252, "char_start": 217, "line": " char *last = strrchr(dest, '/');\n", "line_no": 7 }, { "char_end": 291, "char_start": 252, "line": " if (first && last && (last > first))\n", "line_no": 8 }, { "char_end": 295, "char_start": 291, "line": " {\n", "line_no": 9 }, { "char_end": 339, "char_start": 295, "line": " memmove(first, last, strlen(last) + 1);\n", "line_no": 10 }, { "char_end": 368, "char_start": 339, "line": " count -= (last - first);\n", "line_no": 11 }, { "char_end": 372, "char_start": 368, "line": " }\n", "line_no": 12 }, { "char_end": 373, "char_start": 372, "line": "\n", "line_no": 13 }, { "char_end": 389, "char_start": 373, "line": " return count;\n", "line_no": 14 } ], "deleted": [ { "char_end": 130, "char_start": 77, "line": " return snprintf(dest, destlen, \"%s.hcache\", path);\n", "line_no": 3 } ] }, "vul_type": "cwe-022" }
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 ...
[ 1, 1, 1, 1, 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 =" }, { "char_end": 387, "char_start": 133, "chars": ";\n\n /* 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(first, last, strlen(last) + 1);\n count -= (last - first);\n }\n\n return count" } ], "deleted": [ { "char_end": 81, "char_start": 79, "chars": "re" }, { "char_end": 84, "char_start": 83, "chars": "r" } ] }, "commit_link": "github.com/neomutt/neomutt/commit/9bfab35522301794483f8f9ed60820bdec9be59e", "file_name": "newsrc.c", "func_name": "nntp_hcache_namer", "line_changes": { "added": [ { "char_end": 135, "char_start": 77, "line": " int count = snprintf(dest, destlen, \"%s.hcache\", path);\n", "line_no": 3 }, { "char_end": 136, "char_start": 135, "line": "\n", "line_no": 4 }, { "char_end": 182, "char_start": 136, "line": " /* Strip out any directories in the path */\n", "line_no": 5 }, { "char_end": 217, "char_start": 182, "line": " char *first = strchr(dest, '/');\n", "line_no": 6 }, { "char_end": 252, "char_start": 217, "line": " char *last = strrchr(dest, '/');\n", "line_no": 7 }, { "char_end": 291, "char_start": 252, "line": " if (first && last && (last > first))\n", "line_no": 8 }, { "char_end": 295, "char_start": 291, "line": " {\n", "line_no": 9 }, { "char_end": 339, "char_start": 295, "line": " memmove(first, last, strlen(last) + 1);\n", "line_no": 10 }, { "char_end": 368, "char_start": 339, "line": " count -= (last - first);\n", "line_no": 11 }, { "char_end": 372, "char_start": 368, "line": " }\n", "line_no": 12 }, { "char_end": 373, "char_start": 372, "line": "\n", "line_no": 13 }, { "char_end": 389, "char_start": 373, "line": " return count;\n", "line_no": 14 } ], "deleted": [ { "char_end": 130, "char_start": 77, "line": " return snprintf(dest, destlen, \"%s.hcache\", path);\n", "line_no": 3 } ] }, "vul_type": "cwe-022" }
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)...
[ 1, 1, 0, 1, 0, 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);\n string b = SystemUtilities::getCanonicalPath(path);\n if (!String::startsWith(b, a))\n THROW(\"Tar path points outside of the extraction directory: \" << path);\n }\n\n " }, { "char_end": 652, "char_start": 585, "chars": "switch (getType()) {\n case NORMAL_FILE: case CONTIGUOUS_FILE:\n " }, { "char_end": 851, "char_start": 696, "chars": ");\n case DIRECTORY: SystemUtilities::ensureDirectory(path); break;\n default: THROW(\"Unsupported tar file type \" << getType());\n }\n\n return getFilename(" } ], "deleted": [] }, "commit_link": "github.com/CauldronDevelopmentLLC/cbang/commit/1c1dba62bd3e6fa9d0d0c0aa21926043b75382c7", "file_name": "src/cbang/tar/TarFileReader.cpp", "func_name": "TarFileReader::extract", "line_changes": { "added": [ { "char_end": 224, "char_start": 180, "line": " if (SystemUtilities::isDirectory(path)) {\n", "line_no": 6 }, { "char_end": 257, "char_start": 224, "line": " path += \"/\" + getFilename();\n", "line_no": 7 }, { "char_end": 258, "char_start": 257, "line": "\n", "line_no": 8 }, { "char_end": 368, "char_start": 311, "line": " string a = SystemUtilities::getCanonicalPath(_path);\n", "line_no": 10 }, { "char_end": 424, "char_start": 368, "line": " string b = SystemUtilities::getCanonicalPath(path);\n", "line_no": 11 }, { "char_end": 459, "char_start": 424, "line": " if (!String::startsWith(b, a))\n", "line_no": 12 }, { "char_end": 537, "char_start": 459, "line": " THROW(\"Tar path points outside of the extraction directory: \" << path);\n", "line_no": 13 }, { "char_end": 541, "char_start": 537, "line": " }\n", "line_no": 14 }, { "char_end": 606, "char_start": 583, "line": " switch (getType()) {\n", "line_no": 18 }, { "char_end": 648, "char_start": 606, "line": " case NORMAL_FILE: case CONTIGUOUS_FILE:\n", "line_no": 19 }, { "char_end": 699, "char_start": 648, "line": " return extract(*SystemUtilities::oopen(path));\n", "line_no": 20 }, { "char_end": 764, "char_start": 699, "line": " case DIRECTORY: SystemUtilities::ensureDirectory(path); break;\n", "line_no": 21 }, { "char_end": 825, "char_start": 764, "line": " default: THROW(\"Unsupported tar file type \" << getType());\n", "line_no": 22 }, { "char_end": 829, "char_start": 825, "line": " }\n", "line_no": 23 }, { "char_end": 830, "char_start": 829, "line": "\n", "line_no": 24 }, { "char_end": 854, "char_start": 830, "line": " return getFilename();\n", "line_no": 25 } ], "deleted": [ { "char_end": 251, "char_start": 180, "line": " if (SystemUtilities::isDirectory(path)) path += \"/\" + getFilename();\n", "line_no": 6 }, { "char_end": 342, "char_start": 293, "line": " return extract(*SystemUtilities::oopen(path));\n", "line_no": 10 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 1, 1, 1, 1, 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);\n string b = SystemUtilities::getCanonicalPath(path);\n if (!String::startsWith(b, a))\n THROW(\"Tar path points outside of the extraction directory: \" << path);\n }\n\n " }, { "char_end": 652, "char_start": 585, "chars": "switch (getType()) {\n case NORMAL_FILE: case CONTIGUOUS_FILE:\n " }, { "char_end": 851, "char_start": 696, "chars": ");\n case DIRECTORY: SystemUtilities::ensureDirectory(path); break;\n default: THROW(\"Unsupported tar file type \" << getType());\n }\n\n return getFilename(" } ], "deleted": [] }, "commit_link": "github.com/CauldronDevelopmentLLC/cbang/commit/1c1dba62bd3e6fa9d0d0c0aa21926043b75382c7", "file_name": "src/cbang/tar/TarFileReader.cpp", "func_name": "TarFileReader::extract", "line_changes": { "added": [ { "char_end": 224, "char_start": 180, "line": " if (SystemUtilities::isDirectory(path)) {\n", "line_no": 6 }, { "char_end": 257, "char_start": 224, "line": " path += \"/\" + getFilename();\n", "line_no": 7 }, { "char_end": 258, "char_start": 257, "line": "\n", "line_no": 8 }, { "char_end": 368, "char_start": 311, "line": " string a = SystemUtilities::getCanonicalPath(_path);\n", "line_no": 10 }, { "char_end": 424, "char_start": 368, "line": " string b = SystemUtilities::getCanonicalPath(path);\n", "line_no": 11 }, { "char_end": 459, "char_start": 424, "line": " if (!String::startsWith(b, a))\n", "line_no": 12 }, { "char_end": 537, "char_start": 459, "line": " THROW(\"Tar path points outside of the extraction directory: \" << path);\n", "line_no": 13 }, { "char_end": 541, "char_start": 537, "line": " }\n", "line_no": 14 }, { "char_end": 606, "char_start": 583, "line": " switch (getType()) {\n", "line_no": 18 }, { "char_end": 648, "char_start": 606, "line": " case NORMAL_FILE: case CONTIGUOUS_FILE:\n", "line_no": 19 }, { "char_end": 699, "char_start": 648, "line": " return extract(*SystemUtilities::oopen(path));\n", "line_no": 20 }, { "char_end": 764, "char_start": 699, "line": " case DIRECTORY: SystemUtilities::ensureDirectory(path); break;\n", "line_no": 21 }, { "char_end": 825, "char_start": 764, "line": " default: THROW(\"Unsupported tar file type \" << getType());\n", "line_no": 22 }, { "char_end": 829, "char_start": 825, "line": " }\n", "line_no": 23 }, { "char_end": 830, "char_start": 829, "line": "\n", "line_no": 24 }, { "char_end": 854, "char_start": 830, "line": " return getFilename();\n", "line_no": 25 } ], "deleted": [ { "char_end": 251, "char_start": 180, "line": " if (SystemUtilities::isDirectory(path)) path += \"/\" + getFilename();\n", "line_no": 6 }, { "char_end": 342, "char_start": 293, "line": " return extract(*SystemUtilities::oopen(path));\n", "line_no": 10 } ] }, "vul_type": "cwe-022" }
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 ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": 11867, "char_start": 11712, "chars": "\n\n if (!allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }" }, { "char_end": 16546, "char_start": 16068, "chars": "\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name\", element);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }" } ], "deleted": [] }, "commit_link": "github.com/abrt/abrt/commit/7a47f57975be0d285a2f20758e4572dca6d9cdd3", "file_name": "src/dbus/abrt-dbus.c", "func_name": "handle_method_call", "line_changes": { "added": [ { "char_end": 9119, "char_start": 9073, "line": " if (!allowed_problem_dir(problem_id))\n", "line_no": 259 }, { "char_end": 9129, "char_start": 9119, "line": " {\n", "line_no": 260 }, { "char_end": 9197, "char_start": 9129, "line": " return_InvalidProblemDir_error(invocation, problem_id);\n", "line_no": 261 }, { "char_end": 9217, "char_start": 9197, "line": " return;\n", "line_no": 262 }, { "char_end": 9227, "char_start": 9217, "line": " }\n", "line_no": 263 }, { "char_end": 9228, "char_start": 9227, "line": "\n", "line_no": 264 }, { "char_end": 11760, "char_start": 11714, "line": " if (!allowed_problem_dir(problem_id))\n", "line_no": 324 }, { "char_end": 11770, "char_start": 11760, "line": " {\n", "line_no": 325 }, { "char_end": 11838, "char_start": 11770, "line": " return_InvalidProblemDir_error(invocation, problem_id);\n", "line_no": 326 }, { "char_end": 11858, "char_start": 11838, "line": " return;\n", "line_no": 327 }, { "char_end": 11868, "char_start": 11858, "line": " }\n", "line_no": 328 }, { "char_end": 11869, "char_start": 11868, "line": "\n", "line_no": 329 }, { "char_end": 16117, "char_start": 16070, "line": " if (!str_is_correct_filename(element))\n", "line_no": 447 }, { "char_end": 16127, "char_start": 16117, "line": " {\n", "line_no": 448 }, { "char_end": 16196, "char_start": 16127, "line": " log_notice(\"'%s' is not a valid element name\", element);\n", "line_no": 449 }, { "char_end": 16281, "char_start": 16196, "line": " char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n", "line_no": 450 }, { "char_end": 16348, "char_start": 16281, "line": " g_dbus_method_invocation_return_dbus_error(invocation,\n", "line_no": 451 }, { "char_end": 16437, "char_start": 16348, "line": " \"org.freedesktop.problems.InvalidElement\",\n", "line_no": 452 }, { "char_end": 16491, "char_start": 16437, "line": " error);\n", "line_no": 453 }, { "char_end": 16492, "char_start": 16491, "line": "\n", "line_no": 454 }, { "char_end": 16517, "char_start": 16492, "line": " free(error);\n", "line_no": 455 }, { "char_end": 16537, "char_start": 16517, "line": " return;\n", "line_no": 456 }, { "char_end": 16547, "char_start": 16537, "line": " }\n", "line_no": 457 }, { "char_end": 16548, "char_start": 16547, "line": "\n", "line_no": 458 } ], "deleted": [] }, "vul_type": "cwe-022" }
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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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": 11867, "char_start": 11712, "chars": "\n\n if (!allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }" }, { "char_end": 16546, "char_start": 16068, "chars": "\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name\", element);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }" } ], "deleted": [] }, "commit_link": "github.com/abrt/abrt/commit/7a47f57975be0d285a2f20758e4572dca6d9cdd3", "file_name": "src/dbus/abrt-dbus.c", "func_name": "handle_method_call", "line_changes": { "added": [ { "char_end": 9119, "char_start": 9073, "line": " if (!allowed_problem_dir(problem_id))\n", "line_no": 259 }, { "char_end": 9129, "char_start": 9119, "line": " {\n", "line_no": 260 }, { "char_end": 9197, "char_start": 9129, "line": " return_InvalidProblemDir_error(invocation, problem_id);\n", "line_no": 261 }, { "char_end": 9217, "char_start": 9197, "line": " return;\n", "line_no": 262 }, { "char_end": 9227, "char_start": 9217, "line": " }\n", "line_no": 263 }, { "char_end": 9228, "char_start": 9227, "line": "\n", "line_no": 264 }, { "char_end": 11760, "char_start": 11714, "line": " if (!allowed_problem_dir(problem_id))\n", "line_no": 324 }, { "char_end": 11770, "char_start": 11760, "line": " {\n", "line_no": 325 }, { "char_end": 11838, "char_start": 11770, "line": " return_InvalidProblemDir_error(invocation, problem_id);\n", "line_no": 326 }, { "char_end": 11858, "char_start": 11838, "line": " return;\n", "line_no": 327 }, { "char_end": 11868, "char_start": 11858, "line": " }\n", "line_no": 328 }, { "char_end": 11869, "char_start": 11868, "line": "\n", "line_no": 329 }, { "char_end": 16117, "char_start": 16070, "line": " if (!str_is_correct_filename(element))\n", "line_no": 447 }, { "char_end": 16127, "char_start": 16117, "line": " {\n", "line_no": 448 }, { "char_end": 16196, "char_start": 16127, "line": " log_notice(\"'%s' is not a valid element name\", element);\n", "line_no": 449 }, { "char_end": 16281, "char_start": 16196, "line": " char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n", "line_no": 450 }, { "char_end": 16348, "char_start": 16281, "line": " g_dbus_method_invocation_return_dbus_error(invocation,\n", "line_no": 451 }, { "char_end": 16437, "char_start": 16348, "line": " \"org.freedesktop.problems.InvalidElement\",\n", "line_no": 452 }, { "char_end": 16491, "char_start": 16437, "line": " error);\n", "line_no": 453 }, { "char_end": 16492, "char_start": 16491, "line": "\n", "line_no": 454 }, { "char_end": 16517, "char_start": 16492, "line": " free(error);\n", "line_no": 455 }, { "char_end": 16537, "char_start": 16517, "line": " return;\n", "line_no": 456 }, { "char_end": 16547, "char_start": 16537, "line": " }\n", "line_no": 457 }, { "char_end": 16548, "char_start": 16547, "line": "\n", "line_no": 458 } ], "deleted": [] }, "vul_type": "cwe-022" }
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, 1, 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_" }, { "char_end": 105, "char_start": 100, "chars": "_with" }, { "char_end": 110, "char_start": 107, "chars": "_fs" }, { "char_end": 134, "char_start": 133, "chars": "\n" }, { "char_end": 246, "char_start": 245, "chars": "\n" }, { "char_end": 264, "char_start": 250, "chars": "args = []\n " }, { "char_end": 286, "char_start": 265, "chars": "f append:\n arg" }, { "char_end": 291, "char_start": 288, "chars": "app" }, { "char_end": 294, "char_start": 292, "chars": "nd" }, { "char_end": 298, "char_start": 296, "chars": "-a" }, { "char_end": 304, "char_start": 299, "chars": ")\n " }, { "char_end": 318, "char_start": 306, "chars": "rgs.append(a" }, { "char_end": 333, "char_start": 330, "chars": ")\n\n" }, { "char_end": 351, "char_start": 334, "chars": " kwargs = dict(" }, { "char_end": 435, "char_start": 392, "chars": "\n\n utils.execute('tee', *args, **kwargs)" } ], "deleted": [ { "char_end": 69, "char_start": 67, "chars": "s." }, { "char_end": 76, "char_start": 73, "chars": ".jo" }, { "char_end": 218, "char_start": 216, "chars": "ut" }, { "char_end": 220, "char_start": 219, "chars": "l" }, { "char_end": 224, "char_start": 222, "chars": "ex" }, { "char_end": 229, "char_start": 225, "chars": "cute" }, { "char_end": 234, "char_start": 231, "chars": "tee" }, { "char_end": 236, "char_start": 235, "chars": "," }, { "char_end": 251, "char_start": 250, "chars": "," }, { "char_end": 285, "char_start": 275, "chars": "\n " } ] }, "commit_link": "github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7", "file_name": "nova/virt/disk/api.py", "func_name": "_inject_file_into_fs", "line_changes": { "added": [ { "char_end": 60, "char_start": 0, "line": "def _inject_file_into_fs(fs, path, contents, append=False):\n", "line_no": 1 }, { "char_end": 133, "char_start": 60, "line": " absolute_path = _join_and_check_path_within_fs(fs, path.lstrip('/'))\n", "line_no": 2 }, { "char_end": 134, "char_start": 133, "line": "\n", "line_no": 3 }, { "char_end": 246, "char_start": 245, "line": "\n", "line_no": 6 }, { "char_end": 260, "char_start": 246, "line": " args = []\n", "line_no": 7 }, { "char_end": 275, "char_start": 260, "line": " if append:\n", "line_no": 8 }, { "char_end": 301, "char_start": 275, "line": " args.append('-a')\n", "line_no": 9 }, { "char_end": 332, "char_start": 301, "line": " args.append(absolute_path)\n", "line_no": 10 }, { "char_end": 333, "char_start": 332, "line": "\n", "line_no": 11 }, { "char_end": 393, "char_start": 333, "line": " kwargs = dict(process_input=contents, run_as_root=True)\n", "line_no": 12 }, { "char_end": 394, "char_start": 393, "line": "\n", "line_no": 13 }, { "char_end": 435, "char_start": 394, "line": " utils.execute('tee', *args, **kwargs)\n", "line_no": 14 } ], "deleted": [ { "char_end": 276, "char_start": 212, "line": " utils.execute('tee', absolute_path, process_input=contents,\n", "line_no": 5 }, { "char_end": 303, "char_start": 276, "line": " run_as_root=True)\n", "line_no": 6 } ] }, "vul_type": "cwe-022" }
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'...
[ 1, 1, 1, 1, 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_" }, { "char_end": 105, "char_start": 100, "chars": "_with" }, { "char_end": 110, "char_start": 107, "chars": "_fs" }, { "char_end": 134, "char_start": 133, "chars": "\n" }, { "char_end": 246, "char_start": 245, "chars": "\n" }, { "char_end": 264, "char_start": 250, "chars": "args = []\n " }, { "char_end": 286, "char_start": 265, "chars": "f append:\n arg" }, { "char_end": 291, "char_start": 288, "chars": "app" }, { "char_end": 294, "char_start": 292, "chars": "nd" }, { "char_end": 298, "char_start": 296, "chars": "-a" }, { "char_end": 304, "char_start": 299, "chars": ")\n " }, { "char_end": 318, "char_start": 306, "chars": "rgs.append(a" }, { "char_end": 333, "char_start": 330, "chars": ")\n\n" }, { "char_end": 351, "char_start": 334, "chars": " kwargs = dict(" }, { "char_end": 435, "char_start": 392, "chars": "\n\n utils.execute('tee', *args, **kwargs)" } ], "deleted": [ { "char_end": 69, "char_start": 67, "chars": "s." }, { "char_end": 76, "char_start": 73, "chars": ".jo" }, { "char_end": 218, "char_start": 216, "chars": "ut" }, { "char_end": 220, "char_start": 219, "chars": "l" }, { "char_end": 224, "char_start": 222, "chars": "ex" }, { "char_end": 229, "char_start": 225, "chars": "cute" }, { "char_end": 234, "char_start": 231, "chars": "tee" }, { "char_end": 236, "char_start": 235, "chars": "," }, { "char_end": 251, "char_start": 250, "chars": "," }, { "char_end": 285, "char_start": 275, "chars": "\n " } ] }, "commit_link": "github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7", "file_name": "nova/virt/disk/api.py", "func_name": "_inject_file_into_fs", "line_changes": { "added": [ { "char_end": 60, "char_start": 0, "line": "def _inject_file_into_fs(fs, path, contents, append=False):\n", "line_no": 1 }, { "char_end": 133, "char_start": 60, "line": " absolute_path = _join_and_check_path_within_fs(fs, path.lstrip('/'))\n", "line_no": 2 }, { "char_end": 134, "char_start": 133, "line": "\n", "line_no": 3 }, { "char_end": 246, "char_start": 245, "line": "\n", "line_no": 6 }, { "char_end": 260, "char_start": 246, "line": " args = []\n", "line_no": 7 }, { "char_end": 275, "char_start": 260, "line": " if append:\n", "line_no": 8 }, { "char_end": 301, "char_start": 275, "line": " args.append('-a')\n", "line_no": 9 }, { "char_end": 332, "char_start": 301, "line": " args.append(absolute_path)\n", "line_no": 10 }, { "char_end": 333, "char_start": 332, "line": "\n", "line_no": 11 }, { "char_end": 393, "char_start": 333, "line": " kwargs = dict(process_input=contents, run_as_root=True)\n", "line_no": 12 }, { "char_end": 394, "char_start": 393, "line": "\n", "line_no": 13 }, { "char_end": 435, "char_start": 394, "line": " utils.execute('tee', *args, **kwargs)\n", "line_no": 14 } ], "deleted": [ { "char_end": 276, "char_start": 212, "line": " utils.execute('tee', absolute_path, process_input=contents,\n", "line_no": 5 }, { "char_end": 303, "char_start": 276, "line": " run_as_root=True)\n", "line_no": 6 } ] }, "vul_type": "cwe-022" }
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, 0, 1, 1, 1, 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/92e22ca23e52066da2258df8c76a2dca8a428bcc", "file_name": "device-linux.c", "func_name": "set_interface_var", "line_changes": { "added": [ { "char_end": 264, "char_start": 239, "line": "\t/* No path traversal */\n", "line_no": 10 }, { "char_end": 310, "char_start": 264, "line": "\tif (strstr(name, \"..\") || strchr(name, '/'))\n", "line_no": 11 }, { "char_end": 323, "char_start": 310, "line": "\t\treturn -1;\n", "line_no": 12 }, { "char_end": 324, "char_start": 323, "line": "\n", "line_no": 13 } ], "deleted": [] }, "vul_type": "cwe-022" }
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, \"..\...
[ 1, 1, 1, 1, 1, 1, 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/92e22ca23e52066da2258df8c76a2dca8a428bcc", "file_name": "device-linux.c", "func_name": "set_interface_var", "line_changes": { "added": [ { "char_end": 264, "char_start": 239, "line": "\t/* No path traversal */\n", "line_no": 10 }, { "char_end": 310, "char_start": 264, "line": "\tif (strstr(name, \"..\") || strchr(name, '/'))\n", "line_no": 11 }, { "char_end": 323, "char_start": 310, "line": "\t\treturn -1;\n", "line_no": 12 }, { "char_end": 324, "char_start": 323, "line": "\n", "line_no": 13 } ], "deleted": [] }, "vul_type": "cwe-022" }
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 CSStore...
[ 1, 0, 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" }, { "char_end": 85, "char_start": 83, "chars": "y(" } ], "deleted": [ { "char_end": 79, "char_start": 66, "chars": "os.path.join(" }, { "char_end": 85, "char_start": 84, "chars": "n" }, { "char_end": 88, "char_start": 86, "chars": "me" }, { "char_end": 92, "char_start": 89, "chars": "pac" }, { "char_end": 95, "char_start": 93, "chars": ", " } ] }, "commit_link": "github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4", "file_name": "custodia/store/etcdstore.py", "func_name": "cut", "line_changes": { "added": [ { "char_end": 91, "char_start": 37, "line": " self.etcd.delete(self._absolute_key(key))\n", "line_no": 3 } ], "deleted": [ { "char_end": 101, "char_start": 37, "line": " self.etcd.delete(os.path.join(self.namespace, key))\n", "line_no": 3 } ] }, "vul_type": "cwe-022" }
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('Err...
[ 1, 1, 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" }, { "char_end": 85, "char_start": 83, "chars": "y(" } ], "deleted": [ { "char_end": 79, "char_start": 66, "chars": "os.path.join(" }, { "char_end": 85, "char_start": 84, "chars": "n" }, { "char_end": 88, "char_start": 86, "chars": "me" }, { "char_end": 92, "char_start": 89, "chars": "pac" }, { "char_end": 95, "char_start": 93, "chars": ", " } ] }, "commit_link": "github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4", "file_name": "custodia/store/etcdstore.py", "func_name": "cut", "line_changes": { "added": [ { "char_end": 91, "char_start": 37, "line": " self.etcd.delete(self._absolute_key(key))\n", "line_no": 3 } ], "deleted": [ { "char_end": 101, "char_start": 37, "line": " self.etcd.delete(os.path.join(self.namespace, key))\n", "line_no": 3 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 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, "chars": "trchr" }, { "char_end": 1372, "char_start": 1367, "chars": ", '/'" } ] }, "commit_link": "github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea", "file_name": "src/wiki.c", "func_name": "wiki_handle_http_request", "line_changes": { "added": [ { "char_end": 1382, "char_start": 1350, "line": " if (!page_name_is_good(page))\n", "line_no": 54 } ], "deleted": [ { "char_end": 1375, "char_start": 1350, "line": " if (strchr(page, '/'))\n", "line_no": 54 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, "chars": "trchr" }, { "char_end": 1372, "char_start": 1367, "chars": ", '/'" } ] }, "commit_link": "github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea", "file_name": "src/wiki.c", "func_name": "wiki_handle_http_request", "line_changes": { "added": [ { "char_end": 1382, "char_start": 1350, "line": " if (!page_name_is_good(page))\n", "line_no": 54 } ], "deleted": [ { "char_end": 1375, "char_start": 1350, "line": " if (strchr(page, '/'))\n", "line_no": 54 } ] }, "vul_type": "cwe-022" }
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):])" ]
[ 1, 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" } ], "deleted": [ { "char_end": 150, "char_start": 145, "chars": "yield" } ] }, "commit_link": "github.com/evansd/whitenoise/commit/4d8a3ab1e97d7ddb18b3fa8b4909c92bad5529c6", "file_name": "whitenoise/base.py", "func_name": "candidate_paths_for_url", "line_changes": { "added": [ { "char_end": 190, "char_start": 129, "line": " path = os.path.join(root, url[len(prefix):])\n", "line_no": 4 }, { "char_end": 253, "char_start": 190, "line": " if os.path.commonprefix((root, path)) == root:\n", "line_no": 5 }, { "char_end": 283, "char_start": 253, "line": " yield path\n", "line_no": 6 } ], "deleted": [ { "char_end": 188, "char_start": 129, "line": " yield os.path.join(root, url[len(prefix):])\n", "line_no": 4 } ] }, "vul_type": "cwe-022" }
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, 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" } ], "deleted": [ { "char_end": 150, "char_start": 145, "chars": "yield" } ] }, "commit_link": "github.com/evansd/whitenoise/commit/4d8a3ab1e97d7ddb18b3fa8b4909c92bad5529c6", "file_name": "whitenoise/base.py", "func_name": "candidate_paths_for_url", "line_changes": { "added": [ { "char_end": 190, "char_start": 129, "line": " path = os.path.join(root, url[len(prefix):])\n", "line_no": 4 }, { "char_end": 253, "char_start": 190, "line": " if os.path.commonprefix((root, path)) == root:\n", "line_no": 5 }, { "char_end": 283, "char_start": 253, "line": " yield path\n", "line_no": 6 } ], "deleted": [ { "char_end": 188, "char_start": 129, "line": " yield os.path.join(root, url[len(prefix):])\n", "line_no": 4 } ] }, "vul_type": "cwe-022" }
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\ttok...
[ 1, 1, 0, 1, 0, 1, 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/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833", "file_name": "impl.py", "func_name": "updateKey", "line_changes": { "added": [ { "char_end": 408, "char_start": 371, "line": "\tvalidateKeyName(token_data['name'])\n", "line_no": 12 } ], "deleted": [ { "char_end": 234, "char_start": 233, "line": "\n", "line_no": 9 } ] }, "vul_type": "cwe-022" }
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\ttok...
[ 1, 1, 1, 1, 1, 1, 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/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833", "file_name": "impl.py", "func_name": "updateKey", "line_changes": { "added": [ { "char_end": 408, "char_start": 371, "line": "\tvalidateKeyName(token_data['name'])\n", "line_no": 12 } ], "deleted": [ { "char_end": 234, "char_start": 233, "line": "\n", "line_no": 9 } ] }, "vul_type": "cwe-022" }
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 basena...
[ 1, 0, 1, 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" }, { "char_end": 168, "char_start": 167, "chars": "[" }, { "char_end": 173, "char_start": 169, "chars": "\\./]" }, { "char_end": 177, "char_start": 176, "chars": "r" }, { "char_end": 190, "char_start": 180, "chars": ", basename" } ], "deleted": [ { "char_end": 165, "char_start": 158, "chars": "basenam" }, { "char_end": 175, "char_start": 168, "chars": "eplace(" } ] }, "commit_link": "github.com/syegulalp/mercury/commit/3f7c7442fa49aec37577dbdb47ce11a848e7bd03", "file_name": "MeTal/core/utils.py", "func_name": "create_basename_core", "line_changes": { "added": [ { "char_end": 192, "char_start": 143, "line": " basename = re.sub(r'[ \\./]', r'-', basename)\n", "line_no": 7 } ], "deleted": [ { "char_end": 185, "char_start": 143, "line": " basename = basename.replace(' ', '-')\n", "line_no": 7 } ] }, "vul_type": "cwe-022" }
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 ...
[ 1, 1, 1, 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" }, { "char_end": 168, "char_start": 167, "chars": "[" }, { "char_end": 173, "char_start": 169, "chars": "\\./]" }, { "char_end": 177, "char_start": 176, "chars": "r" }, { "char_end": 190, "char_start": 180, "chars": ", basename" } ], "deleted": [ { "char_end": 165, "char_start": 158, "chars": "basenam" }, { "char_end": 175, "char_start": 168, "chars": "eplace(" } ] }, "commit_link": "github.com/syegulalp/mercury/commit/3f7c7442fa49aec37577dbdb47ce11a848e7bd03", "file_name": "MeTal/core/utils.py", "func_name": "create_basename_core", "line_changes": { "added": [ { "char_end": 192, "char_start": 143, "line": " basename = re.sub(r'[ \\./]', r'-', basename)\n", "line_no": 7 } ], "deleted": [ { "char_end": 185, "char_start": 143, "line": " basename = basename.replace(' ', '-')\n", "line_no": 7 } ] }, "vul_type": "cwe-022" }
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 r...
[ 1, 0, 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" }, { "char_end": 91, "char_start": 89, "chars": "y(" } ], "deleted": [ { "char_end": 85, "char_start": 72, "chars": "os.path.join(" }, { "char_end": 91, "char_start": 90, "chars": "n" }, { "char_end": 94, "char_start": 92, "chars": "me" }, { "char_end": 98, "char_start": 95, "chars": "pac" }, { "char_end": 101, "char_start": 99, "chars": ", " } ] }, "commit_link": "github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4", "file_name": "custodia/store/etcdstore.py", "func_name": "get", "line_changes": { "added": [ { "char_end": 97, "char_start": 37, "line": " result = self.etcd.get(self._absolute_key(key))\n", "line_no": 3 } ], "deleted": [ { "char_end": 107, "char_start": 37, "line": " result = self.etcd.get(os.path.join(self.namespace, key))\n", "line_no": 3 } ] }, "vul_type": "cwe-022" }
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 resu...
[ 1, 1, 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" }, { "char_end": 91, "char_start": 89, "chars": "y(" } ], "deleted": [ { "char_end": 85, "char_start": 72, "chars": "os.path.join(" }, { "char_end": 91, "char_start": 90, "chars": "n" }, { "char_end": 94, "char_start": 92, "chars": "me" }, { "char_end": 98, "char_start": 95, "chars": "pac" }, { "char_end": 101, "char_start": 99, "chars": ", " } ] }, "commit_link": "github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4", "file_name": "custodia/store/etcdstore.py", "func_name": "get", "line_changes": { "added": [ { "char_end": 97, "char_start": 37, "line": " result = self.etcd.get(self._absolute_key(key))\n", "line_no": 3 } ], "deleted": [ { "char_end": 107, "char_start": 37, "line": " result = self.etcd.get(os.path.join(self.namespace, key))\n", "line_no": 3 } ] }, "vul_type": "cwe-022" }
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 = b...
[ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 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 + alias_len + 1;\n\t\t\t\tif (*s == '.') ++s;\n\t\t\t\tif (*s == '/' || *s == '\\0') {\n\t\t\t\t\tsize_t vlen = buffer_string_length(ds->value);\n\t\t\t\t\tif (0 != alias_len && ds->key->ptr[alias_len-1] != '/'\n\t\t\t\t\t && 0 != vlen && ds->value->ptr[vlen-1] == '/') {\n\t\t\t\t\t\tcon->http_status = 403;\n\t\t\t\t\t\treturn HANDLER_FINISHED;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t" } ], "deleted": [] }, "commit_link": "github.com/lighttpd/lighttpd1.4/commit/2105dae0f9d7a964375ce681e53cb165375f84c1", "file_name": "src/mod_alias.c", "func_name": "PHYSICALPATH_FUNC", "line_changes": { "added": [ { "char_end": 994, "char_start": 928, "line": "\t\t\t/* check for path traversal in url-path following alias if key\n", "line_no": 29 }, { "char_end": 1062, "char_start": 994, "line": "\t\t\t * does not end in slash, but replacement value ends in slash */\n", "line_no": 30 }, { "char_end": 1098, "char_start": 1062, "line": "\t\t\tif (uri_ptr[alias_len] == '.') {\n", "line_no": 31 }, { "char_end": 1137, "char_start": 1098, "line": "\t\t\t\tchar *s = uri_ptr + alias_len + 1;\n", "line_no": 32 }, { "char_end": 1161, "char_start": 1137, "line": "\t\t\t\tif (*s == '.') ++s;\n", "line_no": 33 }, { "char_end": 1196, "char_start": 1161, "line": "\t\t\t\tif (*s == '/' || *s == '\\0') {\n", "line_no": 34 }, { "char_end": 1248, "char_start": 1196, "line": "\t\t\t\t\tsize_t vlen = buffer_string_length(ds->value);\n", "line_no": 35 }, { "char_end": 1308, "char_start": 1248, "line": "\t\t\t\t\tif (0 != alias_len && ds->key->ptr[alias_len-1] != '/'\n", "line_no": 36 }, { "char_end": 1366, "char_start": 1308, "line": "\t\t\t\t\t && 0 != vlen && ds->value->ptr[vlen-1] == '/') {\n", "line_no": 37 }, { "char_end": 1396, "char_start": 1366, "line": "\t\t\t\t\t\tcon->http_status = 403;\n", "line_no": 38 }, { "char_end": 1427, "char_start": 1396, "line": "\t\t\t\t\t\treturn HANDLER_FINISHED;\n", "line_no": 39 }, { "char_end": 1434, "char_start": 1427, "line": "\t\t\t\t\t}\n", "line_no": 40 }, { "char_end": 1440, "char_start": 1434, "line": "\t\t\t\t}\n", "line_no": 41 }, { "char_end": 1445, "char_start": 1440, "line": "\t\t\t}\n", "line_no": 42 }, { "char_end": 1446, "char_start": 1445, "line": "\n", "line_no": 43 } ], "deleted": [] }, "vul_type": "cwe-022" }
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 = b...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 + alias_len + 1;\n\t\t\t\tif (*s == '.') ++s;\n\t\t\t\tif (*s == '/' || *s == '\\0') {\n\t\t\t\t\tsize_t vlen = buffer_string_length(ds->value);\n\t\t\t\t\tif (0 != alias_len && ds->key->ptr[alias_len-1] != '/'\n\t\t\t\t\t && 0 != vlen && ds->value->ptr[vlen-1] == '/') {\n\t\t\t\t\t\tcon->http_status = 403;\n\t\t\t\t\t\treturn HANDLER_FINISHED;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t" } ], "deleted": [] }, "commit_link": "github.com/lighttpd/lighttpd1.4/commit/2105dae0f9d7a964375ce681e53cb165375f84c1", "file_name": "src/mod_alias.c", "func_name": "PHYSICALPATH_FUNC", "line_changes": { "added": [ { "char_end": 994, "char_start": 928, "line": "\t\t\t/* check for path traversal in url-path following alias if key\n", "line_no": 29 }, { "char_end": 1062, "char_start": 994, "line": "\t\t\t * does not end in slash, but replacement value ends in slash */\n", "line_no": 30 }, { "char_end": 1098, "char_start": 1062, "line": "\t\t\tif (uri_ptr[alias_len] == '.') {\n", "line_no": 31 }, { "char_end": 1137, "char_start": 1098, "line": "\t\t\t\tchar *s = uri_ptr + alias_len + 1;\n", "line_no": 32 }, { "char_end": 1161, "char_start": 1137, "line": "\t\t\t\tif (*s == '.') ++s;\n", "line_no": 33 }, { "char_end": 1196, "char_start": 1161, "line": "\t\t\t\tif (*s == '/' || *s == '\\0') {\n", "line_no": 34 }, { "char_end": 1248, "char_start": 1196, "line": "\t\t\t\t\tsize_t vlen = buffer_string_length(ds->value);\n", "line_no": 35 }, { "char_end": 1308, "char_start": 1248, "line": "\t\t\t\t\tif (0 != alias_len && ds->key->ptr[alias_len-1] != '/'\n", "line_no": 36 }, { "char_end": 1366, "char_start": 1308, "line": "\t\t\t\t\t && 0 != vlen && ds->value->ptr[vlen-1] == '/') {\n", "line_no": 37 }, { "char_end": 1396, "char_start": 1366, "line": "\t\t\t\t\t\tcon->http_status = 403;\n", "line_no": 38 }, { "char_end": 1427, "char_start": 1396, "line": "\t\t\t\t\t\treturn HANDLER_FINISHED;\n", "line_no": 39 }, { "char_end": 1434, "char_start": 1427, "line": "\t\t\t\t\t}\n", "line_no": 40 }, { "char_end": 1440, "char_start": 1434, "line": "\t\t\t\t}\n", "line_no": 41 }, { "char_end": 1445, "char_start": 1440, "line": "\t\t\t}\n", "line_no": 42 }, { "char_end": 1446, "char_start": 1445, "line": "\n", "line_no": 43 } ], "deleted": [] }, "vul_type": "cwe-022" }
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...
[ 1, 0, 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 'invalid_file'\n # CVE-2015-8309: do not allow absolute file paths\n if os.path.isabs(f)" } ], "deleted": [] }, "commit_link": "github.com/devsnd/cherrymusic/commit/62dec34a1ea0741400dd6b6c660d303dcd651e86", "file_name": "cherrymusicserver/httphandler.py", "func_name": "download_check_files", "line_changes": { "added": [ { "char_end": 494, "char_start": 443, "line": " if '/../' in f or f.startswith('../'):\n", "line_no": 10 }, { "char_end": 532, "char_start": 494, "line": " return 'invalid_file'\n", "line_no": 11 }, { "char_end": 627, "char_start": 594, "line": " if os.path.isabs(f):\n", "line_no": 13 } ], "deleted": [ { "char_end": 411, "char_start": 383, "line": " if '/../' in f:\n", "line_no": 9 } ] }, "vul_type": "cwe-022" }
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, 1, 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 'invalid_file'\n # CVE-2015-8309: do not allow absolute file paths\n if os.path.isabs(f)" } ], "deleted": [] }, "commit_link": "github.com/devsnd/cherrymusic/commit/62dec34a1ea0741400dd6b6c660d303dcd651e86", "file_name": "cherrymusicserver/httphandler.py", "func_name": "download_check_files", "line_changes": { "added": [ { "char_end": 494, "char_start": 443, "line": " if '/../' in f or f.startswith('../'):\n", "line_no": 10 }, { "char_end": 532, "char_start": 494, "line": " return 'invalid_file'\n", "line_no": 11 }, { "char_end": 627, "char_start": 594, "line": " if os.path.isabs(f):\n", "line_no": 13 } ], "deleted": [ { "char_end": 411, "char_start": 383, "line": " if '/../' in f:\n", "line_no": 9 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 0, 1, 0, 1, 1, 0, 1, 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" }, { "char_end": 870, "char_start": 857, "chars": "sanitize=True" } ], "deleted": [ { "char_end": 661, "char_start": 631, "chars": "data[\"data\"])\n " }, { "char_end": 675, "char_start": 665, "chars": "data = ope" }, { "char_end": 682, "char_start": 676, "chars": "(filep" }, { "char_end": 694, "char_start": 683, "chars": "th, \"rb\").r" }, { "char_end": 698, "char_start": 695, "chars": "ad(" }, { "char_end": 796, "char_start": 776, "chars": "name, contents=filed" }, { "char_end": 799, "char_start": 798, "chars": "a" }, { "char_end": 820, "char_start": 800, "chars": "\n " }, { "char_end": 1806, "char_start": 1791, "chars": "{\n \"" }, { "char_end": 1867, "char_start": 1811, "chars": "\": files,\n \"path\": submit.tmp_path,\n }" } ] }, "commit_link": "github.com/cuckoosandbox/cuckoo/commit/168cabf86730d56b7fa319278bf0f0034052666a", "file_name": "cuckoo/core/submit.py", "func_name": "get_files", "line_changes": { "added": [ { "char_end": 641, "char_start": 574, "line": " filepath = os.path.join(submit.tmp_path, filename)\n", "line_no": 14 }, { "char_end": 764, "char_start": 684, "line": " filepath=filepath, password=password, duplicates=duplicates\n", "line_no": 17 }, { "char_end": 872, "char_start": 810, "line": " unpacked = unpacked.astree(sanitize=True)\n", "line_no": 21 }, { "char_end": 1711, "char_start": 1691, "line": " return files\n", "line_no": 47 } ], "deleted": [ { "char_end": 645, "char_start": 574, "line": " filepath = os.path.join(submit.tmp_path, data[\"data\"])\n", "line_no": 14 }, { "char_end": 700, "char_start": 645, "line": " filedata = open(filepath, \"rb\").read()\n", "line_no": 15 }, { "char_end": 801, "char_start": 743, "line": " filepath=filename, contents=filedata,\n", "line_no": 18 }, { "char_end": 862, "char_start": 801, "line": " password=password, duplicates=duplicates\n", "line_no": 19 }, { "char_end": 957, "char_start": 908, "line": " unpacked = unpacked.astree()\n", "line_no": 23 }, { "char_end": 1793, "char_start": 1776, "line": " return {\n", "line_no": 49 }, { "char_end": 1821, "char_start": 1793, "line": " \"files\": files,\n", "line_no": 50 }, { "char_end": 1858, "char_start": 1821, "line": " \"path\": submit.tmp_path,\n", "line_no": 51 }, { "char_end": 1867, "char_start": 1858, "line": " }\n", "line_no": 52 } ] }, "vul_type": "cwe-022" }
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, 1, 1, 1, 1, 1, 1, 1, 1, 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" }, { "char_end": 870, "char_start": 857, "chars": "sanitize=True" } ], "deleted": [ { "char_end": 661, "char_start": 631, "chars": "data[\"data\"])\n " }, { "char_end": 675, "char_start": 665, "chars": "data = ope" }, { "char_end": 682, "char_start": 676, "chars": "(filep" }, { "char_end": 694, "char_start": 683, "chars": "th, \"rb\").r" }, { "char_end": 698, "char_start": 695, "chars": "ad(" }, { "char_end": 796, "char_start": 776, "chars": "name, contents=filed" }, { "char_end": 799, "char_start": 798, "chars": "a" }, { "char_end": 820, "char_start": 800, "chars": "\n " }, { "char_end": 1806, "char_start": 1791, "chars": "{\n \"" }, { "char_end": 1867, "char_start": 1811, "chars": "\": files,\n \"path\": submit.tmp_path,\n }" } ] }, "commit_link": "github.com/cuckoosandbox/cuckoo/commit/168cabf86730d56b7fa319278bf0f0034052666a", "file_name": "cuckoo/core/submit.py", "func_name": "get_files", "line_changes": { "added": [ { "char_end": 641, "char_start": 574, "line": " filepath = os.path.join(submit.tmp_path, filename)\n", "line_no": 14 }, { "char_end": 764, "char_start": 684, "line": " filepath=filepath, password=password, duplicates=duplicates\n", "line_no": 17 }, { "char_end": 872, "char_start": 810, "line": " unpacked = unpacked.astree(sanitize=True)\n", "line_no": 21 }, { "char_end": 1711, "char_start": 1691, "line": " return files\n", "line_no": 47 } ], "deleted": [ { "char_end": 645, "char_start": 574, "line": " filepath = os.path.join(submit.tmp_path, data[\"data\"])\n", "line_no": 14 }, { "char_end": 700, "char_start": 645, "line": " filedata = open(filepath, \"rb\").read()\n", "line_no": 15 }, { "char_end": 801, "char_start": 743, "line": " filepath=filename, contents=filedata,\n", "line_no": 18 }, { "char_end": 862, "char_start": 801, "line": " password=password, duplicates=duplicates\n", "line_no": 19 }, { "char_end": 957, "char_start": 908, "line": " unpacked = unpacked.astree()\n", "line_no": 23 }, { "char_end": 1793, "char_start": 1776, "line": " return {\n", "line_no": 49 }, { "char_end": 1821, "char_start": 1793, "line": " \"files\": files,\n", "line_no": 50 }, { "char_end": 1858, "char_start": 1821, "line": " \"path\": submit.tmp_path,\n", "line_no": 51 }, { "char_end": 1867, "char_start": 1858, "line": " }\n", "line_no": 52 } ] }, "vul_type": "cwe-022" }
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 ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 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." } ] }, "commit_link": "github.com/fkmclane/python-fooster-web/commit/80202a6d3788ad1212a162d19785c600025e6aa4", "file_name": "fooster/web/web.py", "func_name": "handle", "line_changes": { "added": [ { "char_end": 1829, "char_start": 1744, "line": " self.method, resource, self.request_http = self.request_line.split()\n", "line_no": 53 }, { "char_end": 1892, "char_start": 1829, "line": " self.resource = urllib.parse.unquote(resource)\n", "line_no": 54 } ], "deleted": [ { "char_end": 1834, "char_start": 1744, "line": " self.method, self.resource, self.request_http = self.request_line.split()\n", "line_no": 53 } ] }, "vul_type": "cwe-022" }
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 ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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." } ] }, "commit_link": "github.com/fkmclane/python-fooster-web/commit/80202a6d3788ad1212a162d19785c600025e6aa4", "file_name": "fooster/web/web.py", "func_name": "handle", "line_changes": { "added": [ { "char_end": 1829, "char_start": 1744, "line": " self.method, resource, self.request_http = self.request_line.split()\n", "line_no": 53 }, { "char_end": 1892, "char_start": 1829, "line": " self.resource = urllib.parse.unquote(resource)\n", "line_no": 54 } ], "deleted": [ { "char_end": 1834, "char_start": 1744, "line": " self.method, self.resource, self.request_http = self.request_line.split()\n", "line_no": 53 } ] }, "vul_type": "cwe-022" }
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 ...
[ 1, 0, 1, 1, 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/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_delete_item", "line_changes": { "added": [ { "char_end": 185, "char_start": 145, "line": " if (!str_is_correct_filename(name))\n", "line_no": 6 }, { "char_end": 271, "char_start": 185, "line": " error_msg_and_die(\"Cannot delete item. '%s' is not a valid file name\", name);\n", "line_no": 7 }, { "char_end": 272, "char_start": 271, "line": "\n", "line_no": 8 } ], "deleted": [] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 1, 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/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_delete_item", "line_changes": { "added": [ { "char_end": 185, "char_start": 145, "line": " if (!str_is_correct_filename(name))\n", "line_no": 6 }, { "char_end": 271, "char_start": 185, "line": " error_msg_and_die(\"Cannot delete item. '%s' is not a valid file name\", name);\n", "line_no": 7 }, { "char_end": 272, "char_start": 271, "line": "\n", "line_no": 8 } ], "deleted": [] }, "vul_type": "cwe-022" }
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.real...
[ 1, 1, 0, 1, 1, 1, 1, 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, "chars": "_" }, { "char_end": 247, "char_start": 241, "chars": "lashes" } ], "deleted": [ { "char_end": 227, "char_start": 186, "chars": ".decode('utf-8', 'ignore').encode('utf-8'" }, { "char_end": 244, "char_start": 243, "chars": "r" }, { "char_end": 246, "char_start": 245, "chars": "." }, { "char_end": 249, "char_start": 247, "chars": "ub" }, { "char_end": 262, "char_start": 250, "chars": "\"^/+\", \"/\", " } ] }, "commit_link": "github.com/E2OpenPlugins/e2openplugin-OpenWebif/commit/a846b7664eda3a4c51a452e00638cf7337dc2013", "file_name": "plugin/controllers/file.py", "func_name": "render", "line_changes": { "added": [ { "char_end": 208, "char_start": 149, "line": "\t\t\tfilename = lenient_force_utf_8(request.args[\"file\"][0])\n", "line_no": 7 }, { "char_end": 276, "char_start": 208, "line": "\t\t\tfilename = sanitise_filename_slashes(os.path.realpath(filename))\n", "line_no": 8 } ], "deleted": [ { "char_end": 229, "char_start": 149, "line": "\t\t\tfilename = request.args[\"file\"][0].decode('utf-8', 'ignore').encode('utf-8')\n", "line_no": 7 }, { "char_end": 290, "char_start": 229, "line": "\t\t\tfilename = re.sub(\"^/+\", \"/\", os.path.realpath(filename))\n", "line_no": 8 } ] }, "vul_type": "cwe-022" }
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))", ...
[ 1, 1, 1, 1, 1, 1, 1, 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, "chars": "_" }, { "char_end": 247, "char_start": 241, "chars": "lashes" } ], "deleted": [ { "char_end": 227, "char_start": 186, "chars": ".decode('utf-8', 'ignore').encode('utf-8'" }, { "char_end": 244, "char_start": 243, "chars": "r" }, { "char_end": 246, "char_start": 245, "chars": "." }, { "char_end": 249, "char_start": 247, "chars": "ub" }, { "char_end": 262, "char_start": 250, "chars": "\"^/+\", \"/\", " } ] }, "commit_link": "github.com/E2OpenPlugins/e2openplugin-OpenWebif/commit/a846b7664eda3a4c51a452e00638cf7337dc2013", "file_name": "plugin/controllers/file.py", "func_name": "render", "line_changes": { "added": [ { "char_end": 208, "char_start": 149, "line": "\t\t\tfilename = lenient_force_utf_8(request.args[\"file\"][0])\n", "line_no": 7 }, { "char_end": 276, "char_start": 208, "line": "\t\t\tfilename = sanitise_filename_slashes(os.path.realpath(filename))\n", "line_no": 8 } ], "deleted": [ { "char_end": 229, "char_start": 149, "line": "\t\t\tfilename = request.args[\"file\"][0].decode('utf-8', 'ignore').encode('utf-8')\n", "line_no": 7 }, { "char_end": 290, "char_start": 229, "line": "\t\t\tfilename = re.sub(\"^/+\", \"/\", os.path.realpath(filename))\n", "line_no": 8 } ] }, "vul_type": "cwe-022" }
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_ro...
[ 1, 1, 0, 1, 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" }, { "char_end": 224, "char_start": 221, "chars": "_fs" }, { "char_end": 431, "char_start": 430, "chars": "\n" }, { "char_end": 466, "char_start": 458, "chars": "'etc', '" }, { "char_end": 471, "char_start": 469, "chars": "wo" }, { "char_end": 474, "char_start": 472, "chars": "k'" }, { "char_end": 495, "char_start": 494, "chars": "_" }, { "char_end": 498, "char_start": 496, "chars": "nj" }, { "char_end": 505, "char_start": 501, "chars": "_fil" }, { "char_end": 509, "char_start": 506, "chars": "_in" }, { "char_end": 517, "char_start": 510, "chars": "o_fs(fs" } ], "deleted": [ { "char_end": 202, "char_start": 194, "chars": "os.path." }, { "char_end": 210, "char_start": 206, "chars": "(os." }, { "char_end": 217, "char_start": 214, "chars": ".jo" }, { "char_end": 230, "char_start": 229, "chars": ")" }, { "char_end": 458, "char_start": 456, "chars": "di" }, { "char_end": 480, "char_start": 479, "chars": "u" }, { "char_end": 485, "char_start": 483, "chars": "s." }, { "char_end": 490, "char_start": 486, "chars": "xecu" }, { "char_end": 492, "char_start": 491, "chars": "e" }, { "char_end": 498, "char_start": 493, "chars": "'tee'" }, { "char_end": 523, "char_start": 509, "chars": "process_input=" }, { "char_end": 544, "char_start": 526, "chars": ", run_as_root=True" } ] }, "commit_link": "github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7", "file_name": "nova/virt/disk/api.py", "func_name": "_inject_net_into_fs", "line_changes": { "added": [ { "char_end": 247, "char_start": 181, "line": " netdir = _join_and_check_path_within_fs(fs, 'etc', 'network')\n", "line_no": 6 }, { "char_end": 431, "char_start": 430, "line": "\n", "line_no": 10 }, { "char_end": 490, "char_start": 431, "line": " netfile = os.path.join('etc', 'network', 'interfaces')\n", "line_no": 11 }, { "char_end": 532, "char_start": 490, "line": " _inject_file_into_fs(fs, netfile, net)\n", "line_no": 12 } ], "deleted": [ { "char_end": 243, "char_start": 181, "line": " netdir = os.path.join(os.path.join(fs, 'etc'), 'network')\n", "line_no": 6 }, { "char_end": 475, "char_start": 426, "line": " netfile = os.path.join(netdir, 'interfaces')\n", "line_no": 10 }, { "char_end": 545, "char_start": 475, "line": " utils.execute('tee', netfile, process_input=net, run_as_root=True)\n", "line_no": 11 } ] }, "vul_type": "cwe-022" }
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_a...
[ 1, 1, 1, 1, 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" }, { "char_end": 224, "char_start": 221, "chars": "_fs" }, { "char_end": 431, "char_start": 430, "chars": "\n" }, { "char_end": 466, "char_start": 458, "chars": "'etc', '" }, { "char_end": 471, "char_start": 469, "chars": "wo" }, { "char_end": 474, "char_start": 472, "chars": "k'" }, { "char_end": 495, "char_start": 494, "chars": "_" }, { "char_end": 498, "char_start": 496, "chars": "nj" }, { "char_end": 505, "char_start": 501, "chars": "_fil" }, { "char_end": 509, "char_start": 506, "chars": "_in" }, { "char_end": 517, "char_start": 510, "chars": "o_fs(fs" } ], "deleted": [ { "char_end": 202, "char_start": 194, "chars": "os.path." }, { "char_end": 210, "char_start": 206, "chars": "(os." }, { "char_end": 217, "char_start": 214, "chars": ".jo" }, { "char_end": 230, "char_start": 229, "chars": ")" }, { "char_end": 458, "char_start": 456, "chars": "di" }, { "char_end": 480, "char_start": 479, "chars": "u" }, { "char_end": 485, "char_start": 483, "chars": "s." }, { "char_end": 490, "char_start": 486, "chars": "xecu" }, { "char_end": 492, "char_start": 491, "chars": "e" }, { "char_end": 498, "char_start": 493, "chars": "'tee'" }, { "char_end": 523, "char_start": 509, "chars": "process_input=" }, { "char_end": 544, "char_start": 526, "chars": ", run_as_root=True" } ] }, "commit_link": "github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7", "file_name": "nova/virt/disk/api.py", "func_name": "_inject_net_into_fs", "line_changes": { "added": [ { "char_end": 247, "char_start": 181, "line": " netdir = _join_and_check_path_within_fs(fs, 'etc', 'network')\n", "line_no": 6 }, { "char_end": 431, "char_start": 430, "line": "\n", "line_no": 10 }, { "char_end": 490, "char_start": 431, "line": " netfile = os.path.join('etc', 'network', 'interfaces')\n", "line_no": 11 }, { "char_end": 532, "char_start": 490, "line": " _inject_file_into_fs(fs, netfile, net)\n", "line_no": 12 } ], "deleted": [ { "char_end": 243, "char_start": 181, "line": " netdir = os.path.join(os.path.join(fs, 'etc'), 'network')\n", "line_no": 6 }, { "char_end": 475, "char_start": 426, "line": " netfile = os.path.join(netdir, 'interfaces')\n", "line_no": 10 }, { "char_end": 545, "char_start": 475, "line": " utils.execute('tee', netfile, process_input=net, run_as_root=True)\n", "line_no": 11 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 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, "char_start": 172, "chars": " treated as ``.`` to protect from path traversal attacks." }, { "char_end": 494, "char_start": 411, "chars": "\n\n # \"/foo/bar\"\n Pyjo.Path.new('/foo/.../bar').canonicalize()" }, { "char_end": 624, "char_start": 606, "chars": "' or parts[i] == '" }, { "char_end": 646, "char_start": 643, "chars": "..." } ], "deleted": [ { "char_end": 112, "char_start": 110, "chars": "::" } ] }, "commit_link": "github.com/dex4er/Pyjoyment/commit/e4b115bc80c41615b2133091af3a74ee5d995c2e", "file_name": "Pyjo/Path.py", "func_name": "canonicalize", "line_changes": { "added": [ { "char_end": 168, "char_start": 83, "line": " Canonicalize path by resolving ``.`` and ``..``, in addition ``...`` will be\n", "line_no": 6 }, { "char_end": 233, "char_start": 168, "line": " treated as ``.`` to protect from path traversal attacks.\n", "line_no": 7 }, { "char_end": 413, "char_start": 412, "line": "\n", "line_no": 14 }, { "char_end": 495, "char_start": 438, "line": " Pyjo.Path.new('/foo/.../bar').canonicalize()\n", "line_no": 16 }, { "char_end": 649, "char_start": 578, "line": " if parts[i] == '' or parts[i] == '.' or parts[i] == '...':\n", "line_no": 21 } ], "deleted": [ { "char_end": 113, "char_start": 83, "line": " Canonicalize path. ::\n", "line_no": 6 }, { "char_end": 425, "char_start": 375, "line": " if parts[i] == '.' or parts[i] == '':\n", "line_no": 17 } ] }, "vul_type": "cwe-022" }
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/./ba...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, "char_start": 172, "chars": " treated as ``.`` to protect from path traversal attacks." }, { "char_end": 494, "char_start": 411, "chars": "\n\n # \"/foo/bar\"\n Pyjo.Path.new('/foo/.../bar').canonicalize()" }, { "char_end": 624, "char_start": 606, "chars": "' or parts[i] == '" }, { "char_end": 646, "char_start": 643, "chars": "..." } ], "deleted": [ { "char_end": 112, "char_start": 110, "chars": "::" } ] }, "commit_link": "github.com/dex4er/Pyjoyment/commit/e4b115bc80c41615b2133091af3a74ee5d995c2e", "file_name": "Pyjo/Path.py", "func_name": "canonicalize", "line_changes": { "added": [ { "char_end": 168, "char_start": 83, "line": " Canonicalize path by resolving ``.`` and ``..``, in addition ``...`` will be\n", "line_no": 6 }, { "char_end": 233, "char_start": 168, "line": " treated as ``.`` to protect from path traversal attacks.\n", "line_no": 7 }, { "char_end": 413, "char_start": 412, "line": "\n", "line_no": 14 }, { "char_end": 495, "char_start": 438, "line": " Pyjo.Path.new('/foo/.../bar').canonicalize()\n", "line_no": 16 }, { "char_end": 649, "char_start": 578, "line": " if parts[i] == '' or parts[i] == '.' or parts[i] == '...':\n", "line_no": 21 } ], "deleted": [ { "char_end": 113, "char_start": 83, "line": " Canonicalize path. ::\n", "line_no": 6 }, { "char_end": 425, "char_start": 375, "line": " if parts[i] == '.' or parts[i] == '':\n", "line_no": 17 } ] }, "vul_type": "cwe-022" }
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 =...
[ 1, 0, 1, 0, 1, 0, 1, 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" }, { "char_end": 228, "char_start": 224, "chars": "Name" }, { "char_end": 321, "char_start": 317, "chars": "Name" } ] }, "commit_link": "github.com/znc/znc/commit/a4a5aeeb17d32937d8c7d743dae9a4cc755ce773", "file_name": "src/WebModules.cpp", "func_name": "CWebSock::GetSkinPath", "line_changes": { "added": [ { "char_end": 135, "char_start": 58, "line": " const CString sSkin = sSkinName.Replace_n(\"/\", \"_\").Replace_n(\".\", \"_\");\n", "line_no": 2 }, { "char_end": 136, "char_start": 135, "line": "\n", "line_no": 3 }, { "char_end": 204, "char_start": 136, "line": " CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkin;\n", "line_no": 4 }, { "char_end": 300, "char_start": 236, "line": " sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkin;\n", "line_no": 7 }, { "char_end": 389, "char_start": 336, "line": " sRet = CString(_SKINDIR_) + \"/\" + sSkin;\n", "line_no": 10 } ], "deleted": [ { "char_end": 130, "char_start": 58, "line": " CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkinName;\n", "line_no": 2 }, { "char_end": 230, "char_start": 162, "line": " sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkinName;\n", "line_no": 5 }, { "char_end": 323, "char_start": 266, "line": " sRet = CString(_SKINDIR_) + \"/\" + sSkinName;\n", "line_no": 8 } ] }, "vul_type": "cwe-022" }
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() + \"/webs...
[ 1, 1, 1, 1, 1, 1, 1, 1, 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" }, { "char_end": 228, "char_start": 224, "chars": "Name" }, { "char_end": 321, "char_start": 317, "chars": "Name" } ] }, "commit_link": "github.com/znc/znc/commit/a4a5aeeb17d32937d8c7d743dae9a4cc755ce773", "file_name": "src/WebModules.cpp", "func_name": "CWebSock::GetSkinPath", "line_changes": { "added": [ { "char_end": 135, "char_start": 58, "line": " const CString sSkin = sSkinName.Replace_n(\"/\", \"_\").Replace_n(\".\", \"_\");\n", "line_no": 2 }, { "char_end": 136, "char_start": 135, "line": "\n", "line_no": 3 }, { "char_end": 204, "char_start": 136, "line": " CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkin;\n", "line_no": 4 }, { "char_end": 300, "char_start": 236, "line": " sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkin;\n", "line_no": 7 }, { "char_end": 389, "char_start": 336, "line": " sRet = CString(_SKINDIR_) + \"/\" + sSkin;\n", "line_no": 10 } ], "deleted": [ { "char_end": 130, "char_start": 58, "line": " CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkinName;\n", "line_no": 2 }, { "char_end": 230, "char_start": 162, "line": " sRet = CZNC::Get().GetCurPath() + \"/webskins/\" + sSkinName;\n", "line_no": 5 }, { "char_end": 323, "char_start": 266, "line": " sRet = CString(_SKINDIR_) + \"/\" + sSkinName;\n", "line_no": 8 } ] }, "vul_type": "cwe-022" }
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 = decodeRequest...
[ 1, 1, 0, 1, 0, 1, 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/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833", "file_name": "impl.py", "func_name": "addKey", "line_changes": { "added": [ { "char_end": 385, "char_start": 348, "line": "\tvalidateKeyName(token_data['name'])\n", "line_no": 12 } ], "deleted": [ { "char_end": 211, "char_start": 210, "line": "\n", "line_no": 9 } ] }, "vul_type": "cwe-022" }
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 = decodeRequest...
[ 1, 1, 1, 1, 1, 1, 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/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833", "file_name": "impl.py", "func_name": "addKey", "line_changes": { "added": [ { "char_end": 385, "char_start": 348, "line": "\tvalidateKeyName(token_data['name'])\n", "line_no": 12 } ], "deleted": [ { "char_end": 211, "char_start": 210, "line": "\n", "line_no": 9 } ] }, "vul_type": "cwe-022" }
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_gi...
[ 1, 0, 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/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_save_text", "line_changes": { "added": [ { "char_end": 202, "char_start": 162, "line": " if (!str_is_correct_filename(name))\n", "line_no": 6 }, { "char_end": 286, "char_start": 202, "line": " error_msg_and_die(\"Cannot save text. '%s' is not a valid file name\", name);\n", "line_no": 7 }, { "char_end": 287, "char_start": 286, "line": "\n", "line_no": 8 } ], "deleted": [] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 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/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_save_text", "line_changes": { "added": [ { "char_end": 202, "char_start": 162, "line": " if (!str_is_correct_filename(name))\n", "line_no": 6 }, { "char_end": 286, "char_start": 202, "line": " error_msg_and_die(\"Cannot save text. '%s' is not a valid file name\", name);\n", "line_no": 7 }, { "char_end": 287, "char_start": 286, "line": "\n", "line_no": 8 } ], "deleted": [] }, "vul_type": "cwe-022" }
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 \"...
[ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 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 #" }, { "char_end": 1437, "char_start": 1363, "chars": "# Ignore subdirs or filename not containing nginx in the name\n " }, { "char_end": 1518, "char_start": 1491, "chars": " or \"nginx\" not in filename" }, { "char_end": 1606, "char_start": 1544, "chars": "\n\n #\n # 'add_header' usage\n #" }, { "char_end": 3888, "char_start": 2089, "chars": "\n\n #\n # Path traversal issues\n #\n lines = open(self.path + \"/conf/\" + filename).readlines()\n lines = [line.strip() for line in lines if not line.strip().startswith(\"#\")]\n # Let's find the first location line\n location_line = None\n path_traversal_vulnerable = False\n lines_iter = lines.__iter__()\n for line in lines_iter:\n if line.startswith(\"location\"):\n location_line = line\n break\n # Look at the next lines for an 'alias' directive\n if location_line is not None:\n for line in lines_iter:\n if line.startswith(\"location\"):\n # Entering a new location block ... abort here\n # and assume there's no alias block later...\n break\n if line.startswith(\"alias\"):\n # We should definitely check for path traversal issue\n # Does the location target ends with / ?\n target = location_line.split()[-2]\n if not target.endswith(\"/\"):\n path_traversal_vulnerable = True\n break\n if path_traversal_vulnerable:\n print_warning(\n \"The nginx configuration appears vulnerable to path traversal as explained in \"\n \"https://www.acunetix.com/vulnerabilities/web/path-traversal-via-misconfigured-nginx-alias/\\n\"\n \"To fix it, look at the first lines of the nginx conf of the example app : \"\n \"https://github.com/YunoHost/example_ynh/blob/master/conf/nginx.conf\"\n )" } ], "deleted": [] }, "commit_link": "github.com/YunoHost/package_linter/commit/f6e98894cfe841aedaa7efd590937f0255193913", "file_name": "package_linter.py", "func_name": "misc_file_checks", "line_changes": { "added": [ { "char_end": 1520, "char_start": 1425, "line": " if not os.path.isfile(self.path + \"/conf/\" + filename) or \"nginx\" not in filename:\n", "line_no": 42 }, { "char_end": 1546, "char_start": 1545, "line": "\n", "line_no": 44 } ], "deleted": [ { "char_end": 1336, "char_start": 1268, "line": " if not os.path.isfile(self.path + \"/conf/\" + filename):\n", "line_no": 39 } ] }, "vul_type": "cwe-022" }
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 \"...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 #" }, { "char_end": 1437, "char_start": 1363, "chars": "# Ignore subdirs or filename not containing nginx in the name\n " }, { "char_end": 1518, "char_start": 1491, "chars": " or \"nginx\" not in filename" }, { "char_end": 1606, "char_start": 1544, "chars": "\n\n #\n # 'add_header' usage\n #" }, { "char_end": 3888, "char_start": 2089, "chars": "\n\n #\n # Path traversal issues\n #\n lines = open(self.path + \"/conf/\" + filename).readlines()\n lines = [line.strip() for line in lines if not line.strip().startswith(\"#\")]\n # Let's find the first location line\n location_line = None\n path_traversal_vulnerable = False\n lines_iter = lines.__iter__()\n for line in lines_iter:\n if line.startswith(\"location\"):\n location_line = line\n break\n # Look at the next lines for an 'alias' directive\n if location_line is not None:\n for line in lines_iter:\n if line.startswith(\"location\"):\n # Entering a new location block ... abort here\n # and assume there's no alias block later...\n break\n if line.startswith(\"alias\"):\n # We should definitely check for path traversal issue\n # Does the location target ends with / ?\n target = location_line.split()[-2]\n if not target.endswith(\"/\"):\n path_traversal_vulnerable = True\n break\n if path_traversal_vulnerable:\n print_warning(\n \"The nginx configuration appears vulnerable to path traversal as explained in \"\n \"https://www.acunetix.com/vulnerabilities/web/path-traversal-via-misconfigured-nginx-alias/\\n\"\n \"To fix it, look at the first lines of the nginx conf of the example app : \"\n \"https://github.com/YunoHost/example_ynh/blob/master/conf/nginx.conf\"\n )" } ], "deleted": [] }, "commit_link": "github.com/YunoHost/package_linter/commit/f6e98894cfe841aedaa7efd590937f0255193913", "file_name": "package_linter.py", "func_name": "misc_file_checks", "line_changes": { "added": [ { "char_end": 1520, "char_start": 1425, "line": " if not os.path.isfile(self.path + \"/conf/\" + filename) or \"nginx\" not in filename:\n", "line_no": 42 }, { "char_end": 1546, "char_start": 1545, "line": "\n", "line_no": 44 } ], "deleted": [ { "char_end": 1336, "char_start": 1268, "line": " if not os.path.isfile(self.path + \"/conf/\" + filename):\n", "line_no": 39 } ] }, "vul_type": "cwe-022" }
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, ...
[ 1, 0, 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/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_save_binary", "line_changes": { "added": [ { "char_end": 219, "char_start": 179, "line": " if (!str_is_correct_filename(name))\n", "line_no": 6 }, { "char_end": 305, "char_start": 219, "line": " error_msg_and_die(\"Cannot save binary. '%s' is not a valid file name\", name);\n", "line_no": 7 }, { "char_end": 306, "char_start": 305, "line": "\n", "line_no": 8 } ], "deleted": [] }, "vul_type": "cwe-022" }
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\", nam...
[ 1, 1, 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/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_save_binary", "line_changes": { "added": [ { "char_end": 219, "char_start": 179, "line": " if (!str_is_correct_filename(name))\n", "line_no": 6 }, { "char_end": 305, "char_start": 219, "line": " error_msg_and_die(\"Cannot save binary. '%s' is not a valid file name\", name);\n", "line_no": 7 }, { "char_end": 306, "char_start": 305, "line": "\n", "line_no": 8 } ], "deleted": [] }, "vul_type": "cwe-022" }
25
cwe-022
c
Determine whether the {function_name} code is vulnerable or not.
[ "def pascal_case(value: str) -> str:", " return stringcase.pascalcase(value)" ]
[ 1, 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/commit/3e7dfae5d0b3685abf1ede1bc6c086a116ac4746", "file_name": "openapi_python_client/utils.py", "func_name": "pascal_case", "line_changes": { "added": [ { "char_end": 86, "char_start": 36, "line": " return stringcase.pascalcase(_sanitize(value))\n", "line_no": 2 } ], "deleted": [ { "char_end": 75, "char_start": 36, "line": " return stringcase.pascalcase(value)\n", "line_no": 2 } ] }, "vul_type": "cwe-022" }
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, 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/commit/3e7dfae5d0b3685abf1ede1bc6c086a116ac4746", "file_name": "openapi_python_client/utils.py", "func_name": "pascal_case", "line_changes": { "added": [ { "char_end": 86, "char_start": 36, "line": " return stringcase.pascalcase(_sanitize(value))\n", "line_no": 2 } ], "deleted": [ { "char_end": 75, "char_start": 36, "line": " return stringcase.pascalcase(value)\n", "line_no": 2 } ] }, "vul_type": "cwe-022" }
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\tcle...
[ 1, 1, 1, 0, 1, 0, 1, 1, 1, 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\t\t}\n" }, { "char_end": 568, "char_start": 565, "chars": "\n\t}" } ], "deleted": [] }, "commit_link": "github.com/libarchive/libarchive/commit/59357157706d47c365b2227739e17daba3607526", "file_name": "libarchive/archive_write_disk_posix.c", "func_name": "cleanup_pathname", "line_changes": { "added": [ { "char_end": 356, "char_start": 336, "line": "\tif (*src == '/') {\n", "line_no": 17 }, { "char_end": 415, "char_start": 356, "line": "\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {\n", "line_no": 18 }, { "char_end": 469, "char_start": 415, "line": "\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n", "line_no": 19 }, { "char_end": 511, "char_start": 469, "line": "\t\t\t \"Path is absolute\");\n", "line_no": 20 }, { "char_end": 539, "char_start": 511, "line": "\t\t\treturn (ARCHIVE_FAILED);\n", "line_no": 21 }, { "char_end": 543, "char_start": 539, "line": "\t\t}\n", "line_no": 22 }, { "char_end": 544, "char_start": 543, "line": "\n", "line_no": 23 }, { "char_end": 569, "char_start": 566, "line": "\t}\n", "line_no": 25 } ], "deleted": [ { "char_end": 354, "char_start": 336, "line": "\tif (*src == '/')\n", "line_no": 17 } ] }, "vul_type": "cwe-022" }
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\tcle...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 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\t\t}\n" }, { "char_end": 568, "char_start": 565, "chars": "\n\t}" } ], "deleted": [] }, "commit_link": "github.com/libarchive/libarchive/commit/59357157706d47c365b2227739e17daba3607526", "file_name": "libarchive/archive_write_disk_posix.c", "func_name": "cleanup_pathname", "line_changes": { "added": [ { "char_end": 356, "char_start": 336, "line": "\tif (*src == '/') {\n", "line_no": 17 }, { "char_end": 415, "char_start": 356, "line": "\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {\n", "line_no": 18 }, { "char_end": 469, "char_start": 415, "line": "\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n", "line_no": 19 }, { "char_end": 511, "char_start": 469, "line": "\t\t\t \"Path is absolute\");\n", "line_no": 20 }, { "char_end": 539, "char_start": 511, "line": "\t\t\treturn (ARCHIVE_FAILED);\n", "line_no": 21 }, { "char_end": 543, "char_start": 539, "line": "\t\t}\n", "line_no": 22 }, { "char_end": 544, "char_start": 543, "line": "\n", "line_no": 23 }, { "char_end": 569, "char_start": 566, "line": "\t}\n", "line_no": 25 } ], "deleted": [ { "char_end": 354, "char_start": 336, "line": "\tif (*src == '/')\n", "line_no": 17 } ] }, "vul_type": "cwe-022" }
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'\"), FILE...
[ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 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, "char_start": 2383, "chars": "!str_is_correct_filename(name))\n {\n error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n continue;\n }\n\n if (" } ], "deleted": [ { "char_end": 2963, "char_start": 2709, "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'\", name);" } ] }, "commit_link": "github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/create_dump_dir.c", "func_name": "create_dump_dir_from_problem_data", "line_changes": { "added": [ { "char_end": 385, "char_start": 345, "line": " if (!str_is_correct_filename(type))\n", "line_no": 13 }, { "char_end": 391, "char_start": 385, "line": " {\n", "line_no": 14 }, { "char_end": 465, "char_start": 391, "line": " error_msg(_(\"'%s' is not correct file name\"), FILENAME_ANALYZER);\n", "line_no": 15 }, { "char_end": 486, "char_start": 465, "line": " return NULL;\n", "line_no": 16 }, { "char_end": 492, "char_start": 486, "line": " }\n", "line_no": 17 }, { "char_end": 493, "char_start": 492, "line": "\n", "line_no": 18 }, { "char_end": 2415, "char_start": 2371, "line": " if (!str_is_correct_filename(name))\n", "line_no": 82 }, { "char_end": 2425, "char_start": 2415, "line": " {\n", "line_no": 83 }, { "char_end": 2513, "char_start": 2425, "line": " error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n", "line_no": 84 }, { "char_end": 2535, "char_start": 2513, "line": " continue;\n", "line_no": 85 }, { "char_end": 2545, "char_start": 2535, "line": " }\n", "line_no": 86 }, { "char_end": 2546, "char_start": 2545, "line": "\n", "line_no": 87 } ], "deleted": [ { "char_end": 2817, "char_start": 2743, "line": " /* only files should contain '/' and those are handled earlier */\n", "line_no": 90 }, { "char_end": 2866, "char_start": 2817, "line": " if (name[0] == '.' || strchr(name, '/'))\n", "line_no": 91 }, { "char_end": 2876, "char_start": 2866, "line": " {\n", "line_no": 92 }, { "char_end": 2964, "char_start": 2876, "line": " error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n", "line_no": 93 }, { "char_end": 2986, "char_start": 2964, "line": " continue;\n", "line_no": 94 }, { "char_end": 2996, "char_start": 2986, "line": " }\n", "line_no": 95 }, { "char_end": 2997, "char_start": 2996, "line": "\n", "line_no": 96 } ] }, "vul_type": "cwe-022" }
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'\"), FILE...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, "char_start": 2383, "chars": "!str_is_correct_filename(name))\n {\n error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n continue;\n }\n\n if (" } ], "deleted": [ { "char_end": 2963, "char_start": 2709, "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'\", name);" } ] }, "commit_link": "github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/create_dump_dir.c", "func_name": "create_dump_dir_from_problem_data", "line_changes": { "added": [ { "char_end": 385, "char_start": 345, "line": " if (!str_is_correct_filename(type))\n", "line_no": 13 }, { "char_end": 391, "char_start": 385, "line": " {\n", "line_no": 14 }, { "char_end": 465, "char_start": 391, "line": " error_msg(_(\"'%s' is not correct file name\"), FILENAME_ANALYZER);\n", "line_no": 15 }, { "char_end": 486, "char_start": 465, "line": " return NULL;\n", "line_no": 16 }, { "char_end": 492, "char_start": 486, "line": " }\n", "line_no": 17 }, { "char_end": 493, "char_start": 492, "line": "\n", "line_no": 18 }, { "char_end": 2415, "char_start": 2371, "line": " if (!str_is_correct_filename(name))\n", "line_no": 82 }, { "char_end": 2425, "char_start": 2415, "line": " {\n", "line_no": 83 }, { "char_end": 2513, "char_start": 2425, "line": " error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n", "line_no": 84 }, { "char_end": 2535, "char_start": 2513, "line": " continue;\n", "line_no": 85 }, { "char_end": 2545, "char_start": 2535, "line": " }\n", "line_no": 86 }, { "char_end": 2546, "char_start": 2545, "line": "\n", "line_no": 87 } ], "deleted": [ { "char_end": 2817, "char_start": 2743, "line": " /* only files should contain '/' and those are handled earlier */\n", "line_no": 90 }, { "char_end": 2866, "char_start": 2817, "line": " if (name[0] == '.' || strchr(name, '/'))\n", "line_no": 91 }, { "char_end": 2876, "char_start": 2866, "line": " {\n", "line_no": 92 }, { "char_end": 2964, "char_start": 2876, "line": " error_msg(\"Problem data field name contains disallowed chars: '%s'\", name);\n", "line_no": 93 }, { "char_end": 2986, "char_start": 2964, "line": " continue;\n", "line_no": 94 }, { "char_end": 2996, "char_start": 2986, "line": " }\n", "line_no": 95 }, { "char_end": 2997, "char_start": 2996, "line": "\n", "line_no": 96 } ] }, "vul_type": "cwe-022" }
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.E...
[ 1, 0, 1, 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" }, { "char_end": 69, "char_start": 67, "chars": "y(" } ], "deleted": [ { "char_end": 63, "char_start": 50, "chars": "os.path.join(" }, { "char_end": 69, "char_start": 68, "chars": "n" }, { "char_end": 72, "char_start": 70, "chars": "me" }, { "char_end": 76, "char_start": 73, "chars": "pac" }, { "char_end": 79, "char_start": 77, "chars": ", " } ] }, "commit_link": "github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4", "file_name": "custodia/store/etcdstore.py", "func_name": "list", "line_changes": { "added": [ { "char_end": 80, "char_start": 35, "line": " path = self._absolute_key(keyfilter)\n", "line_no": 2 } ], "deleted": [ { "char_end": 90, "char_start": 35, "line": " path = os.path.join(self.namespace, keyfilter)\n", "line_no": 2 } ] }, "vul_type": "cwe-022" }
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.EtcdExcepti...
[ 1, 1, 1, 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" }, { "char_end": 69, "char_start": 67, "chars": "y(" } ], "deleted": [ { "char_end": 63, "char_start": 50, "chars": "os.path.join(" }, { "char_end": 69, "char_start": 68, "chars": "n" }, { "char_end": 72, "char_start": 70, "chars": "me" }, { "char_end": 76, "char_start": 73, "chars": "pac" }, { "char_end": 79, "char_start": 77, "chars": ", " } ] }, "commit_link": "github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4", "file_name": "custodia/store/etcdstore.py", "func_name": "list", "line_changes": { "added": [ { "char_end": 80, "char_start": 35, "line": " path = self._absolute_key(keyfilter)\n", "line_no": 2 } ], "deleted": [ { "char_end": 90, "char_start": 35, "line": " path = os.path.join(self.namespace, keyfilter)\n", "line_no": 2 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 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, "chars": " = 0" }, { "char_end": 8113, "char_start": 8109, "chars": "lect" }, { "char_end": 8124, "char_start": 8114, "chars": "parts of t" }, { "char_end": 8137, "char_start": 8126, "chars": " output fil" }, { "char_end": 8186, "char_start": 8144, "chars": "*/\n if (g.decode) {\n /* " }, { "char_end": 8194, "char_start": 8190, "chars": "-dN " }, { "char_end": 8203, "char_start": 8195, "chars": "r -dNT, " }, { "char_end": 8207, "char_start": 8204, "chars": "se " }, { "char_end": 8211, "char_start": 8208, "chars": "he " }, { "char_end": 8213, "char_start": 8212, "chars": "a" }, { "char_end": 8218, "char_start": 8216, "chars": "fr" }, { "char_end": 8223, "char_start": 8220, "chars": " th" }, { "char_end": 8225, "char_start": 8224, "chars": " " }, { "char_end": 8230, "char_start": 8227, "chars": "put" }, { "char_end": 8232, "char_start": 8231, "chars": "f" }, { "char_end": 8240, "char_start": 8233, "chars": "le and " }, { "char_end": 8250, "char_start": 8242, "chars": "e name\n " }, { "char_end": 8269, "char_start": 8259, "chars": " from " }, { "char_end": 8272, "char_start": 8270, "chars": "he" }, { "char_end": 8280, "char_start": 8273, "chars": "header," }, { "char_end": 8289, "char_start": 8281, "chars": "strippin" }, { "char_end": 8300, "char_start": 8290, "chars": " any path " }, { "char_end": 8321, "char_start": 8302, "chars": " the header name */" }, { "char_end": 8326, "char_start": 8322, "chars": " " }, { "char_end": 8443, "char_start": 8392, "chars": " pre = justname(g.inf) - g.inf;\n " }, { "char_end": 8457, "char_start": 8448, "chars": "justname(" }, { "char_end": 8465, "char_start": 8464, "chars": ")" }, { "char_end": 8471, "char_start": 8467, "chars": " " }, { "char_end": 8498, "char_start": 8496, "chars": "to" }, { "char_end": 8513, "char_start": 8509, "chars": " " }, { "char_end": 8519, "char_start": 8515, "chars": " " }, { "char_end": 8546, "char_start": 8530, "chars": "for -d or -dNn, " }, { "char_end": 8557, "char_start": 8555, "chars": "bb" }, { "char_end": 8563, "char_start": 8559, "chars": "viat" }, { "char_end": 8570, "char_start": 8565, "chars": " suff" }, { "char_end": 8574, "char_start": 8571, "chars": "xes" }, { "char_end": 8588, "char_start": 8586, "chars": " " }, { "char_end": 8593, "char_start": 8591, "chars": "ls" }, { "char_end": 8597, "char_start": 8595, "chars": "if" }, { "char_end": 8599, "char_start": 8598, "chars": "(" }, { "char_end": 8645, "char_start": 8624, "chars": "== 0)\n " }, { "char_end": 8650, "char_start": 8646, "chars": "sufx" }, { "char_end": 8652, "char_start": 8651, "chars": "=" }, { "char_end": 8769, "char_start": 8661, "chars": " }\n else\n /* add appropriate suffix when compressing */\n sufx = g.sufx;\n" }, { "char_end": 8847, "char_start": 8845, "chars": "pr" }, { "char_end": 8856, "char_start": 8855, "chars": "+" }, { "char_end": 8975, "char_start": 8970, "chars": "g.inf" }, { "char_end": 8979, "char_start": 8977, "chars": "pr" }, { "char_end": 8994, "char_start": 8991, "chars": "mem" }, { "char_end": 9015, "char_start": 9006, "chars": " pre, to," }, { "char_end": 9029, "char_start": 9019, "chars": ");\n " }, { "char_end": 9037, "char_start": 9030, "chars": "strcpy(" }, { "char_end": 9043, "char_start": 9040, "chars": "utf" }, { "char_end": 9045, "char_start": 9044, "chars": "+" }, { "char_end": 9047, "char_start": 9046, "chars": "p" }, { "char_end": 9052, "char_start": 9049, "chars": " + " }, { "char_end": 9056, "char_start": 9053, "chars": "en," }, { "char_end": 9126, "char_start": 9125, "chars": " " } ], "deleted": [ { "char_end": 8053, "char_start": 8052, "chars": "r" }, { "char_end": 8056, "char_start": 8055, "chars": "l" }, { "char_end": 8071, "char_start": 8070, "chars": "u" }, { "char_end": 8078, "char_start": 8076, "chars": "ad" }, { "char_end": 8080, "char_start": 8079, "chars": "r" }, { "char_end": 8095, "char_start": 8094, "chars": "u" }, { "char_end": 8098, "char_start": 8096, "chars": " w" }, { "char_end": 8101, "char_start": 8099, "chars": "en" }, { "char_end": 8105, "char_start": 8102, "chars": "dec" }, { "char_end": 8109, "char_start": 8107, "chars": "pr" }, { "char_end": 8112, "char_start": 8110, "chars": "ss" }, { "char_end": 8115, "char_start": 8114, "chars": "g" }, { "char_end": 8117, "char_start": 8116, "chars": "w" }, { "char_end": 8123, "char_start": 8120, "chars": " -N" }, { "char_end": 8126, "char_start": 8124, "chars": "*/" }, { "char_end": 8136, "char_start": 8135, "chars": "t" }, { "char_end": 8139, "char_start": 8138, "chars": "=" }, { "char_end": 8142, "char_start": 8141, "chars": "." }, { "char_end": 8146, "char_start": 8144, "chars": "f;" }, { "char_end": 8171, "char_start": 8159, "chars": "g.decode && " }, { "char_end": 8271, "char_start": 8264, "chars": "g.hname" }, { "char_end": 8284, "char_start": 8283, "chars": "\n" }, { "char_end": 8316, "char_start": 8304, "chars": ".tgz with .t" }, { "char_end": 8321, "char_start": 8318, "chars": " wh" }, { "char_end": 8325, "char_start": 8322, "chars": "n d" }, { "char_end": 8328, "char_start": 8326, "chars": "co" }, { "char_end": 8332, "char_start": 8330, "chars": "ng" }, { "char_end": 8348, "char_start": 8344, "chars": "repl" }, { "char_end": 8350, "char_start": 8349, "chars": "=" }, { "char_end": 8354, "char_start": 8351, "chars": "g.d" }, { "char_end": 8358, "char_start": 8355, "chars": "cod" }, { "char_end": 8362, "char_start": 8360, "chars": "&&" }, { "char_end": 8389, "char_start": 8388, "chars": "?" }, { "char_end": 8392, "char_start": 8390, "chars": "\"\"" }, { "char_end": 8394, "char_start": 8393, "chars": ":" }, { "char_end": 8480, "char_start": 8479, "chars": "l" }, { "char_end": 8482, "char_start": 8481, "chars": "n" }, { "char_end": 8500, "char_start": 8485, "chars": "(g.decode ? str" }, { "char_end": 8509, "char_start": 8503, "chars": "(repl)" }, { "char_end": 8511, "char_start": 8510, "chars": ":" }, { "char_end": 8521, "char_start": 8519, "chars": "g." }, { "char_end": 8526, "char_start": 8525, "chars": ")" }, { "char_end": 8630, "char_start": 8628, "chars": "to" }, { "char_end": 8633, "char_start": 8632, "chars": "l" }, { "char_end": 8635, "char_start": 8634, "chars": "n" }, { "char_end": 8649, "char_start": 8646, "chars": "str" }, { "char_end": 8666, "char_start": 8665, "chars": "," }, { "char_end": 8672, "char_start": 8669, "chars": "dec" }, { "char_end": 8675, "char_start": 8673, "chars": "de" }, { "char_end": 8677, "char_start": 8676, "chars": "?" }, { "char_end": 8682, "char_start": 8680, "chars": "pl" }, { "char_end": 8684, "char_start": 8683, "chars": ":" }, { "char_end": 8687, "char_start": 8685, "chars": "g." } ] }, "commit_link": "github.com/madler/pigz/commit/fdad1406b3ec809f4954ff7cdf9e99eb18c2458f", "file_name": "pigz.c", "func_name": "process", "line_changes": { "added": [ { "char_end": 8071, "char_start": 8033, "line": " char *to = g.inf, *sufx = \"\";\n", "line_no": 224 }, { "char_end": 8095, "char_start": 8071, "line": " size_t pre = 0;\n", "line_no": 225 }, { "char_end": 8096, "char_start": 8095, "line": "\n", "line_no": 226 }, { "char_end": 8147, "char_start": 8096, "line": " /* select parts of the output file name */\n", "line_no": 227 }, { "char_end": 8171, "char_start": 8147, "line": " if (g.decode) {\n", "line_no": 228 }, { "char_end": 8249, "char_start": 8171, "line": " /* for -dN or -dNT, use the path from the input file and the name\n", "line_no": 229 }, { "char_end": 8322, "char_start": 8249, "line": " from the header, stripping any path in the header name */\n", "line_no": 230 }, { "char_end": 8380, "char_start": 8322, "line": " if ((g.headis & 1) != 0 && g.hname != NULL) {\n", "line_no": 231 }, { "char_end": 8427, "char_start": 8380, "line": " pre = justname(g.inf) - g.inf;\n", "line_no": 232 }, { "char_end": 8467, "char_start": 8427, "line": " to = justname(g.hname);\n", "line_no": 233 }, { "char_end": 8501, "char_start": 8467, "line": " len = strlen(to);\n", "line_no": 234 }, { "char_end": 8515, "char_start": 8501, "line": " }\n", "line_no": 235 }, { "char_end": 8578, "char_start": 8515, "line": " /* for -d or -dNn, replace abbreviated suffixes */\n", "line_no": 236 }, { "char_end": 8630, "char_start": 8578, "line": " else if (strcmp(to + len, \".tgz\") == 0)\n", "line_no": 237 }, { "char_end": 8661, "char_start": 8630, "line": " sufx = \".tar\";\n", "line_no": 238 }, { "char_end": 8684, "char_start": 8671, "line": " else\n", "line_no": 240 }, { "char_end": 8742, "char_start": 8684, "line": " /* add appropriate suffix when compressing */\n", "line_no": 241 }, { "char_end": 8769, "char_start": 8742, "line": " sufx = g.sufx;\n", "line_no": 242 }, { "char_end": 8876, "char_start": 8821, "line": " g.outf = MALLOC(pre + len + strlen(sufx) + 1);\n", "line_no": 245 }, { "char_end": 8983, "char_start": 8947, "line": " memcpy(g.outf, g.inf, pre);\n", "line_no": 248 }, { "char_end": 9022, "char_start": 8983, "line": " memcpy(g.outf + pre, to, len);\n", "line_no": 249 }, { "char_end": 9064, "char_start": 9022, "line": " strcpy(g.outf + pre + len, sufx);\n", "line_no": 250 }, { "char_end": 9186, "char_start": 9125, "line": " (g.force ? 0 : O_EXCL), 0600);\n", "line_no": 252 } ], "deleted": [ { "char_end": 8058, "char_start": 8033, "line": " char *to, *repl;\n", "line_no": 224 }, { "char_end": 8059, "char_start": 8058, "line": "\n", "line_no": 225 }, { "char_end": 8127, "char_start": 8059, "line": " /* use header name for output when decompressing with -N */\n", "line_no": 226 }, { "char_end": 8147, "char_start": 8127, "line": " to = g.inf;\n", "line_no": 227 }, { "char_end": 8213, "char_start": 8147, "line": " if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {\n", "line_no": 228 }, { "char_end": 8239, "char_start": 8213, "line": " to = g.hname;\n", "line_no": 229 }, { "char_end": 8274, "char_start": 8239, "line": " len = strlen(g.hname);\n", "line_no": 230 }, { "char_end": 8285, "char_start": 8284, "line": "\n", "line_no": 232 }, { "char_end": 8336, "char_start": 8285, "line": " /* replace .tgz with .tar when decoding */\n", "line_no": 233 }, { "char_end": 8403, "char_start": 8336, "line": " repl = g.decode && strcmp(to + len, \".tgz\") ? \"\" : \".tar\";\n", "line_no": 234 }, { "char_end": 8534, "char_start": 8455, "line": " g.outf = MALLOC(len + (g.decode ? strlen(repl) : strlen(g.sufx)) + 1);\n", "line_no": 237 }, { "char_end": 8638, "char_start": 8605, "line": " memcpy(g.outf, to, len);\n", "line_no": 240 }, { "char_end": 8694, "char_start": 8638, "line": " strcpy(g.outf + len, g.decode ? repl : g.sufx);\n", "line_no": 241 }, { "char_end": 8815, "char_start": 8755, "line": " (g.force ? 0 : O_EXCL), 0600);\n", "line_no": 243 } ] }, "vul_type": "cwe-022" }
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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, "chars": " = 0" }, { "char_end": 8113, "char_start": 8109, "chars": "lect" }, { "char_end": 8124, "char_start": 8114, "chars": "parts of t" }, { "char_end": 8137, "char_start": 8126, "chars": " output fil" }, { "char_end": 8186, "char_start": 8144, "chars": "*/\n if (g.decode) {\n /* " }, { "char_end": 8194, "char_start": 8190, "chars": "-dN " }, { "char_end": 8203, "char_start": 8195, "chars": "r -dNT, " }, { "char_end": 8207, "char_start": 8204, "chars": "se " }, { "char_end": 8211, "char_start": 8208, "chars": "he " }, { "char_end": 8213, "char_start": 8212, "chars": "a" }, { "char_end": 8218, "char_start": 8216, "chars": "fr" }, { "char_end": 8223, "char_start": 8220, "chars": " th" }, { "char_end": 8225, "char_start": 8224, "chars": " " }, { "char_end": 8230, "char_start": 8227, "chars": "put" }, { "char_end": 8232, "char_start": 8231, "chars": "f" }, { "char_end": 8240, "char_start": 8233, "chars": "le and " }, { "char_end": 8250, "char_start": 8242, "chars": "e name\n " }, { "char_end": 8269, "char_start": 8259, "chars": " from " }, { "char_end": 8272, "char_start": 8270, "chars": "he" }, { "char_end": 8280, "char_start": 8273, "chars": "header," }, { "char_end": 8289, "char_start": 8281, "chars": "strippin" }, { "char_end": 8300, "char_start": 8290, "chars": " any path " }, { "char_end": 8321, "char_start": 8302, "chars": " the header name */" }, { "char_end": 8326, "char_start": 8322, "chars": " " }, { "char_end": 8443, "char_start": 8392, "chars": " pre = justname(g.inf) - g.inf;\n " }, { "char_end": 8457, "char_start": 8448, "chars": "justname(" }, { "char_end": 8465, "char_start": 8464, "chars": ")" }, { "char_end": 8471, "char_start": 8467, "chars": " " }, { "char_end": 8498, "char_start": 8496, "chars": "to" }, { "char_end": 8513, "char_start": 8509, "chars": " " }, { "char_end": 8519, "char_start": 8515, "chars": " " }, { "char_end": 8546, "char_start": 8530, "chars": "for -d or -dNn, " }, { "char_end": 8557, "char_start": 8555, "chars": "bb" }, { "char_end": 8563, "char_start": 8559, "chars": "viat" }, { "char_end": 8570, "char_start": 8565, "chars": " suff" }, { "char_end": 8574, "char_start": 8571, "chars": "xes" }, { "char_end": 8588, "char_start": 8586, "chars": " " }, { "char_end": 8593, "char_start": 8591, "chars": "ls" }, { "char_end": 8597, "char_start": 8595, "chars": "if" }, { "char_end": 8599, "char_start": 8598, "chars": "(" }, { "char_end": 8645, "char_start": 8624, "chars": "== 0)\n " }, { "char_end": 8650, "char_start": 8646, "chars": "sufx" }, { "char_end": 8652, "char_start": 8651, "chars": "=" }, { "char_end": 8769, "char_start": 8661, "chars": " }\n else\n /* add appropriate suffix when compressing */\n sufx = g.sufx;\n" }, { "char_end": 8847, "char_start": 8845, "chars": "pr" }, { "char_end": 8856, "char_start": 8855, "chars": "+" }, { "char_end": 8975, "char_start": 8970, "chars": "g.inf" }, { "char_end": 8979, "char_start": 8977, "chars": "pr" }, { "char_end": 8994, "char_start": 8991, "chars": "mem" }, { "char_end": 9015, "char_start": 9006, "chars": " pre, to," }, { "char_end": 9029, "char_start": 9019, "chars": ");\n " }, { "char_end": 9037, "char_start": 9030, "chars": "strcpy(" }, { "char_end": 9043, "char_start": 9040, "chars": "utf" }, { "char_end": 9045, "char_start": 9044, "chars": "+" }, { "char_end": 9047, "char_start": 9046, "chars": "p" }, { "char_end": 9052, "char_start": 9049, "chars": " + " }, { "char_end": 9056, "char_start": 9053, "chars": "en," }, { "char_end": 9126, "char_start": 9125, "chars": " " } ], "deleted": [ { "char_end": 8053, "char_start": 8052, "chars": "r" }, { "char_end": 8056, "char_start": 8055, "chars": "l" }, { "char_end": 8071, "char_start": 8070, "chars": "u" }, { "char_end": 8078, "char_start": 8076, "chars": "ad" }, { "char_end": 8080, "char_start": 8079, "chars": "r" }, { "char_end": 8095, "char_start": 8094, "chars": "u" }, { "char_end": 8098, "char_start": 8096, "chars": " w" }, { "char_end": 8101, "char_start": 8099, "chars": "en" }, { "char_end": 8105, "char_start": 8102, "chars": "dec" }, { "char_end": 8109, "char_start": 8107, "chars": "pr" }, { "char_end": 8112, "char_start": 8110, "chars": "ss" }, { "char_end": 8115, "char_start": 8114, "chars": "g" }, { "char_end": 8117, "char_start": 8116, "chars": "w" }, { "char_end": 8123, "char_start": 8120, "chars": " -N" }, { "char_end": 8126, "char_start": 8124, "chars": "*/" }, { "char_end": 8136, "char_start": 8135, "chars": "t" }, { "char_end": 8139, "char_start": 8138, "chars": "=" }, { "char_end": 8142, "char_start": 8141, "chars": "." }, { "char_end": 8146, "char_start": 8144, "chars": "f;" }, { "char_end": 8171, "char_start": 8159, "chars": "g.decode && " }, { "char_end": 8271, "char_start": 8264, "chars": "g.hname" }, { "char_end": 8284, "char_start": 8283, "chars": "\n" }, { "char_end": 8316, "char_start": 8304, "chars": ".tgz with .t" }, { "char_end": 8321, "char_start": 8318, "chars": " wh" }, { "char_end": 8325, "char_start": 8322, "chars": "n d" }, { "char_end": 8328, "char_start": 8326, "chars": "co" }, { "char_end": 8332, "char_start": 8330, "chars": "ng" }, { "char_end": 8348, "char_start": 8344, "chars": "repl" }, { "char_end": 8350, "char_start": 8349, "chars": "=" }, { "char_end": 8354, "char_start": 8351, "chars": "g.d" }, { "char_end": 8358, "char_start": 8355, "chars": "cod" }, { "char_end": 8362, "char_start": 8360, "chars": "&&" }, { "char_end": 8389, "char_start": 8388, "chars": "?" }, { "char_end": 8392, "char_start": 8390, "chars": "\"\"" }, { "char_end": 8394, "char_start": 8393, "chars": ":" }, { "char_end": 8480, "char_start": 8479, "chars": "l" }, { "char_end": 8482, "char_start": 8481, "chars": "n" }, { "char_end": 8500, "char_start": 8485, "chars": "(g.decode ? str" }, { "char_end": 8509, "char_start": 8503, "chars": "(repl)" }, { "char_end": 8511, "char_start": 8510, "chars": ":" }, { "char_end": 8521, "char_start": 8519, "chars": "g." }, { "char_end": 8526, "char_start": 8525, "chars": ")" }, { "char_end": 8630, "char_start": 8628, "chars": "to" }, { "char_end": 8633, "char_start": 8632, "chars": "l" }, { "char_end": 8635, "char_start": 8634, "chars": "n" }, { "char_end": 8649, "char_start": 8646, "chars": "str" }, { "char_end": 8666, "char_start": 8665, "chars": "," }, { "char_end": 8672, "char_start": 8669, "chars": "dec" }, { "char_end": 8675, "char_start": 8673, "chars": "de" }, { "char_end": 8677, "char_start": 8676, "chars": "?" }, { "char_end": 8682, "char_start": 8680, "chars": "pl" }, { "char_end": 8684, "char_start": 8683, "chars": ":" }, { "char_end": 8687, "char_start": 8685, "chars": "g." } ] }, "commit_link": "github.com/madler/pigz/commit/fdad1406b3ec809f4954ff7cdf9e99eb18c2458f", "file_name": "pigz.c", "func_name": "process", "line_changes": { "added": [ { "char_end": 8071, "char_start": 8033, "line": " char *to = g.inf, *sufx = \"\";\n", "line_no": 224 }, { "char_end": 8095, "char_start": 8071, "line": " size_t pre = 0;\n", "line_no": 225 }, { "char_end": 8096, "char_start": 8095, "line": "\n", "line_no": 226 }, { "char_end": 8147, "char_start": 8096, "line": " /* select parts of the output file name */\n", "line_no": 227 }, { "char_end": 8171, "char_start": 8147, "line": " if (g.decode) {\n", "line_no": 228 }, { "char_end": 8249, "char_start": 8171, "line": " /* for -dN or -dNT, use the path from the input file and the name\n", "line_no": 229 }, { "char_end": 8322, "char_start": 8249, "line": " from the header, stripping any path in the header name */\n", "line_no": 230 }, { "char_end": 8380, "char_start": 8322, "line": " if ((g.headis & 1) != 0 && g.hname != NULL) {\n", "line_no": 231 }, { "char_end": 8427, "char_start": 8380, "line": " pre = justname(g.inf) - g.inf;\n", "line_no": 232 }, { "char_end": 8467, "char_start": 8427, "line": " to = justname(g.hname);\n", "line_no": 233 }, { "char_end": 8501, "char_start": 8467, "line": " len = strlen(to);\n", "line_no": 234 }, { "char_end": 8515, "char_start": 8501, "line": " }\n", "line_no": 235 }, { "char_end": 8578, "char_start": 8515, "line": " /* for -d or -dNn, replace abbreviated suffixes */\n", "line_no": 236 }, { "char_end": 8630, "char_start": 8578, "line": " else if (strcmp(to + len, \".tgz\") == 0)\n", "line_no": 237 }, { "char_end": 8661, "char_start": 8630, "line": " sufx = \".tar\";\n", "line_no": 238 }, { "char_end": 8684, "char_start": 8671, "line": " else\n", "line_no": 240 }, { "char_end": 8742, "char_start": 8684, "line": " /* add appropriate suffix when compressing */\n", "line_no": 241 }, { "char_end": 8769, "char_start": 8742, "line": " sufx = g.sufx;\n", "line_no": 242 }, { "char_end": 8876, "char_start": 8821, "line": " g.outf = MALLOC(pre + len + strlen(sufx) + 1);\n", "line_no": 245 }, { "char_end": 8983, "char_start": 8947, "line": " memcpy(g.outf, g.inf, pre);\n", "line_no": 248 }, { "char_end": 9022, "char_start": 8983, "line": " memcpy(g.outf + pre, to, len);\n", "line_no": 249 }, { "char_end": 9064, "char_start": 9022, "line": " strcpy(g.outf + pre + len, sufx);\n", "line_no": 250 }, { "char_end": 9186, "char_start": 9125, "line": " (g.force ? 0 : O_EXCL), 0600);\n", "line_no": 252 } ], "deleted": [ { "char_end": 8058, "char_start": 8033, "line": " char *to, *repl;\n", "line_no": 224 }, { "char_end": 8059, "char_start": 8058, "line": "\n", "line_no": 225 }, { "char_end": 8127, "char_start": 8059, "line": " /* use header name for output when decompressing with -N */\n", "line_no": 226 }, { "char_end": 8147, "char_start": 8127, "line": " to = g.inf;\n", "line_no": 227 }, { "char_end": 8213, "char_start": 8147, "line": " if (g.decode && (g.headis & 1) != 0 && g.hname != NULL) {\n", "line_no": 228 }, { "char_end": 8239, "char_start": 8213, "line": " to = g.hname;\n", "line_no": 229 }, { "char_end": 8274, "char_start": 8239, "line": " len = strlen(g.hname);\n", "line_no": 230 }, { "char_end": 8285, "char_start": 8284, "line": "\n", "line_no": 232 }, { "char_end": 8336, "char_start": 8285, "line": " /* replace .tgz with .tar when decoding */\n", "line_no": 233 }, { "char_end": 8403, "char_start": 8336, "line": " repl = g.decode && strcmp(to + len, \".tgz\") ? \"\" : \".tar\";\n", "line_no": 234 }, { "char_end": 8534, "char_start": 8455, "line": " g.outf = MALLOC(len + (g.decode ? strlen(repl) : strlen(g.sufx)) + 1);\n", "line_no": 237 }, { "char_end": 8638, "char_start": 8605, "line": " memcpy(g.outf, to, len);\n", "line_no": 240 }, { "char_end": 8694, "char_start": 8638, "line": " strcpy(g.outf + len, g.decode ? repl : g.sufx);\n", "line_no": 241 }, { "char_end": 8815, "char_start": 8755, "line": " (g.force ? 0 : O_EXCL), 0600);\n", "line_no": 243 } ] }, "vul_type": "cwe-022" }
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, ...
[ 1, 1, 1, 0, 1, 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 return NULL;\n\n " } ], "deleted": [] }, "commit_link": "github.com/neomutt/neomutt/commit/57971dba06346b2d7179294f4528b8d4427a7c5d", "file_name": "imap/util.c", "func_name": "imap_hcache_open", "line_changes": { "added": [ { "char_end": 504, "char_start": 413, "line": " if (strstr(mbox, \"/../\") || (strcmp(mbox, \"..\") == 0) || (strncmp(mbox, \"../\", 3) == 0))\n", "line_no": 19 }, { "char_end": 521, "char_start": 504, "line": " return NULL;\n", "line_no": 20 }, { "char_end": 550, "char_start": 521, "line": " size_t len = strlen(mbox);\n", "line_no": 21 }, { "char_end": 607, "char_start": 550, "line": " if ((len > 3) && (strcmp(mbox + len - 3, \"/..\") == 0))\n", "line_no": 22 }, { "char_end": 624, "char_start": 607, "line": " return NULL;\n", "line_no": 23 }, { "char_end": 625, "char_start": 624, "line": "\n", "line_no": 24 } ], "deleted": [] }, "vul_type": "cwe-022" }
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, ...
[ 1, 1, 1, 1, 1, 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 return NULL;\n\n " } ], "deleted": [] }, "commit_link": "github.com/neomutt/neomutt/commit/57971dba06346b2d7179294f4528b8d4427a7c5d", "file_name": "imap/util.c", "func_name": "imap_hcache_open", "line_changes": { "added": [ { "char_end": 504, "char_start": 413, "line": " if (strstr(mbox, \"/../\") || (strcmp(mbox, \"..\") == 0) || (strncmp(mbox, \"../\", 3) == 0))\n", "line_no": 19 }, { "char_end": 521, "char_start": 504, "line": " return NULL;\n", "line_no": 20 }, { "char_end": 550, "char_start": 521, "line": " size_t len = strlen(mbox);\n", "line_no": 21 }, { "char_end": 607, "char_start": 550, "line": " if ((len > 3) && (strcmp(mbox + len - 3, \"/..\") == 0))\n", "line_no": 22 }, { "char_end": 624, "char_start": 607, "line": " return NULL;\n", "line_no": 23 }, { "char_end": 625, "char_start": 624, "line": "\n", "line_no": 24 } ], "deleted": [] }, "vul_type": "cwe-022" }
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 =...
[ 1, 1, 0, 1, 1, 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": 287, "char_start": 274, "chars": ".filepath)),\n" }, { "char_end": 320, "char_start": 288, "chars": " os.path.basename(" }, { "char_end": 369, "char_start": 329, "chars": "path)\n )\n if last_" } ], "deleted": [] }, "commit_link": "github.com/DamnWidget/anaconda_go/commit/d3db90bb8853d832927818699591b91f56f6413c", "file_name": "plugin/handlers_go/anagonda/context/gometalinter.py", "func_name": "_normalize", "line_changes": { "added": [ { "char_end": 221, "char_start": 183, "line": " last_path = os.path.join(\n", "line_no": 7 }, { "char_end": 287, "char_start": 221, "line": " os.path.basename(os.path.dirname(self.filepath)),\n", "line_no": 8 }, { "char_end": 335, "char_start": 287, "line": " os.path.basename(self.filepath)\n", "line_no": 9 }, { "char_end": 349, "char_start": 335, "line": " )\n", "line_no": 10 }, { "char_end": 404, "char_start": 349, "line": " if last_path not in error.get('path', ''):\n", "line_no": 11 } ], "deleted": [ { "char_end": 242, "char_start": 183, "line": " if self.filepath not in error.get('path', ''):\n", "line_no": 7 } ] }, "vul_type": "cwe-022" }
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 ...
[ 1, 1, 1, 1, 1, 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": 287, "char_start": 274, "chars": ".filepath)),\n" }, { "char_end": 320, "char_start": 288, "chars": " os.path.basename(" }, { "char_end": 369, "char_start": 329, "chars": "path)\n )\n if last_" } ], "deleted": [] }, "commit_link": "github.com/DamnWidget/anaconda_go/commit/d3db90bb8853d832927818699591b91f56f6413c", "file_name": "plugin/handlers_go/anagonda/context/gometalinter.py", "func_name": "_normalize", "line_changes": { "added": [ { "char_end": 221, "char_start": 183, "line": " last_path = os.path.join(\n", "line_no": 7 }, { "char_end": 287, "char_start": 221, "line": " os.path.basename(os.path.dirname(self.filepath)),\n", "line_no": 8 }, { "char_end": 335, "char_start": 287, "line": " os.path.basename(self.filepath)\n", "line_no": 9 }, { "char_end": 349, "char_start": 335, "line": " )\n", "line_no": 10 }, { "char_end": 404, "char_start": 349, "line": " if last_path not in error.get('path', ''):\n", "line_no": 11 } ], "deleted": [ { "char_end": 242, "char_start": 183, "line": " if self.filepath not in error.get('path', ''):\n", "line_no": 7 } ] }, "vul_type": "cwe-022" }
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_...
[ 1, 0, 1, 1, 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();\n }\n\n " } ], "deleted": [] }, "commit_link": "github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_load_text_ext", "line_changes": { "added": [ { "char_end": 215, "char_start": 175, "line": " if (!str_is_correct_filename(name))\n", "line_no": 6 }, { "char_end": 221, "char_start": 215, "line": " {\n", "line_no": 7 }, { "char_end": 297, "char_start": 221, "line": " error_msg(\"Cannot load text. '%s' is not a valid file name\", name);\n", "line_no": 8 }, { "char_end": 357, "char_start": 297, "line": " if (!(flags & DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE))\n", "line_no": 9 }, { "char_end": 382, "char_start": 357, "line": " xfunc_die();\n", "line_no": 10 }, { "char_end": 388, "char_start": 382, "line": " }\n", "line_no": 11 }, { "char_end": 389, "char_start": 388, "line": "\n", "line_no": 12 } ], "deleted": [] }, "vul_type": "cwe-022" }
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, 1, 1, 1, 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();\n }\n\n " } ], "deleted": [] }, "commit_link": "github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_load_text_ext", "line_changes": { "added": [ { "char_end": 215, "char_start": 175, "line": " if (!str_is_correct_filename(name))\n", "line_no": 6 }, { "char_end": 221, "char_start": 215, "line": " {\n", "line_no": 7 }, { "char_end": 297, "char_start": 221, "line": " error_msg(\"Cannot load text. '%s' is not a valid file name\", name);\n", "line_no": 8 }, { "char_end": 357, "char_start": 297, "line": " if (!(flags & DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE))\n", "line_no": 9 }, { "char_end": 382, "char_start": 357, "line": " xfunc_die();\n", "line_no": 10 }, { "char_end": 388, "char_start": 382, "line": " }\n", "line_no": 11 }, { "char_end": 389, "char_start": 388, "line": "\n", "line_no": 12 } ], "deleted": [] }, "vul_type": "cwe-022" }
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" ]
[ 1, 0, 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/76363226bd8533256f7795bba358d7f4b8a6c9e6", "file_name": "nova/image/s3.py", "func_name": "_download_file", "line_changes": { "added": [ { "char_end": 187, "char_start": 110, "line": " local_filename = os.path.join(local_dir, os.path.basename(filename))\n", "line_no": 4 } ], "deleted": [ { "char_end": 169, "char_start": 110, "line": " local_filename = os.path.join(local_dir, filename)\n", "line_no": 4 } ] }, "vul_type": "cwe-022" }
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, 1, 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/76363226bd8533256f7795bba358d7f4b8a6c9e6", "file_name": "nova/image/s3.py", "func_name": "_download_file", "line_changes": { "added": [ { "char_end": 187, "char_start": 110, "line": " local_filename = os.path.join(local_dir, os.path.basename(filename))\n", "line_no": 4 } ], "deleted": [ { "char_end": 169, "char_start": 110, "line": " local_filename = os.path.join(local_dir, filename)\n", "line_no": 4 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 all illegal backslashes\n\t // and all relative upward paths segments \"/../\" from the zip's local \n\t // file name/path before prepending the target folder to create \n\t // the final path\n\n\t QString original_path = qfile_name;\n\t bool evil_or_corrupt_epub = false;\n\n\t if (qfile_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n\t qfile_name = \"/\" + qfile_name.replace(\"\\\\\",\"\");\n\n\t if (qfile_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n\t qfile_name = qfile_name.replace(\"/../\",\"/\");\n\n\t while(qfile_name.startsWith(\"/\")) { \n\t\t qfile_name = qfile_name.remove(0,1);\n\t }\n \n\t if (cp437_file_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n\t cp437_file_name = \"/\" + cp437_file_name.replace(\"\\\\\",\"\");\n\n\t if (cp437_file_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n\t cp437_file_name = cp437_file_name.replace(\"/../\",\"/\");\n\n\t while(cp437_file_name.startsWith(\"/\")) { \n\t\t cp437_file_name = cp437_file_name.remove(0,1);\n\t }\n\n\t if (evil_or_corrupt_epub) {\n\t\t unzCloseCurrentFile(zfile);\n\t\t unzClose(zfile);\n\t\t // throw (UNZIPLoadParseError(QString(QObject::tr(\"Possible evil or corrupt zip file name: %1\")).arg(original_path).toStdString()));\n return false;\n\t }\n\n" } ], "deleted": [] }, "commit_link": "github.com/Sigil-Ebook/Sigil/commit/0979ba8d10c96ebca330715bfd4494ea0e019a8f", "file_name": "src/Misc/Utility.cpp", "func_name": "Utility::UnZip", "line_changes": { "added": [ { "char_end": 1401, "char_start": 1400, "line": "\n", "line_no": 39 }, { "char_end": 1801, "char_start": 1800, "line": "\n", "line_no": 46 }, { "char_end": 1846, "char_start": 1801, "line": "\t QString original_path = qfile_name;\n", "line_no": 47 }, { "char_end": 1890, "char_start": 1846, "line": "\t bool evil_or_corrupt_epub = false;\n", "line_no": 48 }, { "char_end": 1891, "char_start": 1890, "line": "\n", "line_no": 49 }, { "char_end": 1961, "char_start": 1891, "line": "\t if (qfile_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n", "line_no": 50 }, { "char_end": 2018, "char_start": 1961, "line": "\t qfile_name = \"/\" + qfile_name.replace(\"\\\\\",\"\");\n", "line_no": 51 }, { "char_end": 2019, "char_start": 2018, "line": "\n", "line_no": 52 }, { "char_end": 2090, "char_start": 2019, "line": "\t if (qfile_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n", "line_no": 53 }, { "char_end": 2144, "char_start": 2090, "line": "\t qfile_name = qfile_name.replace(\"/../\",\"/\");\n", "line_no": 54 }, { "char_end": 2145, "char_start": 2144, "line": "\n", "line_no": 55 }, { "char_end": 2191, "char_start": 2145, "line": "\t while(qfile_name.startsWith(\"/\")) { \n", "line_no": 56 }, { "char_end": 2232, "char_start": 2191, "line": "\t\t qfile_name = qfile_name.remove(0,1);\n", "line_no": 57 }, { "char_end": 2243, "char_start": 2232, "line": "\t }\n", "line_no": 58 }, { "char_end": 2260, "char_start": 2243, "line": " \n", "line_no": 59 }, { "char_end": 2335, "char_start": 2260, "line": "\t if (cp437_file_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n", "line_no": 60 }, { "char_end": 2402, "char_start": 2335, "line": "\t cp437_file_name = \"/\" + cp437_file_name.replace(\"\\\\\",\"\");\n", "line_no": 61 }, { "char_end": 2403, "char_start": 2402, "line": "\n", "line_no": 62 }, { "char_end": 2479, "char_start": 2403, "line": "\t if (cp437_file_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n", "line_no": 63 }, { "char_end": 2543, "char_start": 2479, "line": "\t cp437_file_name = cp437_file_name.replace(\"/../\",\"/\");\n", "line_no": 64 }, { "char_end": 2544, "char_start": 2543, "line": "\n", "line_no": 65 }, { "char_end": 2595, "char_start": 2544, "line": "\t while(cp437_file_name.startsWith(\"/\")) { \n", "line_no": 66 }, { "char_end": 2646, "char_start": 2595, "line": "\t\t cp437_file_name = cp437_file_name.remove(0,1);\n", "line_no": 67 }, { "char_end": 2657, "char_start": 2646, "line": "\t }\n", "line_no": 68 }, { "char_end": 2658, "char_start": 2657, "line": "\n", "line_no": 69 }, { "char_end": 2695, "char_start": 2658, "line": "\t if (evil_or_corrupt_epub) {\n", "line_no": 70 }, { "char_end": 2729, "char_start": 2695, "line": "\t\t unzCloseCurrentFile(zfile);\n", "line_no": 71 }, { "char_end": 2752, "char_start": 2729, "line": "\t\t unzClose(zfile);\n", "line_no": 72 }, { "char_end": 2925, "char_start": 2891, "line": " return false;\n", "line_no": 74 }, { "char_end": 2936, "char_start": 2925, "line": "\t }\n", "line_no": 75 }, { "char_end": 2937, "char_start": 2936, "line": "\n", "line_no": 76 } ], "deleted": [] }, "vul_type": "cwe-022" }
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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 all illegal backslashes\n\t // and all relative upward paths segments \"/../\" from the zip's local \n\t // file name/path before prepending the target folder to create \n\t // the final path\n\n\t QString original_path = qfile_name;\n\t bool evil_or_corrupt_epub = false;\n\n\t if (qfile_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n\t qfile_name = \"/\" + qfile_name.replace(\"\\\\\",\"\");\n\n\t if (qfile_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n\t qfile_name = qfile_name.replace(\"/../\",\"/\");\n\n\t while(qfile_name.startsWith(\"/\")) { \n\t\t qfile_name = qfile_name.remove(0,1);\n\t }\n \n\t if (cp437_file_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n\t cp437_file_name = \"/\" + cp437_file_name.replace(\"\\\\\",\"\");\n\n\t if (cp437_file_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n\t cp437_file_name = cp437_file_name.replace(\"/../\",\"/\");\n\n\t while(cp437_file_name.startsWith(\"/\")) { \n\t\t cp437_file_name = cp437_file_name.remove(0,1);\n\t }\n\n\t if (evil_or_corrupt_epub) {\n\t\t unzCloseCurrentFile(zfile);\n\t\t unzClose(zfile);\n\t\t // throw (UNZIPLoadParseError(QString(QObject::tr(\"Possible evil or corrupt zip file name: %1\")).arg(original_path).toStdString()));\n return false;\n\t }\n\n" } ], "deleted": [] }, "commit_link": "github.com/Sigil-Ebook/Sigil/commit/0979ba8d10c96ebca330715bfd4494ea0e019a8f", "file_name": "src/Misc/Utility.cpp", "func_name": "Utility::UnZip", "line_changes": { "added": [ { "char_end": 1401, "char_start": 1400, "line": "\n", "line_no": 39 }, { "char_end": 1801, "char_start": 1800, "line": "\n", "line_no": 46 }, { "char_end": 1846, "char_start": 1801, "line": "\t QString original_path = qfile_name;\n", "line_no": 47 }, { "char_end": 1890, "char_start": 1846, "line": "\t bool evil_or_corrupt_epub = false;\n", "line_no": 48 }, { "char_end": 1891, "char_start": 1890, "line": "\n", "line_no": 49 }, { "char_end": 1961, "char_start": 1891, "line": "\t if (qfile_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n", "line_no": 50 }, { "char_end": 2018, "char_start": 1961, "line": "\t qfile_name = \"/\" + qfile_name.replace(\"\\\\\",\"\");\n", "line_no": 51 }, { "char_end": 2019, "char_start": 2018, "line": "\n", "line_no": 52 }, { "char_end": 2090, "char_start": 2019, "line": "\t if (qfile_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n", "line_no": 53 }, { "char_end": 2144, "char_start": 2090, "line": "\t qfile_name = qfile_name.replace(\"/../\",\"/\");\n", "line_no": 54 }, { "char_end": 2145, "char_start": 2144, "line": "\n", "line_no": 55 }, { "char_end": 2191, "char_start": 2145, "line": "\t while(qfile_name.startsWith(\"/\")) { \n", "line_no": 56 }, { "char_end": 2232, "char_start": 2191, "line": "\t\t qfile_name = qfile_name.remove(0,1);\n", "line_no": 57 }, { "char_end": 2243, "char_start": 2232, "line": "\t }\n", "line_no": 58 }, { "char_end": 2260, "char_start": 2243, "line": " \n", "line_no": 59 }, { "char_end": 2335, "char_start": 2260, "line": "\t if (cp437_file_name.contains(\"\\\\\")) evil_or_corrupt_epub = true; \n", "line_no": 60 }, { "char_end": 2402, "char_start": 2335, "line": "\t cp437_file_name = \"/\" + cp437_file_name.replace(\"\\\\\",\"\");\n", "line_no": 61 }, { "char_end": 2403, "char_start": 2402, "line": "\n", "line_no": 62 }, { "char_end": 2479, "char_start": 2403, "line": "\t if (cp437_file_name.contains(\"/../\")) evil_or_corrupt_epub = true;\n", "line_no": 63 }, { "char_end": 2543, "char_start": 2479, "line": "\t cp437_file_name = cp437_file_name.replace(\"/../\",\"/\");\n", "line_no": 64 }, { "char_end": 2544, "char_start": 2543, "line": "\n", "line_no": 65 }, { "char_end": 2595, "char_start": 2544, "line": "\t while(cp437_file_name.startsWith(\"/\")) { \n", "line_no": 66 }, { "char_end": 2646, "char_start": 2595, "line": "\t\t cp437_file_name = cp437_file_name.remove(0,1);\n", "line_no": 67 }, { "char_end": 2657, "char_start": 2646, "line": "\t }\n", "line_no": 68 }, { "char_end": 2658, "char_start": 2657, "line": "\n", "line_no": 69 }, { "char_end": 2695, "char_start": 2658, "line": "\t if (evil_or_corrupt_epub) {\n", "line_no": 70 }, { "char_end": 2729, "char_start": 2695, "line": "\t\t unzCloseCurrentFile(zfile);\n", "line_no": 71 }, { "char_end": 2752, "char_start": 2729, "line": "\t\t unzClose(zfile);\n", "line_no": 72 }, { "char_end": 2925, "char_start": 2891, "line": " return false;\n", "line_no": 74 }, { "char_end": 2936, "char_start": 2925, "line": "\t }\n", "line_no": 75 }, { "char_end": 2937, "char_start": 2936, "line": "\n", "line_no": 76 } ], "deleted": [] }, "vul_type": "cwe-022" }
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_DI...
[ 1, 1, 0, 1, 1, 1, 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" }, { "char_end": 190, "char_start": 186, "chars": "path" }, { "char_end": 197, "char_start": 193, "chars": "os.p" }, { "char_end": 201, "char_start": 199, "chars": "h." }, { "char_end": 236, "char_start": 202, "chars": "bspath(settings.STORAGE_DIR + new_" }, { "char_end": 240, "char_start": 239, "chars": ")" }, { "char_end": 251, "char_start": 249, "chars": "if" }, { "char_end": 254, "char_start": 253, "chars": "o" }, { "char_end": 280, "char_start": 258, "chars": "w_abspath.startswith(s" }, { "char_end": 305, "char_start": 281, "chars": "ttings.STORAGE_DIR):\n " }, { "char_end": 316, "char_start": 306, "chars": " re" }, { "char_end": 320, "char_start": 317, "chars": "urn" }, { "char_end": 329, "char_start": 322, "chars": "eb.Resp" }, { "char_end": 336, "char_start": 330, "chars": "nse(st" }, { "char_end": 346, "char_start": 337, "chars": "tus=400, " }, { "char_end": 364, "char_start": 348, "chars": "dy=b'Invalid Req" }, { "char_end": 367, "char_start": 365, "chars": "es" }, { "char_end": 379, "char_start": 368, "chars": "')\n\n " }, { "char_end": 393, "char_start": 380, "chars": "if new_abspat" }, { "char_end": 399, "char_start": 394, "chars": " != i" }, { "char_end": 401, "char_start": 400, "chars": "e" }, { "char_end": 408, "char_start": 402, "chars": ".abspa" }, { "char_end": 411, "char_start": 409, "chars": "h:" }, { "char_end": 416, "char_start": 412, "chars": " " }, { "char_end": 456, "char_start": 454, "chars": "ab" }, { "char_end": 461, "char_start": 457, "chars": "path" }, { "char_end": 467, "char_start": 463, "chars": " " }, { "char_end": 520, "char_start": 516, "chars": " " }, { "char_end": 561, "char_start": 557, "chars": " " }, { "char_end": 604, "char_start": 600, "chars": " " } ], "deleted": [ { "char_end": 173, "char_start": 170, "chars": "and" }, { "char_end": 181, "char_start": 179, "chars": "rc" }, { "char_end": 183, "char_start": 182, "chars": "!" }, { "char_end": 186, "char_start": 185, "chars": "d" }, { "char_end": 191, "char_start": 189, "chars": "['" }, { "char_end": 197, "char_start": 194, "chars": "']:" }, { "char_end": 207, "char_start": 206, "chars": "#" }, { "char_end": 209, "char_start": 208, "chars": "d" }, { "char_end": 212, "char_start": 210, "chars": "n'" }, { "char_end": 218, "char_start": 217, "chars": "d" }, { "char_end": 221, "char_start": 219, "chars": "to" }, { "char_end": 224, "char_start": 222, "chars": "wo" }, { "char_end": 227, "char_start": 226, "chars": "y" }, { "char_end": 229, "char_start": 228, "chars": "a" }, { "char_end": 233, "char_start": 232, "chars": "t" }, { "char_end": 237, "char_start": 234, "chars": "htm" }, { "char_end": 241, "char_start": 239, "chars": "un" }, { "char_end": 244, "char_start": 243, "chars": "o" }, { "char_end": 304, "char_start": 281, "chars": "settings.STORAGE_DIR + " }, { "char_end": 311, "char_start": 309, "chars": "rc" } ] }, "commit_link": "github.com/crccheck/gallery-cms/commit/60dec5c580a779ae27824ed54cb113eca25afdc0", "file_name": "gallery/gallery.py", "func_name": "save", "line_changes": { "added": [ { "char_end": 171, "char_start": 155, "line": " if new_src:\n", "line_no": 8 }, { "char_end": 241, "char_start": 171, "line": " new_abspath = os.path.abspath(settings.STORAGE_DIR + new_src)\n", "line_no": 9 }, { "char_end": 302, "char_start": 241, "line": " if not new_abspath.startswith(settings.STORAGE_DIR):\n", "line_no": 10 }, { "char_end": 371, "char_start": 302, "line": " return web.Response(status=400, body=b'Invalid Request')\n", "line_no": 11 }, { "char_end": 372, "char_start": 371, "line": "\n", "line_no": 12 }, { "char_end": 412, "char_start": 372, "line": " if new_abspath != item.abspath:\n", "line_no": 13 }, { "char_end": 463, "char_start": 412, "line": " shutil.move(item.abspath, new_abspath)\n", "line_no": 14 }, { "char_end": 516, "char_start": 463, "line": " old_backup_abspath = item.backup_abspath\n", "line_no": 15 }, { "char_end": 549, "char_start": 516, "line": " item = Item(new_src)\n", "line_no": 16 }, { "char_end": 600, "char_start": 549, "line": " if os.path.isfile(old_backup_abspath):\n", "line_no": 17 }, { "char_end": 669, "char_start": 600, "line": " shutil.move(old_backup_abspath, item.backup_abspath)\n", "line_no": 18 } ], "deleted": [ { "char_end": 198, "char_start": 155, "line": " if new_src and new_src != data['src']:\n", "line_no": 8 }, { "char_end": 313, "char_start": 247, "line": " shutil.move(item.abspath, settings.STORAGE_DIR + new_src)\n", "line_no": 10 }, { "char_end": 362, "char_start": 313, "line": " old_backup_abspath = item.backup_abspath\n", "line_no": 11 }, { "char_end": 391, "char_start": 362, "line": " item = Item(new_src)\n", "line_no": 12 }, { "char_end": 438, "char_start": 391, "line": " if os.path.isfile(old_backup_abspath):\n", "line_no": 13 }, { "char_end": 503, "char_start": 438, "line": " shutil.move(old_backup_abspath, item.backup_abspath)\n", "line_no": 14 } ] }, "vul_type": "cwe-022" }
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)...
[ 1, 1, 1, 1, 1, 1, 1, 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" }, { "char_end": 190, "char_start": 186, "chars": "path" }, { "char_end": 197, "char_start": 193, "chars": "os.p" }, { "char_end": 201, "char_start": 199, "chars": "h." }, { "char_end": 236, "char_start": 202, "chars": "bspath(settings.STORAGE_DIR + new_" }, { "char_end": 240, "char_start": 239, "chars": ")" }, { "char_end": 251, "char_start": 249, "chars": "if" }, { "char_end": 254, "char_start": 253, "chars": "o" }, { "char_end": 280, "char_start": 258, "chars": "w_abspath.startswith(s" }, { "char_end": 305, "char_start": 281, "chars": "ttings.STORAGE_DIR):\n " }, { "char_end": 316, "char_start": 306, "chars": " re" }, { "char_end": 320, "char_start": 317, "chars": "urn" }, { "char_end": 329, "char_start": 322, "chars": "eb.Resp" }, { "char_end": 336, "char_start": 330, "chars": "nse(st" }, { "char_end": 346, "char_start": 337, "chars": "tus=400, " }, { "char_end": 364, "char_start": 348, "chars": "dy=b'Invalid Req" }, { "char_end": 367, "char_start": 365, "chars": "es" }, { "char_end": 379, "char_start": 368, "chars": "')\n\n " }, { "char_end": 393, "char_start": 380, "chars": "if new_abspat" }, { "char_end": 399, "char_start": 394, "chars": " != i" }, { "char_end": 401, "char_start": 400, "chars": "e" }, { "char_end": 408, "char_start": 402, "chars": ".abspa" }, { "char_end": 411, "char_start": 409, "chars": "h:" }, { "char_end": 416, "char_start": 412, "chars": " " }, { "char_end": 456, "char_start": 454, "chars": "ab" }, { "char_end": 461, "char_start": 457, "chars": "path" }, { "char_end": 467, "char_start": 463, "chars": " " }, { "char_end": 520, "char_start": 516, "chars": " " }, { "char_end": 561, "char_start": 557, "chars": " " }, { "char_end": 604, "char_start": 600, "chars": " " } ], "deleted": [ { "char_end": 173, "char_start": 170, "chars": "and" }, { "char_end": 181, "char_start": 179, "chars": "rc" }, { "char_end": 183, "char_start": 182, "chars": "!" }, { "char_end": 186, "char_start": 185, "chars": "d" }, { "char_end": 191, "char_start": 189, "chars": "['" }, { "char_end": 197, "char_start": 194, "chars": "']:" }, { "char_end": 207, "char_start": 206, "chars": "#" }, { "char_end": 209, "char_start": 208, "chars": "d" }, { "char_end": 212, "char_start": 210, "chars": "n'" }, { "char_end": 218, "char_start": 217, "chars": "d" }, { "char_end": 221, "char_start": 219, "chars": "to" }, { "char_end": 224, "char_start": 222, "chars": "wo" }, { "char_end": 227, "char_start": 226, "chars": "y" }, { "char_end": 229, "char_start": 228, "chars": "a" }, { "char_end": 233, "char_start": 232, "chars": "t" }, { "char_end": 237, "char_start": 234, "chars": "htm" }, { "char_end": 241, "char_start": 239, "chars": "un" }, { "char_end": 244, "char_start": 243, "chars": "o" }, { "char_end": 304, "char_start": 281, "chars": "settings.STORAGE_DIR + " }, { "char_end": 311, "char_start": 309, "chars": "rc" } ] }, "commit_link": "github.com/crccheck/gallery-cms/commit/60dec5c580a779ae27824ed54cb113eca25afdc0", "file_name": "gallery/gallery.py", "func_name": "save", "line_changes": { "added": [ { "char_end": 171, "char_start": 155, "line": " if new_src:\n", "line_no": 8 }, { "char_end": 241, "char_start": 171, "line": " new_abspath = os.path.abspath(settings.STORAGE_DIR + new_src)\n", "line_no": 9 }, { "char_end": 302, "char_start": 241, "line": " if not new_abspath.startswith(settings.STORAGE_DIR):\n", "line_no": 10 }, { "char_end": 371, "char_start": 302, "line": " return web.Response(status=400, body=b'Invalid Request')\n", "line_no": 11 }, { "char_end": 372, "char_start": 371, "line": "\n", "line_no": 12 }, { "char_end": 412, "char_start": 372, "line": " if new_abspath != item.abspath:\n", "line_no": 13 }, { "char_end": 463, "char_start": 412, "line": " shutil.move(item.abspath, new_abspath)\n", "line_no": 14 }, { "char_end": 516, "char_start": 463, "line": " old_backup_abspath = item.backup_abspath\n", "line_no": 15 }, { "char_end": 549, "char_start": 516, "line": " item = Item(new_src)\n", "line_no": 16 }, { "char_end": 600, "char_start": 549, "line": " if os.path.isfile(old_backup_abspath):\n", "line_no": 17 }, { "char_end": 669, "char_start": 600, "line": " shutil.move(old_backup_abspath, item.backup_abspath)\n", "line_no": 18 } ], "deleted": [ { "char_end": 198, "char_start": 155, "line": " if new_src and new_src != data['src']:\n", "line_no": 8 }, { "char_end": 313, "char_start": 247, "line": " shutil.move(item.abspath, settings.STORAGE_DIR + new_src)\n", "line_no": 10 }, { "char_end": 362, "char_start": 313, "line": " old_backup_abspath = item.backup_abspath\n", "line_no": 11 }, { "char_end": 391, "char_start": 362, "line": " item = Item(new_src)\n", "line_no": 12 }, { "char_end": 438, "char_start": 391, "line": " if os.path.isfile(old_backup_abspath):\n", "line_no": 13 }, { "char_end": 503, "char_start": 438, "line": " shutil.move(old_backup_abspath, item.backup_abspath)\n", "line_no": 14 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 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, "char_start": 898, "chars": "\t }\n" }, { "char_end": 1122, "char_start": 1095, "chars": "page_name_is_good(page) && " }, { "char_end": 1467, "char_start": 1440, "chars": "page_name_is_good(page) && " } ], "deleted": [ { "char_end": 349, "char_start": 348, "chars": " " }, { "char_end": 740, "char_start": 733, "chars": "\t " }, { "char_end": 1375, "char_start": 1374, "chars": " " } ] }, "commit_link": "github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea", "file_name": "src/wiki.c", "func_name": "wiki_handle_rest_call", "line_changes": { "added": [ { "char_end": 376, "char_start": 307, "line": "\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n", "line_no": 15 }, { "char_end": 757, "char_start": 725, "line": "\t if (page_name_is_good(page))\n", "line_no": 28 }, { "char_end": 764, "char_start": 757, "line": "\t {\n", "line_no": 29 }, { "char_end": 799, "char_start": 764, "line": "\t file_write(page, wikitext);\n", "line_no": 30 }, { "char_end": 905, "char_start": 898, "line": "\t }\n", "line_no": 35 }, { "char_end": 1142, "char_start": 1080, "line": "\t if (page && page_name_is_good(page) && (unlink(page) > 0))\n", "line_no": 44 }, { "char_end": 1494, "char_start": 1425, "line": "\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n", "line_no": 58 } ], "deleted": [ { "char_end": 350, "char_start": 307, "line": "\t if (page && (access(page, R_OK) == 0)) \n", "line_no": 15 }, { "char_end": 741, "char_start": 699, "line": "\t file_write(page, wikitext);\t \n", "line_no": 28 }, { "char_end": 1050, "char_start": 1015, "line": "\t if (page && (unlink(page) > 0))\n", "line_no": 41 }, { "char_end": 1376, "char_start": 1333, "line": "\t if (page && (access(page, R_OK) == 0)) \n", "line_no": 55 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, "char_start": 898, "chars": "\t }\n" }, { "char_end": 1122, "char_start": 1095, "chars": "page_name_is_good(page) && " }, { "char_end": 1467, "char_start": 1440, "chars": "page_name_is_good(page) && " } ], "deleted": [ { "char_end": 349, "char_start": 348, "chars": " " }, { "char_end": 740, "char_start": 733, "chars": "\t " }, { "char_end": 1375, "char_start": 1374, "chars": " " } ] }, "commit_link": "github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea", "file_name": "src/wiki.c", "func_name": "wiki_handle_rest_call", "line_changes": { "added": [ { "char_end": 376, "char_start": 307, "line": "\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n", "line_no": 15 }, { "char_end": 757, "char_start": 725, "line": "\t if (page_name_is_good(page))\n", "line_no": 28 }, { "char_end": 764, "char_start": 757, "line": "\t {\n", "line_no": 29 }, { "char_end": 799, "char_start": 764, "line": "\t file_write(page, wikitext);\n", "line_no": 30 }, { "char_end": 905, "char_start": 898, "line": "\t }\n", "line_no": 35 }, { "char_end": 1142, "char_start": 1080, "line": "\t if (page && page_name_is_good(page) && (unlink(page) > 0))\n", "line_no": 44 }, { "char_end": 1494, "char_start": 1425, "line": "\t if (page && page_name_is_good(page) && (access(page, R_OK) == 0))\n", "line_no": 58 } ], "deleted": [ { "char_end": 350, "char_start": 307, "line": "\t if (page && (access(page, R_OK) == 0)) \n", "line_no": 15 }, { "char_end": 741, "char_start": 699, "line": "\t file_write(page, wikitext);\t \n", "line_no": 28 }, { "char_end": 1050, "char_start": 1015, "line": "\t if (page && (unlink(page) > 0))\n", "line_no": 41 }, { "char_end": 1376, "char_start": 1333, "line": "\t if (page && (access(page, R_OK) == 0)) \n", "line_no": 55 } ] }, "vul_type": "cwe-022" }
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 ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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" }, { "char_end": 12055, "char_start": 11557, "chars": "\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }" } ], "deleted": [ { "char_end": 9126, "char_start": 9085, "chars": "element == NULL || element[0] == '\\0' || " }, { "char_end": 9146, "char_start": 9141, "chars": " > 64" } ] }, "commit_link": "github.com/abrt/abrt/commit/f3c2a6af3455b2882e28570e8a04f1c2d4500d5b", "file_name": "src/dbus/abrt-dbus.c", "func_name": "handle_method_call", "line_changes": { "added": [ { "char_end": 9120, "char_start": 9073, "line": " if (!str_is_correct_filename(element))\n", "line_no": 259 }, { "char_end": 11606, "char_start": 11559, "line": " if (!str_is_correct_filename(element))\n", "line_no": 318 }, { "char_end": 11616, "char_start": 11606, "line": " {\n", "line_no": 319 }, { "char_end": 11705, "char_start": 11616, "line": " log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n", "line_no": 320 }, { "char_end": 11790, "char_start": 11705, "line": " char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n", "line_no": 321 }, { "char_end": 11857, "char_start": 11790, "line": " g_dbus_method_invocation_return_dbus_error(invocation,\n", "line_no": 322 }, { "char_end": 11946, "char_start": 11857, "line": " \"org.freedesktop.problems.InvalidElement\",\n", "line_no": 323 }, { "char_end": 12000, "char_start": 11946, "line": " error);\n", "line_no": 324 }, { "char_end": 12001, "char_start": 12000, "line": "\n", "line_no": 325 }, { "char_end": 12026, "char_start": 12001, "line": " free(error);\n", "line_no": 326 }, { "char_end": 12046, "char_start": 12026, "line": " return;\n", "line_no": 327 }, { "char_end": 12056, "char_start": 12046, "line": " }\n", "line_no": 328 }, { "char_end": 12057, "char_start": 12056, "line": "\n", "line_no": 329 } ], "deleted": [ { "char_end": 9148, "char_start": 9073, "line": " if (element == NULL || element[0] == '\\0' || strlen(element) > 64)\n", "line_no": 259 } ] }, "vul_type": "cwe-022" }
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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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" }, { "char_end": 12055, "char_start": 11557, "chars": "\n\n if (!str_is_correct_filename(element))\n {\n log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n g_dbus_method_invocation_return_dbus_error(invocation,\n \"org.freedesktop.problems.InvalidElement\",\n error);\n\n free(error);\n return;\n }" } ], "deleted": [ { "char_end": 9126, "char_start": 9085, "chars": "element == NULL || element[0] == '\\0' || " }, { "char_end": 9146, "char_start": 9141, "chars": " > 64" } ] }, "commit_link": "github.com/abrt/abrt/commit/f3c2a6af3455b2882e28570e8a04f1c2d4500d5b", "file_name": "src/dbus/abrt-dbus.c", "func_name": "handle_method_call", "line_changes": { "added": [ { "char_end": 9120, "char_start": 9073, "line": " if (!str_is_correct_filename(element))\n", "line_no": 259 }, { "char_end": 11606, "char_start": 11559, "line": " if (!str_is_correct_filename(element))\n", "line_no": 318 }, { "char_end": 11616, "char_start": 11606, "line": " {\n", "line_no": 319 }, { "char_end": 11705, "char_start": 11616, "line": " log_notice(\"'%s' is not a valid element name of '%s'\", element, problem_id);\n", "line_no": 320 }, { "char_end": 11790, "char_start": 11705, "line": " char *error = xasprintf(_(\"'%s' is not a valid element name\"), element);\n", "line_no": 321 }, { "char_end": 11857, "char_start": 11790, "line": " g_dbus_method_invocation_return_dbus_error(invocation,\n", "line_no": 322 }, { "char_end": 11946, "char_start": 11857, "line": " \"org.freedesktop.problems.InvalidElement\",\n", "line_no": 323 }, { "char_end": 12000, "char_start": 11946, "line": " error);\n", "line_no": 324 }, { "char_end": 12001, "char_start": 12000, "line": "\n", "line_no": 325 }, { "char_end": 12026, "char_start": 12001, "line": " free(error);\n", "line_no": 326 }, { "char_end": 12046, "char_start": 12026, "line": " return;\n", "line_no": 327 }, { "char_end": 12056, "char_start": 12046, "line": " }\n", "line_no": 328 }, { "char_end": 12057, "char_start": 12056, "line": "\n", "line_no": 329 } ], "deleted": [ { "char_end": 9148, "char_start": 9073, "line": " if (element == NULL || element[0] == '\\0' || strlen(element) > 64)\n", "line_no": 259 } ] }, "vul_type": "cwe-022" }
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, 077...
[ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 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" }, { "char_end": 401, "char_start": 339, "chars": "std::string::npos;\n // Normally would just use std::string::r" }, { "char_end": 492, "char_start": 403, "chars": "nd here, but if we want to be\n // consistent between Windows and Linux, even if techinca" }, { "char_end": 510, "char_start": 493, "chars": "ly Linux won't us" }, { "char_end": 541, "char_start": 511, "chars": "\n // backslash for a separato" }, { "char_end": 560, "char_start": 542, "chars": ", we are checking " }, { "char_end": 578, "char_start": 561, "chars": "or both types.\n " }, { "char_end": 583, "char_start": 580, "chars": "t i" }, { "char_end": 599, "char_start": 584, "chars": "x = file.length" }, { "char_end": 605, "char_start": 601, "chars": " - 1" }, { "char_end": 728, "char_start": 609, "chars": "while (idx >= 0) {\n if (FileUtil::isDirSeparator(file[idx])) {\n sep = idx;\n break;\n }\n idx--;\n }\n " }, { "char_end": 768, "char_start": 764, "chars": "// m" }, { "char_end": 807, "char_start": 769, "chars": "ke_relative_path so we do not try to p" }, { "char_end": 816, "char_start": 809, "chars": " files " }, { "char_end": 937, "char_start": 817, "chars": "r dirs in bad\n // places. This securely \"cleans\" the file.\n clean_file = make_relative_path(file);\n std::string" }, { "char_end": 956, "char_start": 950, "chars": "clean_" }, { "char_end": 972, "char_start": 960, "chars": ";\n bool i" }, { "char_end": 987, "char_start": 973, "chars": "_dir_only = tr" }, { "char_end": 999, "char_start": 988, "chars": "e;\n if (" }, { "char_end": 1014, "char_start": 1000, "chars": "ep < file.leng" }, { "char_end": 1042, "char_start": 1015, "chars": "h() - 1) { // not just a di" }, { "char_end": 1085, "char_start": 1043, "chars": "ectory\n auto clean_file_dir = HHVM_FN" }, { "char_end": 1125, "char_start": 1086, "chars": "dirname)(clean_file);\n path = to +" }, { "char_end": 1128, "char_start": 1126, "chars": "cl" }, { "char_end": 1144, "char_start": 1129, "chars": "an_file_dir.toC" }, { "char_end": 1153, "char_start": 1145, "chars": "pString(" }, { "char_end": 1265, "char_start": 1156, "chars": " is_dir_only = false;\n }\n\n // Make sure the directory path to extract to exists or can be created\n" }, { "char_end": 1389, "char_start": 1367, "chars": "// If we have a good d" }, { "char_end": 1431, "char_start": 1390, "chars": "rectory to extract to above, we now check" }, { "char_end": 1437, "char_start": 1432, "chars": "wheth" }, { "char_end": 1442, "char_start": 1438, "chars": "r\n " }, { "char_end": 1452, "char_start": 1444, "chars": "// the \"" }, { "char_end": 1463, "char_start": 1456, "chars": "\" param" }, { "char_end": 1476, "char_start": 1464, "chars": "ter passed i" }, { "char_end": 1488, "char_start": 1477, "chars": " is a direc" }, { "char_end": 1492, "char_start": 1489, "chars": "ory" }, { "char_end": 1495, "char_start": 1493, "chars": "or" }, { "char_end": 1532, "char_start": 1496, "chars": "actually a file.\n if (is_dir_only" }, { "char_end": 1564, "char_start": 1535, "chars": " // directory, like /usr/bin/" }, { "char_end": 1598, "char_start": 1594, "chars": "// o" }, { "char_end": 1605, "char_start": 1599, "chars": "herwis" }, { "char_end": 1607, "char_start": 1606, "chars": " " }, { "char_end": 1614, "char_start": 1612, "chars": "is" }, { "char_end": 1617, "char_start": 1615, "chars": "ac" }, { "char_end": 1623, "char_start": 1619, "chars": "ally" }, { "char_end": 1627, "char_start": 1624, "chars": "a f" }, { "char_end": 1632, "char_start": 1628, "chars": "le, " }, { "char_end": 1640, "char_start": 1633, "chars": "o we ac" }, { "char_end": 1642, "char_start": 1641, "chars": "u" }, { "char_end": 1646, "char_start": 1643, "chars": "lly" }, { "char_end": 1649, "char_start": 1647, "chars": "ex" }, { "char_end": 1651, "char_start": 1650, "chars": "r" }, { "char_end": 1653, "char_start": 1652, "chars": "c" }, { "char_end": 1655, "char_start": 1654, "chars": "." }, { "char_end": 1661, "char_start": 1658, "chars": "}\n\n" }, { "char_end": 1676, "char_start": 1662, "chars": " // We have en" }, { "char_end": 1682, "char_start": 1677, "chars": "ured " }, { "char_end": 1684, "char_start": 1683, "chars": "h" }, { "char_end": 1693, "char_start": 1687, "chars": "clean_" }, { "char_end": 1712, "char_start": 1697, "chars": " will be added " }, { "char_end": 1714, "char_start": 1713, "chars": "o" }, { "char_end": 1716, "char_start": 1715, "chars": "a" }, { "char_end": 1722, "char_start": 1717, "chars": "relat" }, { "char_end": 1726, "char_start": 1723, "chars": "ve " }, { "char_end": 1730, "char_start": 1729, "chars": "h" }, { "char_end": 1733, "char_start": 1731, "chars": "by" }, { "char_end": 1739, "char_start": 1734, "chars": "the\n " }, { "char_end": 1742, "char_start": 1740, "chars": "//" }, { "char_end": 1747, "char_start": 1743, "chars": "time" }, { "char_end": 1750, "char_start": 1748, "chars": "we" }, { "char_end": 1754, "char_start": 1751, "chars": "get" }, { "char_end": 1757, "char_start": 1755, "chars": "he" }, { "char_end": 1763, "char_start": 1759, "chars": ".\n " }, { "char_end": 1770, "char_start": 1764, "chars": "o.appe" }, { "char_end": 1779, "char_start": 1771, "chars": "d(clean_" }, { "char_end": 1781, "char_start": 1780, "chars": "i" }, { "char_end": 1784, "char_start": 1783, "chars": ")" } ], "deleted": [ { "char_end": 133, "char_start": 132, "chars": "u" }, { "char_end": 141, "char_start": 140, "chars": "=" }, { "char_end": 154, "char_start": 152, "chars": "('" }, { "char_end": 219, "char_start": 218, "chars": "." }, { "char_end": 222, "char_start": 221, "chars": "b" }, { "char_end": 225, "char_start": 224, "chars": "r" }, { "char_end": 228, "char_start": 226, "chars": "0," }, { "char_end": 338, "char_start": 337, "chars": "i" }, { "char_end": 342, "char_start": 340, "chars": "(s" }, { "char_end": 344, "char_start": 343, "chars": "p" }, { "char_end": 347, "char_start": 345, "chars": "==" }, { "char_end": 354, "char_start": 352, "chars": ".l" }, { "char_end": 357, "char_start": 356, "chars": "g" }, { "char_end": 359, "char_start": 358, "chars": "h" }, { "char_end": 363, "char_start": 362, "chars": "-" }, { "char_end": 366, "char_start": 364, "chars": "1)" }, { "char_end": 368, "char_start": 367, "chars": "{" }, { "char_end": 399, "char_start": 396, "chars": "}\n\n" }, { "char_end": 407, "char_start": 402, "chars": "o.app" }, { "char_end": 411, "char_start": 408, "chars": "nd(" }, { "char_end": 418, "char_start": 415, "chars": ");\n" }, { "char_end": 421, "char_start": 420, "chars": "s" }, { "char_end": 423, "char_start": 422, "chars": "r" }, { "char_end": 426, "char_start": 424, "chars": "ct" }, { "char_end": 428, "char_start": 427, "chars": "z" }, { "char_end": 431, "char_start": 429, "chars": "p_" }, { "char_end": 433, "char_start": 432, "chars": "t" }, { "char_end": 440, "char_start": 436, "chars": "zipS" }, { "char_end": 444, "char_start": 443, "chars": ";" }, { "char_end": 449, "char_start": 447, "chars": "if" }, { "char_end": 455, "char_start": 450, "chars": "(zip_" }, { "char_end": 464, "char_start": 459, "chars": "(zip," }, { "char_end": 473, "char_start": 469, "chars": ".c_s" }, { "char_end": 478, "char_start": 474, "chars": "r()," }, { "char_end": 481, "char_start": 479, "chars": "0," }, { "char_end": 484, "char_start": 482, "chars": "&z" }, { "char_end": 488, "char_start": 486, "chars": "St" }, { "char_end": 491, "char_start": 490, "chars": ")" }, { "char_end": 494, "char_start": 492, "chars": "!=" }, { "char_end": 499, "char_start": 495, "chars": "0) {" }, { "char_end": 509, "char_start": 507, "chars": "ur" }, { "char_end": 512, "char_start": 510, "chars": " f" }, { "char_end": 515, "char_start": 514, "chars": "s" }, { "char_end": 521, "char_start": 517, "chars": "\n }" } ] }, "commit_link": "github.com/facebook/hhvm/commit/65c95a01541dd2fbc9c978ac53bed235b5376686", "file_name": "hphp/runtime/ext/zip/ext_zip.cpp", "func_name": "HPHP::extractFileTo", "line_changes": { "added": [ { "char_end": 130, "char_start": 129, "line": "\n", "line_no": 3 }, { "char_end": 157, "char_start": 130, "line": " struct zip_stat zipStat;\n", "line_no": 4 }, { "char_end": 277, "char_start": 222, "line": " if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n", "line_no": 6 }, { "char_end": 295, "char_start": 277, "line": " return false;\n", "line_no": 7 }, { "char_end": 299, "char_start": 295, "line": " }\n", "line_no": 8 }, { "char_end": 300, "char_start": 299, "line": "\n", "line_no": 9 }, { "char_end": 326, "char_start": 300, "line": " auto clean_file = file;\n", "line_no": 10 }, { "char_end": 358, "char_start": 326, "line": " auto sep = std::string::npos;\n", "line_no": 11 }, { "char_end": 607, "char_start": 576, "line": " int idx = file.length() - 1;\n", "line_no": 15 }, { "char_end": 628, "char_start": 607, "line": " while (idx >= 0) {\n", "line_no": 16 }, { "char_end": 675, "char_start": 628, "line": " if (FileUtil::isDirSeparator(file[idx])) {\n", "line_no": 17 }, { "char_end": 692, "char_start": 675, "line": " sep = idx;\n", "line_no": 18 }, { "char_end": 705, "char_start": 692, "line": " break;\n", "line_no": 19 }, { "char_end": 711, "char_start": 705, "line": " }\n", "line_no": 20 }, { "char_end": 722, "char_start": 711, "line": " idx--;\n", "line_no": 21 }, { "char_end": 726, "char_start": 722, "line": " }\n", "line_no": 22 }, { "char_end": 922, "char_start": 879, "line": " clean_file = make_relative_path(file);\n", "line_no": 26 }, { "char_end": 962, "char_start": 922, "line": " std::string path = to + clean_file;\n", "line_no": 27 }, { "char_end": 991, "char_start": 962, "line": " bool is_dir_only = true;\n", "line_no": 28 }, { "char_end": 1050, "char_start": 991, "line": " if (sep < file.length() - 1) { // not just a directory\n", "line_no": 29 }, { "char_end": 1108, "char_start": 1050, "line": " auto clean_file_dir = HHVM_FN(dirname)(clean_file);\n", "line_no": 30 }, { "char_end": 1156, "char_start": 1108, "line": " path = to + clean_file_dir.toCppString();\n", "line_no": 31 }, { "char_end": 1183, "char_start": 1156, "line": " is_dir_only = false;\n", "line_no": 32 }, { "char_end": 1189, "char_start": 1183, "line": " }\n", "line_no": 33 }, { "char_end": 1190, "char_start": 1189, "line": "\n", "line_no": 34 }, { "char_end": 1565, "char_start": 1513, "line": " if (is_dir_only) { // directory, like /usr/bin/\n", "line_no": 42 }, { "char_end": 1786, "char_start": 1761, "line": " to.append(clean_file);\n", "line_no": 50 } ], "deleted": [ { "char_end": 159, "char_start": 129, "line": " auto sep = file.rfind('/');\n", "line_no": 3 }, { "char_end": 235, "char_start": 193, "line": " auto path = to + file.substr(0, sep);\n", "line_no": 5 }, { "char_end": 369, "char_start": 333, "line": " if (sep == file.length() - 1) {\n", "line_no": 10 }, { "char_end": 418, "char_start": 399, "line": " to.append(file);\n", "line_no": 15 }, { "char_end": 445, "char_start": 418, "line": " struct zip_stat zipStat;\n", "line_no": 16 }, { "char_end": 500, "char_start": 445, "line": " if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n", "line_no": 17 }, { "char_end": 518, "char_start": 500, "line": " return false;\n", "line_no": 18 }, { "char_end": 522, "char_start": 518, "line": " }\n", "line_no": 19 } ] }, "vul_type": "cwe-022" }
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 }", "...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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" }, { "char_end": 401, "char_start": 339, "chars": "std::string::npos;\n // Normally would just use std::string::r" }, { "char_end": 492, "char_start": 403, "chars": "nd here, but if we want to be\n // consistent between Windows and Linux, even if techinca" }, { "char_end": 510, "char_start": 493, "chars": "ly Linux won't us" }, { "char_end": 541, "char_start": 511, "chars": "\n // backslash for a separato" }, { "char_end": 560, "char_start": 542, "chars": ", we are checking " }, { "char_end": 578, "char_start": 561, "chars": "or both types.\n " }, { "char_end": 583, "char_start": 580, "chars": "t i" }, { "char_end": 599, "char_start": 584, "chars": "x = file.length" }, { "char_end": 605, "char_start": 601, "chars": " - 1" }, { "char_end": 728, "char_start": 609, "chars": "while (idx >= 0) {\n if (FileUtil::isDirSeparator(file[idx])) {\n sep = idx;\n break;\n }\n idx--;\n }\n " }, { "char_end": 768, "char_start": 764, "chars": "// m" }, { "char_end": 807, "char_start": 769, "chars": "ke_relative_path so we do not try to p" }, { "char_end": 816, "char_start": 809, "chars": " files " }, { "char_end": 937, "char_start": 817, "chars": "r dirs in bad\n // places. This securely \"cleans\" the file.\n clean_file = make_relative_path(file);\n std::string" }, { "char_end": 956, "char_start": 950, "chars": "clean_" }, { "char_end": 972, "char_start": 960, "chars": ";\n bool i" }, { "char_end": 987, "char_start": 973, "chars": "_dir_only = tr" }, { "char_end": 999, "char_start": 988, "chars": "e;\n if (" }, { "char_end": 1014, "char_start": 1000, "chars": "ep < file.leng" }, { "char_end": 1042, "char_start": 1015, "chars": "h() - 1) { // not just a di" }, { "char_end": 1085, "char_start": 1043, "chars": "ectory\n auto clean_file_dir = HHVM_FN" }, { "char_end": 1125, "char_start": 1086, "chars": "dirname)(clean_file);\n path = to +" }, { "char_end": 1128, "char_start": 1126, "chars": "cl" }, { "char_end": 1144, "char_start": 1129, "chars": "an_file_dir.toC" }, { "char_end": 1153, "char_start": 1145, "chars": "pString(" }, { "char_end": 1265, "char_start": 1156, "chars": " is_dir_only = false;\n }\n\n // Make sure the directory path to extract to exists or can be created\n" }, { "char_end": 1389, "char_start": 1367, "chars": "// If we have a good d" }, { "char_end": 1431, "char_start": 1390, "chars": "rectory to extract to above, we now check" }, { "char_end": 1437, "char_start": 1432, "chars": "wheth" }, { "char_end": 1442, "char_start": 1438, "chars": "r\n " }, { "char_end": 1452, "char_start": 1444, "chars": "// the \"" }, { "char_end": 1463, "char_start": 1456, "chars": "\" param" }, { "char_end": 1476, "char_start": 1464, "chars": "ter passed i" }, { "char_end": 1488, "char_start": 1477, "chars": " is a direc" }, { "char_end": 1492, "char_start": 1489, "chars": "ory" }, { "char_end": 1495, "char_start": 1493, "chars": "or" }, { "char_end": 1532, "char_start": 1496, "chars": "actually a file.\n if (is_dir_only" }, { "char_end": 1564, "char_start": 1535, "chars": " // directory, like /usr/bin/" }, { "char_end": 1598, "char_start": 1594, "chars": "// o" }, { "char_end": 1605, "char_start": 1599, "chars": "herwis" }, { "char_end": 1607, "char_start": 1606, "chars": " " }, { "char_end": 1614, "char_start": 1612, "chars": "is" }, { "char_end": 1617, "char_start": 1615, "chars": "ac" }, { "char_end": 1623, "char_start": 1619, "chars": "ally" }, { "char_end": 1627, "char_start": 1624, "chars": "a f" }, { "char_end": 1632, "char_start": 1628, "chars": "le, " }, { "char_end": 1640, "char_start": 1633, "chars": "o we ac" }, { "char_end": 1642, "char_start": 1641, "chars": "u" }, { "char_end": 1646, "char_start": 1643, "chars": "lly" }, { "char_end": 1649, "char_start": 1647, "chars": "ex" }, { "char_end": 1651, "char_start": 1650, "chars": "r" }, { "char_end": 1653, "char_start": 1652, "chars": "c" }, { "char_end": 1655, "char_start": 1654, "chars": "." }, { "char_end": 1661, "char_start": 1658, "chars": "}\n\n" }, { "char_end": 1676, "char_start": 1662, "chars": " // We have en" }, { "char_end": 1682, "char_start": 1677, "chars": "ured " }, { "char_end": 1684, "char_start": 1683, "chars": "h" }, { "char_end": 1693, "char_start": 1687, "chars": "clean_" }, { "char_end": 1712, "char_start": 1697, "chars": " will be added " }, { "char_end": 1714, "char_start": 1713, "chars": "o" }, { "char_end": 1716, "char_start": 1715, "chars": "a" }, { "char_end": 1722, "char_start": 1717, "chars": "relat" }, { "char_end": 1726, "char_start": 1723, "chars": "ve " }, { "char_end": 1730, "char_start": 1729, "chars": "h" }, { "char_end": 1733, "char_start": 1731, "chars": "by" }, { "char_end": 1739, "char_start": 1734, "chars": "the\n " }, { "char_end": 1742, "char_start": 1740, "chars": "//" }, { "char_end": 1747, "char_start": 1743, "chars": "time" }, { "char_end": 1750, "char_start": 1748, "chars": "we" }, { "char_end": 1754, "char_start": 1751, "chars": "get" }, { "char_end": 1757, "char_start": 1755, "chars": "he" }, { "char_end": 1763, "char_start": 1759, "chars": ".\n " }, { "char_end": 1770, "char_start": 1764, "chars": "o.appe" }, { "char_end": 1779, "char_start": 1771, "chars": "d(clean_" }, { "char_end": 1781, "char_start": 1780, "chars": "i" }, { "char_end": 1784, "char_start": 1783, "chars": ")" } ], "deleted": [ { "char_end": 133, "char_start": 132, "chars": "u" }, { "char_end": 141, "char_start": 140, "chars": "=" }, { "char_end": 154, "char_start": 152, "chars": "('" }, { "char_end": 219, "char_start": 218, "chars": "." }, { "char_end": 222, "char_start": 221, "chars": "b" }, { "char_end": 225, "char_start": 224, "chars": "r" }, { "char_end": 228, "char_start": 226, "chars": "0," }, { "char_end": 338, "char_start": 337, "chars": "i" }, { "char_end": 342, "char_start": 340, "chars": "(s" }, { "char_end": 344, "char_start": 343, "chars": "p" }, { "char_end": 347, "char_start": 345, "chars": "==" }, { "char_end": 354, "char_start": 352, "chars": ".l" }, { "char_end": 357, "char_start": 356, "chars": "g" }, { "char_end": 359, "char_start": 358, "chars": "h" }, { "char_end": 363, "char_start": 362, "chars": "-" }, { "char_end": 366, "char_start": 364, "chars": "1)" }, { "char_end": 368, "char_start": 367, "chars": "{" }, { "char_end": 399, "char_start": 396, "chars": "}\n\n" }, { "char_end": 407, "char_start": 402, "chars": "o.app" }, { "char_end": 411, "char_start": 408, "chars": "nd(" }, { "char_end": 418, "char_start": 415, "chars": ");\n" }, { "char_end": 421, "char_start": 420, "chars": "s" }, { "char_end": 423, "char_start": 422, "chars": "r" }, { "char_end": 426, "char_start": 424, "chars": "ct" }, { "char_end": 428, "char_start": 427, "chars": "z" }, { "char_end": 431, "char_start": 429, "chars": "p_" }, { "char_end": 433, "char_start": 432, "chars": "t" }, { "char_end": 440, "char_start": 436, "chars": "zipS" }, { "char_end": 444, "char_start": 443, "chars": ";" }, { "char_end": 449, "char_start": 447, "chars": "if" }, { "char_end": 455, "char_start": 450, "chars": "(zip_" }, { "char_end": 464, "char_start": 459, "chars": "(zip," }, { "char_end": 473, "char_start": 469, "chars": ".c_s" }, { "char_end": 478, "char_start": 474, "chars": "r()," }, { "char_end": 481, "char_start": 479, "chars": "0," }, { "char_end": 484, "char_start": 482, "chars": "&z" }, { "char_end": 488, "char_start": 486, "chars": "St" }, { "char_end": 491, "char_start": 490, "chars": ")" }, { "char_end": 494, "char_start": 492, "chars": "!=" }, { "char_end": 499, "char_start": 495, "chars": "0) {" }, { "char_end": 509, "char_start": 507, "chars": "ur" }, { "char_end": 512, "char_start": 510, "chars": " f" }, { "char_end": 515, "char_start": 514, "chars": "s" }, { "char_end": 521, "char_start": 517, "chars": "\n }" } ] }, "commit_link": "github.com/facebook/hhvm/commit/65c95a01541dd2fbc9c978ac53bed235b5376686", "file_name": "hphp/runtime/ext/zip/ext_zip.cpp", "func_name": "HPHP::extractFileTo", "line_changes": { "added": [ { "char_end": 130, "char_start": 129, "line": "\n", "line_no": 3 }, { "char_end": 157, "char_start": 130, "line": " struct zip_stat zipStat;\n", "line_no": 4 }, { "char_end": 277, "char_start": 222, "line": " if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n", "line_no": 6 }, { "char_end": 295, "char_start": 277, "line": " return false;\n", "line_no": 7 }, { "char_end": 299, "char_start": 295, "line": " }\n", "line_no": 8 }, { "char_end": 300, "char_start": 299, "line": "\n", "line_no": 9 }, { "char_end": 326, "char_start": 300, "line": " auto clean_file = file;\n", "line_no": 10 }, { "char_end": 358, "char_start": 326, "line": " auto sep = std::string::npos;\n", "line_no": 11 }, { "char_end": 607, "char_start": 576, "line": " int idx = file.length() - 1;\n", "line_no": 15 }, { "char_end": 628, "char_start": 607, "line": " while (idx >= 0) {\n", "line_no": 16 }, { "char_end": 675, "char_start": 628, "line": " if (FileUtil::isDirSeparator(file[idx])) {\n", "line_no": 17 }, { "char_end": 692, "char_start": 675, "line": " sep = idx;\n", "line_no": 18 }, { "char_end": 705, "char_start": 692, "line": " break;\n", "line_no": 19 }, { "char_end": 711, "char_start": 705, "line": " }\n", "line_no": 20 }, { "char_end": 722, "char_start": 711, "line": " idx--;\n", "line_no": 21 }, { "char_end": 726, "char_start": 722, "line": " }\n", "line_no": 22 }, { "char_end": 922, "char_start": 879, "line": " clean_file = make_relative_path(file);\n", "line_no": 26 }, { "char_end": 962, "char_start": 922, "line": " std::string path = to + clean_file;\n", "line_no": 27 }, { "char_end": 991, "char_start": 962, "line": " bool is_dir_only = true;\n", "line_no": 28 }, { "char_end": 1050, "char_start": 991, "line": " if (sep < file.length() - 1) { // not just a directory\n", "line_no": 29 }, { "char_end": 1108, "char_start": 1050, "line": " auto clean_file_dir = HHVM_FN(dirname)(clean_file);\n", "line_no": 30 }, { "char_end": 1156, "char_start": 1108, "line": " path = to + clean_file_dir.toCppString();\n", "line_no": 31 }, { "char_end": 1183, "char_start": 1156, "line": " is_dir_only = false;\n", "line_no": 32 }, { "char_end": 1189, "char_start": 1183, "line": " }\n", "line_no": 33 }, { "char_end": 1190, "char_start": 1189, "line": "\n", "line_no": 34 }, { "char_end": 1565, "char_start": 1513, "line": " if (is_dir_only) { // directory, like /usr/bin/\n", "line_no": 42 }, { "char_end": 1786, "char_start": 1761, "line": " to.append(clean_file);\n", "line_no": 50 } ], "deleted": [ { "char_end": 159, "char_start": 129, "line": " auto sep = file.rfind('/');\n", "line_no": 3 }, { "char_end": 235, "char_start": 193, "line": " auto path = to + file.substr(0, sep);\n", "line_no": 5 }, { "char_end": 369, "char_start": 333, "line": " if (sep == file.length() - 1) {\n", "line_no": 10 }, { "char_end": 418, "char_start": 399, "line": " to.append(file);\n", "line_no": 15 }, { "char_end": 445, "char_start": 418, "line": " struct zip_stat zipStat;\n", "line_no": 16 }, { "char_end": 500, "char_start": 445, "line": " if (zip_stat(zip, file.c_str(), 0, &zipStat) != 0) {\n", "line_no": 17 }, { "char_end": 518, "char_start": 500, "line": " return false;\n", "line_no": 18 }, { "char_end": 522, "char_start": 518, "line": " }\n", "line_no": 19 } ] }, "vul_type": "cwe-022" }
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 alread...
[ 1, 1, 0, 1, 0, 1, 1, 0, 1, 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, "char_start": 230, "chars": " if goal_name.isalnum():\n goal_name_not_ok = False\n else:\n click.echo(chalk.red('Only alphanumeric characters can be used! Please input the goal name:'))\n" }, { "char_end": 864, "char_start": 786, "chars": " incorrect_date_format = True\n while incorrect_date_format:\n " }, { "char_end": 1267, "char_start": 897, "chars": ")\n try:\n date_str = datetime.datetime.strptime(deadline, '%Y-%m-%d').strftime('%Y-%m-%d')\n if date_str != deadline:\n raise ValueError\n incorrect_date_format = False\n except ValueError:\n click.echo(chalk.red(\"Incorrect data format, should be YYYY-MM-DD. Please repeat:\")" } ], "deleted": [] }, "commit_link": "github.com/yoda-pa/yoda/commit/263946316041601de75638ee303a892f2652cf40", "file_name": "modules/goals.py", "func_name": "new_goal", "line_changes": { "added": [ { "char_end": 97, "char_start": 69, "line": " goal_name_not_ok = True\n", "line_no": 8 }, { "char_end": 98, "char_start": 97, "line": "\n", "line_no": 9 }, { "char_end": 194, "char_start": 166, "line": " while goal_name_not_ok:\n", "line_no": 11 }, { "char_end": 230, "char_start": 194, "line": " goal_name = input().strip()\n", "line_no": 12 }, { "char_end": 262, "char_start": 230, "line": " if goal_name.isalnum():\n", "line_no": 13 }, { "char_end": 299, "char_start": 262, "line": " goal_name_not_ok = False\n", "line_no": 14 }, { "char_end": 313, "char_start": 299, "line": " else:\n", "line_no": 15 }, { "char_end": 420, "char_start": 313, "line": " click.echo(chalk.red('Only alphanumeric characters can be used! Please input the goal name:'))\n", "line_no": 16 }, { "char_end": 823, "char_start": 786, "line": " incorrect_date_format = True\n", "line_no": 26 }, { "char_end": 860, "char_start": 823, "line": " while incorrect_date_format:\n", "line_no": 27 }, { "char_end": 899, "char_start": 860, "line": " deadline = input().strip()\n", "line_no": 28 }, { "char_end": 916, "char_start": 899, "line": " try:\n", "line_no": 29 }, { "char_end": 1013, "char_start": 916, "line": " date_str = datetime.datetime.strptime(deadline, '%Y-%m-%d').strftime('%Y-%m-%d')\n", "line_no": 30 }, { "char_end": 1054, "char_start": 1013, "line": " if date_str != deadline:\n", "line_no": 31 }, { "char_end": 1091, "char_start": 1054, "line": " raise ValueError\n", "line_no": 32 }, { "char_end": 1137, "char_start": 1091, "line": " incorrect_date_format = False\n", "line_no": 33 }, { "char_end": 1168, "char_start": 1137, "line": " except ValueError:\n", "line_no": 34 }, { "char_end": 1269, "char_start": 1168, "line": " click.echo(chalk.red(\"Incorrect data format, should be YYYY-MM-DD. Please repeat:\"))\n", "line_no": 35 } ], "deleted": [ { "char_end": 169, "char_start": 137, "line": " goal_name = input().strip()\n", "line_no": 9 }, { "char_end": 570, "char_start": 535, "line": " deadline = input().strip()\n", "line_no": 19 } ] }, "vul_type": "cwe-022" }
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_nam...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, "char_start": 230, "chars": " if goal_name.isalnum():\n goal_name_not_ok = False\n else:\n click.echo(chalk.red('Only alphanumeric characters can be used! Please input the goal name:'))\n" }, { "char_end": 864, "char_start": 786, "chars": " incorrect_date_format = True\n while incorrect_date_format:\n " }, { "char_end": 1267, "char_start": 897, "chars": ")\n try:\n date_str = datetime.datetime.strptime(deadline, '%Y-%m-%d').strftime('%Y-%m-%d')\n if date_str != deadline:\n raise ValueError\n incorrect_date_format = False\n except ValueError:\n click.echo(chalk.red(\"Incorrect data format, should be YYYY-MM-DD. Please repeat:\")" } ], "deleted": [] }, "commit_link": "github.com/yoda-pa/yoda/commit/263946316041601de75638ee303a892f2652cf40", "file_name": "modules/goals.py", "func_name": "new_goal", "line_changes": { "added": [ { "char_end": 97, "char_start": 69, "line": " goal_name_not_ok = True\n", "line_no": 8 }, { "char_end": 98, "char_start": 97, "line": "\n", "line_no": 9 }, { "char_end": 194, "char_start": 166, "line": " while goal_name_not_ok:\n", "line_no": 11 }, { "char_end": 230, "char_start": 194, "line": " goal_name = input().strip()\n", "line_no": 12 }, { "char_end": 262, "char_start": 230, "line": " if goal_name.isalnum():\n", "line_no": 13 }, { "char_end": 299, "char_start": 262, "line": " goal_name_not_ok = False\n", "line_no": 14 }, { "char_end": 313, "char_start": 299, "line": " else:\n", "line_no": 15 }, { "char_end": 420, "char_start": 313, "line": " click.echo(chalk.red('Only alphanumeric characters can be used! Please input the goal name:'))\n", "line_no": 16 }, { "char_end": 823, "char_start": 786, "line": " incorrect_date_format = True\n", "line_no": 26 }, { "char_end": 860, "char_start": 823, "line": " while incorrect_date_format:\n", "line_no": 27 }, { "char_end": 899, "char_start": 860, "line": " deadline = input().strip()\n", "line_no": 28 }, { "char_end": 916, "char_start": 899, "line": " try:\n", "line_no": 29 }, { "char_end": 1013, "char_start": 916, "line": " date_str = datetime.datetime.strptime(deadline, '%Y-%m-%d').strftime('%Y-%m-%d')\n", "line_no": 30 }, { "char_end": 1054, "char_start": 1013, "line": " if date_str != deadline:\n", "line_no": 31 }, { "char_end": 1091, "char_start": 1054, "line": " raise ValueError\n", "line_no": 32 }, { "char_end": 1137, "char_start": 1091, "line": " incorrect_date_format = False\n", "line_no": 33 }, { "char_end": 1168, "char_start": 1137, "line": " except ValueError:\n", "line_no": 34 }, { "char_end": 1269, "char_start": 1168, "line": " click.echo(chalk.red(\"Incorrect data format, should be YYYY-MM-DD. Please repeat:\"))\n", "line_no": 35 } ], "deleted": [ { "char_end": 169, "char_start": 137, "line": " goal_name = input().strip()\n", "line_no": 9 }, { "char_end": 570, "char_start": 535, "line": " deadline = input().strip()\n", "line_no": 19 } ] }, "vul_type": "cwe-022" }
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 a...
[ 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 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" }, { "char_end": 725, "char_start": 721, "chars": "k_pa" }, { "char_end": 737, "char_start": 726, "chars": "h_within_fs" }, { "char_end": 742, "char_start": 738, "chars": "fs, " }, { "char_end": 745, "char_start": 743, "chars": "et" }, { "char_end": 752, "char_start": 749, "chars": "'pa" }, { "char_end": 770, "char_start": 753, "chars": "swd')\n shadow_" }, { "char_end": 778, "char_start": 774, "chars": " = _" }, { "char_end": 807, "char_start": 782, "chars": "_and_check_path_within_fs" }, { "char_end": 854, "char_start": 820, "chars": "shadow')\n\n utils.execute('cp', " }, { "char_end": 865, "char_start": 860, "chars": "_path" }, { "char_end": 932, "char_start": 927, "chars": "_path" }, { "char_end": 1077, "char_start": 1072, "chars": "_path" }, { "char_end": 1170, "char_start": 1165, "chars": "_path" } ], "deleted": [ { "char_end": 694, "char_start": 693, "chars": "u" }, { "char_end": 701, "char_start": 696, "chars": "ls.ex" }, { "char_end": 704, "char_start": 703, "chars": "u" }, { "char_end": 706, "char_start": 705, "chars": "e" }, { "char_end": 712, "char_start": 711, "chars": "," }, { "char_end": 716, "char_start": 714, "chars": "s." }, { "char_end": 721, "char_start": 720, "chars": "." }, { "char_end": 746, "char_start": 744, "chars": "')" }, { "char_end": 777, "char_start": 759, "chars": "\n " }, { "char_end": 845, "char_start": 820, "chars": "os.path.join(fs, 'etc', '" }, { "char_end": 853, "char_start": 851, "chars": "')" }, { "char_end": 884, "char_start": 866, "chars": "\n " }, { "char_end": 1030, "char_start": 1005, "chars": "os.path.join(fs, 'etc', '" }, { "char_end": 1038, "char_start": 1036, "chars": "')" }, { "char_end": 1057, "char_start": 1039, "chars": "\n " }, { "char_end": 1163, "char_start": 1138, "chars": "os.path.join(fs, 'etc', '" }, { "char_end": 1171, "char_start": 1169, "chars": "')" }, { "char_end": 1190, "char_start": 1172, "chars": "\n " } ] }, "commit_link": "github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7", "file_name": "nova/virt/disk/api.py", "func_name": "_inject_admin_password_into_fs", "line_changes": { "added": [ { "char_end": 759, "char_start": 689, "line": " passwd_path = _join_and_check_path_within_fs(fs, 'etc', 'passwd')\n", "line_no": 23 }, { "char_end": 829, "char_start": 759, "line": " shadow_path = _join_and_check_path_within_fs(fs, 'etc', 'shadow')\n", "line_no": 24 }, { "char_end": 830, "char_start": 829, "line": "\n", "line_no": 25 }, { "char_end": 897, "char_start": 830, "line": " utils.execute('cp', passwd_path, tmp_passwd, run_as_root=True)\n", "line_no": 26 }, { "char_end": 964, "char_start": 897, "line": " utils.execute('cp', shadow_path, tmp_shadow, run_as_root=True)\n", "line_no": 27 }, { "char_end": 1097, "char_start": 1030, "line": " utils.execute('cp', tmp_passwd, passwd_path, run_as_root=True)\n", "line_no": 29 }, { "char_end": 1190, "char_start": 1123, "line": " utils.execute('cp', tmp_shadow, shadow_path, run_as_root=True)\n", "line_no": 31 } ], "deleted": [ { "char_end": 760, "char_start": 689, "line": " utils.execute('cp', os.path.join(fs, 'etc', 'passwd'), tmp_passwd,\n", "line_no": 23 }, { "char_end": 796, "char_start": 760, "line": " run_as_root=True)\n", "line_no": 24 }, { "char_end": 867, "char_start": 796, "line": " utils.execute('cp', os.path.join(fs, 'etc', 'shadow'), tmp_shadow,\n", "line_no": 25 }, { "char_end": 903, "char_start": 867, "line": " run_as_root=True)\n", "line_no": 26 }, { "char_end": 1040, "char_start": 969, "line": " utils.execute('cp', tmp_passwd, os.path.join(fs, 'etc', 'passwd'),\n", "line_no": 28 }, { "char_end": 1076, "char_start": 1040, "line": " run_as_root=True)\n", "line_no": 29 }, { "char_end": 1173, "char_start": 1102, "line": " utils.execute('cp', tmp_shadow, os.path.join(fs, 'etc', 'shadow'),\n", "line_no": 31 }, { "char_end": 1209, "char_start": 1173, "line": " run_as_root=True)\n", "line_no": 32 } ] }, "vul_type": "cwe-022" }
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 a...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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" }, { "char_end": 725, "char_start": 721, "chars": "k_pa" }, { "char_end": 737, "char_start": 726, "chars": "h_within_fs" }, { "char_end": 742, "char_start": 738, "chars": "fs, " }, { "char_end": 745, "char_start": 743, "chars": "et" }, { "char_end": 752, "char_start": 749, "chars": "'pa" }, { "char_end": 770, "char_start": 753, "chars": "swd')\n shadow_" }, { "char_end": 778, "char_start": 774, "chars": " = _" }, { "char_end": 807, "char_start": 782, "chars": "_and_check_path_within_fs" }, { "char_end": 854, "char_start": 820, "chars": "shadow')\n\n utils.execute('cp', " }, { "char_end": 865, "char_start": 860, "chars": "_path" }, { "char_end": 932, "char_start": 927, "chars": "_path" }, { "char_end": 1077, "char_start": 1072, "chars": "_path" }, { "char_end": 1170, "char_start": 1165, "chars": "_path" } ], "deleted": [ { "char_end": 694, "char_start": 693, "chars": "u" }, { "char_end": 701, "char_start": 696, "chars": "ls.ex" }, { "char_end": 704, "char_start": 703, "chars": "u" }, { "char_end": 706, "char_start": 705, "chars": "e" }, { "char_end": 712, "char_start": 711, "chars": "," }, { "char_end": 716, "char_start": 714, "chars": "s." }, { "char_end": 721, "char_start": 720, "chars": "." }, { "char_end": 746, "char_start": 744, "chars": "')" }, { "char_end": 777, "char_start": 759, "chars": "\n " }, { "char_end": 845, "char_start": 820, "chars": "os.path.join(fs, 'etc', '" }, { "char_end": 853, "char_start": 851, "chars": "')" }, { "char_end": 884, "char_start": 866, "chars": "\n " }, { "char_end": 1030, "char_start": 1005, "chars": "os.path.join(fs, 'etc', '" }, { "char_end": 1038, "char_start": 1036, "chars": "')" }, { "char_end": 1057, "char_start": 1039, "chars": "\n " }, { "char_end": 1163, "char_start": 1138, "chars": "os.path.join(fs, 'etc', '" }, { "char_end": 1171, "char_start": 1169, "chars": "')" }, { "char_end": 1190, "char_start": 1172, "chars": "\n " } ] }, "commit_link": "github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7", "file_name": "nova/virt/disk/api.py", "func_name": "_inject_admin_password_into_fs", "line_changes": { "added": [ { "char_end": 759, "char_start": 689, "line": " passwd_path = _join_and_check_path_within_fs(fs, 'etc', 'passwd')\n", "line_no": 23 }, { "char_end": 829, "char_start": 759, "line": " shadow_path = _join_and_check_path_within_fs(fs, 'etc', 'shadow')\n", "line_no": 24 }, { "char_end": 830, "char_start": 829, "line": "\n", "line_no": 25 }, { "char_end": 897, "char_start": 830, "line": " utils.execute('cp', passwd_path, tmp_passwd, run_as_root=True)\n", "line_no": 26 }, { "char_end": 964, "char_start": 897, "line": " utils.execute('cp', shadow_path, tmp_shadow, run_as_root=True)\n", "line_no": 27 }, { "char_end": 1097, "char_start": 1030, "line": " utils.execute('cp', tmp_passwd, passwd_path, run_as_root=True)\n", "line_no": 29 }, { "char_end": 1190, "char_start": 1123, "line": " utils.execute('cp', tmp_shadow, shadow_path, run_as_root=True)\n", "line_no": 31 } ], "deleted": [ { "char_end": 760, "char_start": 689, "line": " utils.execute('cp', os.path.join(fs, 'etc', 'passwd'), tmp_passwd,\n", "line_no": 23 }, { "char_end": 796, "char_start": 760, "line": " run_as_root=True)\n", "line_no": 24 }, { "char_end": 867, "char_start": 796, "line": " utils.execute('cp', os.path.join(fs, 'etc', 'shadow'), tmp_shadow,\n", "line_no": 25 }, { "char_end": 903, "char_start": 867, "line": " run_as_root=True)\n", "line_no": 26 }, { "char_end": 1040, "char_start": 969, "line": " utils.execute('cp', tmp_passwd, os.path.join(fs, 'etc', 'passwd'),\n", "line_no": 28 }, { "char_end": 1076, "char_start": 1040, "line": " run_as_root=True)\n", "line_no": 29 }, { "char_end": 1173, "char_start": 1102, "line": " utils.execute('cp', tmp_shadow, os.path.join(fs, 'etc', 'shadow'),\n", "line_no": 31 }, { "char_end": 1209, "char_start": 1173, "line": " run_as_root=True)\n", "line_no": 32 } ] }, "vul_type": "cwe-022" }
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, 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: " }, { "char_end": 64, "char_start": 36, "chars": "tr) \\\n -> typing.Tupl" }, { "char_end": 66, "char_start": 65, "chars": "[" }, { "char_end": 79, "char_start": 70, "chars": "lib.Path," }, { "char_end": 93, "char_start": 92, "chars": "]" }, { "char_end": 147, "char_start": 99, "chars": "base_path = flask.safe_join(root, sub_path)\n " } ], "deleted": [ { "char_end": 19, "char_start": 18, "chars": "_" }, { "char_end": 24, "char_start": 23, "chars": ":" }, { "char_end": 39, "char_start": 38, "chars": ":" }, { "char_end": 73, "char_start": 69, "chars": "str(" }, { "char_end": 83, "char_start": 82, "chars": ")" }, { "char_end": 132, "char_start": 128, "chars": "str(" }, { "char_end": 142, "char_start": 141, "chars": ")" } ] }, "commit_link": "github.com/horazont/xmpp-http-upload/commit/82056540191e89f0cd697c81f57714c00962ed75", "file_name": "xhu.py", "func_name": "get_paths", "line_changes": { "added": [ { "char_end": 42, "char_start": 0, "line": "def get_paths(root: str, sub_path: str) \\\n", "line_no": 1 }, { "char_end": 95, "char_start": 42, "line": " -> typing.Tuple[pathlib.Path, pathlib.Path]:\n", "line_no": 2 }, { "char_end": 143, "char_start": 95, "line": " base_path = flask.safe_join(root, sub_path)\n", "line_no": 3 }, { "char_end": 193, "char_start": 143, "line": " data_file = pathlib.Path(base_path + \".data\")\n", "line_no": 4 }, { "char_end": 247, "char_start": 193, "line": " metadata_file = pathlib.Path(base_path + \".meta\")\n", "line_no": 5 } ], "deleted": [ { "char_end": 40, "char_start": 0, "line": "def get_paths(base_path: pathlib.Path):\n", "line_no": 1 } ] }, "vul_type": "cwe-022" }
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, 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: " }, { "char_end": 64, "char_start": 36, "chars": "tr) \\\n -> typing.Tupl" }, { "char_end": 66, "char_start": 65, "chars": "[" }, { "char_end": 79, "char_start": 70, "chars": "lib.Path," }, { "char_end": 93, "char_start": 92, "chars": "]" }, { "char_end": 147, "char_start": 99, "chars": "base_path = flask.safe_join(root, sub_path)\n " } ], "deleted": [ { "char_end": 19, "char_start": 18, "chars": "_" }, { "char_end": 24, "char_start": 23, "chars": ":" }, { "char_end": 39, "char_start": 38, "chars": ":" }, { "char_end": 73, "char_start": 69, "chars": "str(" }, { "char_end": 83, "char_start": 82, "chars": ")" }, { "char_end": 132, "char_start": 128, "chars": "str(" }, { "char_end": 142, "char_start": 141, "chars": ")" } ] }, "commit_link": "github.com/horazont/xmpp-http-upload/commit/82056540191e89f0cd697c81f57714c00962ed75", "file_name": "xhu.py", "func_name": "get_paths", "line_changes": { "added": [ { "char_end": 42, "char_start": 0, "line": "def get_paths(root: str, sub_path: str) \\\n", "line_no": 1 }, { "char_end": 95, "char_start": 42, "line": " -> typing.Tuple[pathlib.Path, pathlib.Path]:\n", "line_no": 2 }, { "char_end": 143, "char_start": 95, "line": " base_path = flask.safe_join(root, sub_path)\n", "line_no": 3 }, { "char_end": 193, "char_start": 143, "line": " data_file = pathlib.Path(base_path + \".data\")\n", "line_no": 4 }, { "char_end": 247, "char_start": 193, "line": " metadata_file = pathlib.Path(base_path + \".meta\")\n", "line_no": 5 } ], "deleted": [ { "char_end": 40, "char_start": 0, "line": "def get_paths(base_path: pathlib.Path):\n", "line_no": 1 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 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/455b47d3756aed162d2d0ef7f40b549f3b5b30fe", "file_name": "src/common.c", "func_name": "compose_path", "line_changes": { "added": [ { "char_end": 1516, "char_start": 1460, "line": "\tif (!chrooted && strncmp(rpath, home, strlen(home))) {\n", "line_no": 63 } ], "deleted": [ { "char_end": 1514, "char_start": 1460, "line": "\tif (!chrooted && strncmp(dir, home, strlen(home))) {\n", "line_no": 63 } ] }, "vul_type": "cwe-022" }
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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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/455b47d3756aed162d2d0ef7f40b549f3b5b30fe", "file_name": "src/common.c", "func_name": "compose_path", "line_changes": { "added": [ { "char_end": 1516, "char_start": 1460, "line": "\tif (!chrooted && strncmp(rpath, home, strlen(home))) {\n", "line_no": 63 } ], "deleted": [ { "char_end": 1514, "char_start": 1460, "line": "\tif (!chrooted && strncmp(dir, home, strlen(home))) {\n", "line_no": 63 } ] }, "vul_type": "cwe-022" }
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" ]
[ 1, 0, 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_id(id_)" }, { "char_end": 213, "char_start": 208, "chars": " as e" } ] }, "commit_link": "github.com/saltstack/salt/commit/80d90307b07b3703428ecbb7c8bb468e28a9ae6d", "file_name": "salt/utils/verify.py", "func_name": "valid_id", "line_changes": { "added": [ { "char_end": 141, "char_start": 88, "line": " if any(x in id_ for x in ('/', '\\\\', '\\0')):\n", "line_no": 6 }, { "char_end": 166, "char_start": 141, "line": " return False\n", "line_no": 7 }, { "char_end": 220, "char_start": 166, "line": " return bool(clean_path(opts['pki_dir'], id_))\n", "line_no": 8 }, { "char_end": 270, "char_start": 220, "line": " except (AttributeError, KeyError, TypeError):\n", "line_no": 9 } ], "deleted": [ { "char_end": 160, "char_start": 88, "line": " return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)\n", "line_no": 6 }, { "char_end": 215, "char_start": 160, "line": " except (AttributeError, KeyError, TypeError) as e:\n", "line_no": 7 } ] }, "vul_type": "cwe-022" }
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, 1, 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_id(id_)" }, { "char_end": 213, "char_start": 208, "chars": " as e" } ] }, "commit_link": "github.com/saltstack/salt/commit/80d90307b07b3703428ecbb7c8bb468e28a9ae6d", "file_name": "salt/utils/verify.py", "func_name": "valid_id", "line_changes": { "added": [ { "char_end": 141, "char_start": 88, "line": " if any(x in id_ for x in ('/', '\\\\', '\\0')):\n", "line_no": 6 }, { "char_end": 166, "char_start": 141, "line": " return False\n", "line_no": 7 }, { "char_end": 220, "char_start": 166, "line": " return bool(clean_path(opts['pki_dir'], id_))\n", "line_no": 8 }, { "char_end": 270, "char_start": 220, "line": " except (AttributeError, KeyError, TypeError):\n", "line_no": 9 } ], "deleted": [ { "char_end": 160, "char_start": 88, "line": " return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_)\n", "line_no": 6 }, { "char_end": 215, "char_start": 160, "line": " except (AttributeError, KeyError, TypeError) as e:\n", "line_no": 7 } ] }, "vul_type": "cwe-022" }
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())" ]
[ 1, 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, "chars": "hs =" }, { "char_end": 93, "char_start": 87, "chars": "elf.ge" }, { "char_end": 101, "char_start": 94, "chars": "_base_p" }, { "char_end": 116, "char_start": 103, "chars": "hs()\n " }, { "char_end": 143, "char_start": 118, "chars": " hasattr(base_paths, 'spl" }, { "char_end": 181, "char_start": 144, "chars": "t'):\n # String, so go simp" }, { "char_end": 250, "char_start": 183, "chars": "\n base_path = base_paths\n else:\n base_" }, { "char_end": 256, "char_start": 254, "chars": " =" }, { "char_end": 277, "char_start": 266, "chars": "first_base(" }, { "char_end": 293, "char_start": 286, "chars": "s, path" }, { "char_end": 337, "char_start": 294, "chars": "\n return static_file(path, base_path" } ], "deleted": [ { "char_end": 37, "char_start": 36, "chars": "u" }, { "char_end": 49, "char_start": 44, "chars": "ic_fi" }, { "char_end": 52, "char_start": 51, "chars": "(" }, { "char_end": 57, "char_start": 56, "chars": "," }, { "char_end": 78, "char_start": 77, "chars": ")" } ] }, "commit_link": "github.com/foxbunny/seagull/commit/1fb790712fe0c1d1957b31e34a8e0e6593af87a7", "file_name": "seagull/routes/app.py", "func_name": "get", "line_changes": { "added": [ { "char_end": 65, "char_start": 25, "line": " path = self.sanitize_path(path)\n", "line_no": 2 }, { "char_end": 108, "char_start": 65, "line": " base_paths = self.get_base_paths()\n", "line_no": 3 }, { "char_end": 149, "char_start": 108, "line": " if hasattr(base_paths, 'split'):\n", "line_no": 4 }, { "char_end": 219, "char_start": 184, "line": " base_path = base_paths\n", "line_no": 6 }, { "char_end": 233, "char_start": 219, "line": " else:\n", "line_no": 7 }, { "char_end": 295, "char_start": 233, "line": " base_path = self.get_first_base(base_paths, path)\n", "line_no": 8 }, { "char_end": 338, "char_start": 295, "line": " return static_file(path, base_path)\n", "line_no": 9 } ], "deleted": [ { "char_end": 79, "char_start": 25, "line": " return static_file(path, self.get_base_path())\n", "line_no": 2 } ] }, "vul_type": "cwe-022" }
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 retu...
[ 1, 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, "chars": "hs =" }, { "char_end": 93, "char_start": 87, "chars": "elf.ge" }, { "char_end": 101, "char_start": 94, "chars": "_base_p" }, { "char_end": 116, "char_start": 103, "chars": "hs()\n " }, { "char_end": 143, "char_start": 118, "chars": " hasattr(base_paths, 'spl" }, { "char_end": 181, "char_start": 144, "chars": "t'):\n # String, so go simp" }, { "char_end": 250, "char_start": 183, "chars": "\n base_path = base_paths\n else:\n base_" }, { "char_end": 256, "char_start": 254, "chars": " =" }, { "char_end": 277, "char_start": 266, "chars": "first_base(" }, { "char_end": 293, "char_start": 286, "chars": "s, path" }, { "char_end": 337, "char_start": 294, "chars": "\n return static_file(path, base_path" } ], "deleted": [ { "char_end": 37, "char_start": 36, "chars": "u" }, { "char_end": 49, "char_start": 44, "chars": "ic_fi" }, { "char_end": 52, "char_start": 51, "chars": "(" }, { "char_end": 57, "char_start": 56, "chars": "," }, { "char_end": 78, "char_start": 77, "chars": ")" } ] }, "commit_link": "github.com/foxbunny/seagull/commit/1fb790712fe0c1d1957b31e34a8e0e6593af87a7", "file_name": "seagull/routes/app.py", "func_name": "get", "line_changes": { "added": [ { "char_end": 65, "char_start": 25, "line": " path = self.sanitize_path(path)\n", "line_no": 2 }, { "char_end": 108, "char_start": 65, "line": " base_paths = self.get_base_paths()\n", "line_no": 3 }, { "char_end": 149, "char_start": 108, "line": " if hasattr(base_paths, 'split'):\n", "line_no": 4 }, { "char_end": 219, "char_start": 184, "line": " base_path = base_paths\n", "line_no": 6 }, { "char_end": 233, "char_start": 219, "line": " else:\n", "line_no": 7 }, { "char_end": 295, "char_start": 233, "line": " base_path = self.get_first_base(base_paths, path)\n", "line_no": 8 }, { "char_end": 338, "char_start": 295, "line": " return static_file(path, base_path)\n", "line_no": 9 } ], "deleted": [ { "char_end": 79, "char_start": 25, "line": " return static_file(path, self.get_base_path())\n", "line_no": 2 } ] }, "vul_type": "cwe-022" }
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}" ]
[ 1, 0, 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/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_exist", "line_changes": { "added": [ { "char_end": 100, "char_start": 60, "line": " if (!str_is_correct_filename(path))\n", "line_no": 3 }, { "char_end": 189, "char_start": 100, "line": " error_msg_and_die(\"Cannot test existence. '%s' is not a valid file name\", path);\n", "line_no": 4 }, { "char_end": 190, "char_start": 189, "line": "\n", "line_no": 5 } ], "deleted": [] }, "vul_type": "cwe-022" }
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 f...
[ 1, 1, 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/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277", "file_name": "src/lib/dump_dir.c", "func_name": "dd_exist", "line_changes": { "added": [ { "char_end": 100, "char_start": 60, "line": " if (!str_is_correct_filename(path))\n", "line_no": 3 }, { "char_end": 189, "char_start": 100, "line": " error_msg_and_die(\"Cannot test existence. '%s' is not a valid file name\", path);\n", "line_no": 4 }, { "char_end": 190, "char_start": 189, "line": "\n", "line_no": 5 } ], "deleted": [] }, "vul_type": "cwe-022" }
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 begi...
[ 1, 0, 1, 0, 1, 0, 1, 0, 0, 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" }, { "char_end": 106, "char_start": 102, "chars": "True" }, { "char_end": 110, "char_start": 109, "chars": "d" }, { "char_end": 115, "char_start": 112, "chars": "pda" }, { "char_end": 121, "char_start": 119, "chars": "th" }, { "char_end": 123, "char_start": 122, "chars": " " }, { "char_end": 142, "char_start": 132, "chars": "attribute " }, { "char_end": 148, "char_start": 145, "chars": "the" }, { "char_end": 165, "char_start": 163, "chars": "(d" }, { "char_end": 174, "char_start": 171, "chars": "st)" }, { "char_end": 177, "char_start": 176, "chars": "f" }, { "char_end": 183, "char_start": 180, "chars": "lf." }, { "char_end": 187, "char_start": 186, "chars": "h" }, { "char_end": 189, "char_start": 188, "chars": "r" }, { "char_end": 193, "char_start": 190, "chars": "qui" }, { "char_end": 196, "char_start": 195, "chars": "s" }, { "char_end": 204, "char_start": 197, "chars": "running" }, { "char_end": 206, "char_start": 205, "chars": "a" }, { "char_end": 219, "char_start": 217, "chars": ".\n" }, { "char_end": 223, "char_start": 220, "chars": " " }, { "char_end": 228, "char_start": 227, "chars": "R" }, { "char_end": 232, "char_start": 230, "chars": "ur" }, { "char_end": 236, "char_start": 235, "chars": "F" }, { "char_end": 240, "char_start": 239, "chars": "e" }, { "char_end": 242, "char_start": 241, "chars": "o" }, { "char_end": 247, "char_start": 243, "chars": "herw" }, { "char_end": 310, "char_start": 306, "chars": "norm" }, { "char_end": 320, "char_start": 311, "chars": "lized url" }, { "char_end": 333, "char_start": 328, "chars": " path" }, { "char_end": 396, "char_start": 388, "chars": "\n " }, { "char_end": 482, "char_start": 477, "chars": "split" }, { "char_end": 514, "char_start": 489, "chars": "_url_collapse_path_split(" }, { "char_end": 524, "char_start": 523, "chars": ")" }, { "char_end": 534, "char_start": 533, "chars": "i" }, { "char_end": 548, "char_start": 536, "chars": "splitpath[0]" }, { "char_end": 603, "char_start": 602, "chars": "s" }, { "char_end": 605, "char_start": 604, "chars": "l" }, { "char_end": 607, "char_start": 606, "chars": "t" } ], "deleted": [ { "char_end": 84, "char_start": 83, "chars": "," }, { "char_end": 98, "char_start": 93, "chars": "and r" }, { "char_end": 110, "char_start": 104, "chars": "a bool" }, { "char_end": 120, "char_start": 113, "chars": ".\n\n " }, { "char_end": 130, "char_start": 121, "chars": " This f" }, { "char_end": 133, "char_start": 131, "chars": "nc" }, { "char_end": 139, "char_start": 134, "chars": "ion s" }, { "char_end": 141, "char_start": 140, "chars": "t" }, { "char_end": 144, "char_start": 143, "chars": "s" }, { "char_end": 148, "char_start": 145, "chars": "lf." }, { "char_end": 161, "char_start": 160, "chars": "a" }, { "char_end": 179, "char_start": 167, "chars": " (dir, rest)" }, { "char_end": 193, "char_start": 188, "chars": "when " }, { "char_end": 196, "char_start": 194, "chars": "t " }, { "char_end": 208, "char_start": 197, "chars": "eturns True" }, { "char_end": 213, "char_start": 210, "chars": "whe" }, { "char_end": 221, "char_start": 215, "chars": " dir i" }, { "char_end": 223, "char_start": 222, "chars": " " }, { "char_end": 226, "char_start": 224, "chars": "he" }, { "char_end": 228, "char_start": 227, "chars": "d" }, { "char_end": 236, "char_start": 229, "chars": "rectory" }, { "char_end": 240, "char_start": 239, "chars": "r" }, { "char_end": 243, "char_start": 242, "chars": "b" }, { "char_end": 246, "char_start": 244, "chars": "fo" }, { "char_end": 250, "char_start": 248, "chars": "\n " }, { "char_end": 255, "char_start": 251, "chars": " " }, { "char_end": 260, "char_start": 256, "chars": " the" }, { "char_end": 276, "char_start": 271, "chars": " name" }, { "char_end": 307, "char_start": 277, "chars": " Note that rest begins with a" }, { "char_end": 318, "char_start": 317, "chars": "l" }, { "char_end": 321, "char_start": 320, "chars": "h" }, { "char_end": 326, "char_start": 322, "chars": "if i" }, { "char_end": 328, "char_start": 327, "chars": " " }, { "char_end": 335, "char_start": 330, "chars": " not " }, { "char_end": 340, "char_start": 336, "chars": "mpty" }, { "char_end": 397, "char_start": 396, "chars": "p" }, { "char_end": 400, "char_start": 398, "chars": "th" }, { "char_end": 460, "char_start": 443, "chars": "the list\n " }, { "char_end": 521, "char_start": 513, "chars": "\n " }, { "char_end": 562, "char_start": 561, "chars": "\n" }, { "char_end": 587, "char_start": 586, "chars": "\n" }, { "char_end": 599, "char_start": 597, "chars": "or" }, { "char_end": 601, "char_start": 600, "chars": "x" }, { "char_end": 733, "char_start": 639, "chars": "i = len(x)\n if path[:i] == x and (not path[i:] or path[i] == '/'):\n " }, { "char_end": 755, "char_start": 750, "chars": "ath[:" }, { "char_end": 759, "char_start": 756, "chars": "], " }, { "char_end": 769, "char_start": 763, "chars": "[i+1:]" }, { "char_end": 774, "char_start": 770, "chars": " " } ] }, "commit_link": "github.com/Ricky-Wilson/Python/commit/c5abced949e6a4b001d1dee321593e74ecadecfe", "file_name": "Lib/CGIHTTPServer.py", "func_name": "is_cgi", "line_changes": { "added": [ { "char_end": 85, "char_start": 22, "line": " \"\"\"Test whether self.path corresponds to a CGI script.\n", "line_no": 2 }, { "char_end": 155, "char_start": 86, "line": " Returns True and updates the cgi_info attribute to the tuple\n", "line_no": 4 }, { "char_end": 219, "char_start": 155, "line": " (dir, rest) if self.path requires running a CGI script.\n", "line_no": 5 }, { "char_end": 252, "char_start": 219, "line": " Returns False otherwise.\n", "line_no": 6 }, { "char_end": 321, "char_start": 253, "line": " The default implementation tests whether the normalized url\n", "line_no": 8 }, { "char_end": 389, "char_start": 321, "line": " path begins with one of the strings in self.cgi_directories\n", "line_no": 9 }, { "char_end": 457, "char_start": 389, "line": " (and the next character is a '/' or the end of the string).\n", "line_no": 10 }, { "char_end": 469, "char_start": 457, "line": " \"\"\"\n", "line_no": 11 }, { "char_end": 525, "char_start": 469, "line": " splitpath = _url_collapse_path_split(self.path)\n", "line_no": 12 }, { "char_end": 574, "char_start": 525, "line": " if splitpath[0] in self.cgi_directories:\n", "line_no": 13 }, { "char_end": 612, "char_start": 574, "line": " self.cgi_info = splitpath\n", "line_no": 14 }, { "char_end": 636, "char_start": 612, "line": " return True\n", "line_no": 15 } ], "deleted": [ { "char_end": 85, "char_start": 22, "line": " \"\"\"Test whether self.path corresponds to a CGI script,\n", "line_no": 2 }, { "char_end": 115, "char_start": 85, "line": " and return a boolean.\n", "line_no": 3 }, { "char_end": 116, "char_start": 115, "line": "\n", "line_no": 4 }, { "char_end": 180, "char_start": 116, "line": " This function sets self.cgi_info to a tuple (dir, rest)\n", "line_no": 5 }, { "char_end": 249, "char_start": 180, "line": " when it returns True, where dir is the directory part before\n", "line_no": 6 }, { "char_end": 308, "char_start": 249, "line": " the CGI script name. Note that rest begins with a\n", "line_no": 7 }, { "char_end": 342, "char_start": 308, "line": " slash if it is not empty.\n", "line_no": 8 }, { "char_end": 343, "char_start": 342, "line": "\n", "line_no": 9 }, { "char_end": 401, "char_start": 343, "line": " The default implementation tests whether the path\n", "line_no": 10 }, { "char_end": 452, "char_start": 401, "line": " begins with one of the strings in the list\n", "line_no": 11 }, { "char_end": 514, "char_start": 452, "line": " self.cgi_directories (and the next character is a '/'\n", "line_no": 12 }, { "char_end": 549, "char_start": 514, "line": " or the end of the string).\n", "line_no": 13 }, { "char_end": 561, "char_start": 549, "line": " \"\"\"\n", "line_no": 14 }, { "char_end": 587, "char_start": 562, "line": " path = self.path\n", "line_no": 16 }, { "char_end": 627, "char_start": 588, "line": " for x in self.cgi_directories:\n", "line_no": 18 }, { "char_end": 650, "char_start": 627, "line": " i = len(x)\n", "line_no": 19 }, { "char_end": 717, "char_start": 650, "line": " if path[:i] == x and (not path[i:] or path[i] == '/'):\n", "line_no": 20 }, { "char_end": 770, "char_start": 717, "line": " self.cgi_info = path[:i], path[i+1:]\n", "line_no": 21 }, { "char_end": 798, "char_start": 770, "line": " return True\n", "line_no": 22 } ] }, "vul_type": "cwe-022" }
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 t...
[ 1, 1, 1, 1, 1, 1, 1, 1, 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" }, { "char_end": 106, "char_start": 102, "chars": "True" }, { "char_end": 110, "char_start": 109, "chars": "d" }, { "char_end": 115, "char_start": 112, "chars": "pda" }, { "char_end": 121, "char_start": 119, "chars": "th" }, { "char_end": 123, "char_start": 122, "chars": " " }, { "char_end": 142, "char_start": 132, "chars": "attribute " }, { "char_end": 148, "char_start": 145, "chars": "the" }, { "char_end": 165, "char_start": 163, "chars": "(d" }, { "char_end": 174, "char_start": 171, "chars": "st)" }, { "char_end": 177, "char_start": 176, "chars": "f" }, { "char_end": 183, "char_start": 180, "chars": "lf." }, { "char_end": 187, "char_start": 186, "chars": "h" }, { "char_end": 189, "char_start": 188, "chars": "r" }, { "char_end": 193, "char_start": 190, "chars": "qui" }, { "char_end": 196, "char_start": 195, "chars": "s" }, { "char_end": 204, "char_start": 197, "chars": "running" }, { "char_end": 206, "char_start": 205, "chars": "a" }, { "char_end": 219, "char_start": 217, "chars": ".\n" }, { "char_end": 223, "char_start": 220, "chars": " " }, { "char_end": 228, "char_start": 227, "chars": "R" }, { "char_end": 232, "char_start": 230, "chars": "ur" }, { "char_end": 236, "char_start": 235, "chars": "F" }, { "char_end": 240, "char_start": 239, "chars": "e" }, { "char_end": 242, "char_start": 241, "chars": "o" }, { "char_end": 247, "char_start": 243, "chars": "herw" }, { "char_end": 310, "char_start": 306, "chars": "norm" }, { "char_end": 320, "char_start": 311, "chars": "lized url" }, { "char_end": 333, "char_start": 328, "chars": " path" }, { "char_end": 396, "char_start": 388, "chars": "\n " }, { "char_end": 482, "char_start": 477, "chars": "split" }, { "char_end": 514, "char_start": 489, "chars": "_url_collapse_path_split(" }, { "char_end": 524, "char_start": 523, "chars": ")" }, { "char_end": 534, "char_start": 533, "chars": "i" }, { "char_end": 548, "char_start": 536, "chars": "splitpath[0]" }, { "char_end": 603, "char_start": 602, "chars": "s" }, { "char_end": 605, "char_start": 604, "chars": "l" }, { "char_end": 607, "char_start": 606, "chars": "t" } ], "deleted": [ { "char_end": 84, "char_start": 83, "chars": "," }, { "char_end": 98, "char_start": 93, "chars": "and r" }, { "char_end": 110, "char_start": 104, "chars": "a bool" }, { "char_end": 120, "char_start": 113, "chars": ".\n\n " }, { "char_end": 130, "char_start": 121, "chars": " This f" }, { "char_end": 133, "char_start": 131, "chars": "nc" }, { "char_end": 139, "char_start": 134, "chars": "ion s" }, { "char_end": 141, "char_start": 140, "chars": "t" }, { "char_end": 144, "char_start": 143, "chars": "s" }, { "char_end": 148, "char_start": 145, "chars": "lf." }, { "char_end": 161, "char_start": 160, "chars": "a" }, { "char_end": 179, "char_start": 167, "chars": " (dir, rest)" }, { "char_end": 193, "char_start": 188, "chars": "when " }, { "char_end": 196, "char_start": 194, "chars": "t " }, { "char_end": 208, "char_start": 197, "chars": "eturns True" }, { "char_end": 213, "char_start": 210, "chars": "whe" }, { "char_end": 221, "char_start": 215, "chars": " dir i" }, { "char_end": 223, "char_start": 222, "chars": " " }, { "char_end": 226, "char_start": 224, "chars": "he" }, { "char_end": 228, "char_start": 227, "chars": "d" }, { "char_end": 236, "char_start": 229, "chars": "rectory" }, { "char_end": 240, "char_start": 239, "chars": "r" }, { "char_end": 243, "char_start": 242, "chars": "b" }, { "char_end": 246, "char_start": 244, "chars": "fo" }, { "char_end": 250, "char_start": 248, "chars": "\n " }, { "char_end": 255, "char_start": 251, "chars": " " }, { "char_end": 260, "char_start": 256, "chars": " the" }, { "char_end": 276, "char_start": 271, "chars": " name" }, { "char_end": 307, "char_start": 277, "chars": " Note that rest begins with a" }, { "char_end": 318, "char_start": 317, "chars": "l" }, { "char_end": 321, "char_start": 320, "chars": "h" }, { "char_end": 326, "char_start": 322, "chars": "if i" }, { "char_end": 328, "char_start": 327, "chars": " " }, { "char_end": 335, "char_start": 330, "chars": " not " }, { "char_end": 340, "char_start": 336, "chars": "mpty" }, { "char_end": 397, "char_start": 396, "chars": "p" }, { "char_end": 400, "char_start": 398, "chars": "th" }, { "char_end": 460, "char_start": 443, "chars": "the list\n " }, { "char_end": 521, "char_start": 513, "chars": "\n " }, { "char_end": 562, "char_start": 561, "chars": "\n" }, { "char_end": 587, "char_start": 586, "chars": "\n" }, { "char_end": 599, "char_start": 597, "chars": "or" }, { "char_end": 601, "char_start": 600, "chars": "x" }, { "char_end": 733, "char_start": 639, "chars": "i = len(x)\n if path[:i] == x and (not path[i:] or path[i] == '/'):\n " }, { "char_end": 755, "char_start": 750, "chars": "ath[:" }, { "char_end": 759, "char_start": 756, "chars": "], " }, { "char_end": 769, "char_start": 763, "chars": "[i+1:]" }, { "char_end": 774, "char_start": 770, "chars": " " } ] }, "commit_link": "github.com/Ricky-Wilson/Python/commit/c5abced949e6a4b001d1dee321593e74ecadecfe", "file_name": "Lib/CGIHTTPServer.py", "func_name": "is_cgi", "line_changes": { "added": [ { "char_end": 85, "char_start": 22, "line": " \"\"\"Test whether self.path corresponds to a CGI script.\n", "line_no": 2 }, { "char_end": 155, "char_start": 86, "line": " Returns True and updates the cgi_info attribute to the tuple\n", "line_no": 4 }, { "char_end": 219, "char_start": 155, "line": " (dir, rest) if self.path requires running a CGI script.\n", "line_no": 5 }, { "char_end": 252, "char_start": 219, "line": " Returns False otherwise.\n", "line_no": 6 }, { "char_end": 321, "char_start": 253, "line": " The default implementation tests whether the normalized url\n", "line_no": 8 }, { "char_end": 389, "char_start": 321, "line": " path begins with one of the strings in self.cgi_directories\n", "line_no": 9 }, { "char_end": 457, "char_start": 389, "line": " (and the next character is a '/' or the end of the string).\n", "line_no": 10 }, { "char_end": 469, "char_start": 457, "line": " \"\"\"\n", "line_no": 11 }, { "char_end": 525, "char_start": 469, "line": " splitpath = _url_collapse_path_split(self.path)\n", "line_no": 12 }, { "char_end": 574, "char_start": 525, "line": " if splitpath[0] in self.cgi_directories:\n", "line_no": 13 }, { "char_end": 612, "char_start": 574, "line": " self.cgi_info = splitpath\n", "line_no": 14 }, { "char_end": 636, "char_start": 612, "line": " return True\n", "line_no": 15 } ], "deleted": [ { "char_end": 85, "char_start": 22, "line": " \"\"\"Test whether self.path corresponds to a CGI script,\n", "line_no": 2 }, { "char_end": 115, "char_start": 85, "line": " and return a boolean.\n", "line_no": 3 }, { "char_end": 116, "char_start": 115, "line": "\n", "line_no": 4 }, { "char_end": 180, "char_start": 116, "line": " This function sets self.cgi_info to a tuple (dir, rest)\n", "line_no": 5 }, { "char_end": 249, "char_start": 180, "line": " when it returns True, where dir is the directory part before\n", "line_no": 6 }, { "char_end": 308, "char_start": 249, "line": " the CGI script name. Note that rest begins with a\n", "line_no": 7 }, { "char_end": 342, "char_start": 308, "line": " slash if it is not empty.\n", "line_no": 8 }, { "char_end": 343, "char_start": 342, "line": "\n", "line_no": 9 }, { "char_end": 401, "char_start": 343, "line": " The default implementation tests whether the path\n", "line_no": 10 }, { "char_end": 452, "char_start": 401, "line": " begins with one of the strings in the list\n", "line_no": 11 }, { "char_end": 514, "char_start": 452, "line": " self.cgi_directories (and the next character is a '/'\n", "line_no": 12 }, { "char_end": 549, "char_start": 514, "line": " or the end of the string).\n", "line_no": 13 }, { "char_end": 561, "char_start": 549, "line": " \"\"\"\n", "line_no": 14 }, { "char_end": 587, "char_start": 562, "line": " path = self.path\n", "line_no": 16 }, { "char_end": 627, "char_start": 588, "line": " for x in self.cgi_directories:\n", "line_no": 18 }, { "char_end": 650, "char_start": 627, "line": " i = len(x)\n", "line_no": 19 }, { "char_end": 717, "char_start": 650, "line": " if path[:i] == x and (not path[i:] or path[i] == '/'):\n", "line_no": 20 }, { "char_end": 770, "char_start": 717, "line": " self.cgi_info = path[:i], path[i+1:]\n", "line_no": 21 }, { "char_end": 798, "char_start": 770, "line": " return True\n", "line_no": 22 } ] }, "vul_type": "cwe-022" }
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)",...
[ 1, 0, 1, 1, 0, 1, 0, 1, 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" }, { "char_end": 261, "char_start": 260, "chars": "K" }, { "char_end": 264, "char_start": 262, "chars": "yN" }, { "char_end": 267, "char_start": 265, "chars": "me" } ], "deleted": [ { "char_end": 130, "char_start": 110, "chars": "BAD_REQUEST\n\tglobal " }, { "char_end": 166, "char_start": 165, "chars": "\n" }, { "char_end": 273, "char_start": 272, "chars": "\n" }, { "char_end": 278, "char_start": 275, "chars": "f r" }, { "char_end": 281, "char_start": 279, "chars": ".s" }, { "char_end": 286, "char_start": 283, "chars": "rch" }, { "char_end": 303, "char_start": 287, "chars": "'[^a-zA-Z0-9]', " }, { "char_end": 380, "char_start": 320, "chars": "):\n\t\traise FoxlockError(BAD_REQUEST, 'Invalid key requested'" } ] }, "commit_link": "github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833", "file_name": "impl.py", "func_name": "deleteKey", "line_changes": { "added": [ { "char_end": 287, "char_start": 251, "line": "\tvalidateKeyName(token_data['key'])\n", "line_no": 10 } ], "deleted": [ { "char_end": 122, "char_start": 102, "line": "\tglobal BAD_REQUEST\n", "line_no": 5 }, { "char_end": 166, "char_start": 165, "line": "\n", "line_no": 9 }, { "char_end": 273, "char_start": 272, "line": "\n", "line_no": 12 }, { "char_end": 323, "char_start": 273, "line": "\tif re.search('[^a-zA-Z0-9]', token_data['key']):\n", "line_no": 13 }, { "char_end": 382, "char_start": 323, "line": "\t\traise FoxlockError(BAD_REQUEST, 'Invalid key requested')\n", "line_no": 14 } ] }, "vul_type": "cwe-022" }
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)", "\tvalidateKeyNam...
[ 1, 1, 1, 1, 1, 1, 1, 1, 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" }, { "char_end": 261, "char_start": 260, "chars": "K" }, { "char_end": 264, "char_start": 262, "chars": "yN" }, { "char_end": 267, "char_start": 265, "chars": "me" } ], "deleted": [ { "char_end": 130, "char_start": 110, "chars": "BAD_REQUEST\n\tglobal " }, { "char_end": 166, "char_start": 165, "chars": "\n" }, { "char_end": 273, "char_start": 272, "chars": "\n" }, { "char_end": 278, "char_start": 275, "chars": "f r" }, { "char_end": 281, "char_start": 279, "chars": ".s" }, { "char_end": 286, "char_start": 283, "chars": "rch" }, { "char_end": 303, "char_start": 287, "chars": "'[^a-zA-Z0-9]', " }, { "char_end": 380, "char_start": 320, "chars": "):\n\t\traise FoxlockError(BAD_REQUEST, 'Invalid key requested'" } ] }, "commit_link": "github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833", "file_name": "impl.py", "func_name": "deleteKey", "line_changes": { "added": [ { "char_end": 287, "char_start": 251, "line": "\tvalidateKeyName(token_data['key'])\n", "line_no": 10 } ], "deleted": [ { "char_end": 122, "char_start": 102, "line": "\tglobal BAD_REQUEST\n", "line_no": 5 }, { "char_end": 166, "char_start": 165, "line": "\n", "line_no": 9 }, { "char_end": 273, "char_start": 272, "line": "\n", "line_no": 12 }, { "char_end": 323, "char_start": 273, "line": "\tif re.search('[^a-zA-Z0-9]', token_data['key']):\n", "line_no": 13 }, { "char_end": 382, "char_start": 323, "line": "\t\traise FoxlockError(BAD_REQUEST, 'Invalid key requested')\n", "line_no": 14 } ] }, "vul_type": "cwe-022" }
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 ...
[ 1, 0, 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" }, { "char_end": 80, "char_start": 78, "chars": "y(" } ], "deleted": [ { "char_end": 74, "char_start": 61, "chars": "os.path.join(" }, { "char_end": 80, "char_start": 79, "chars": "n" }, { "char_end": 83, "char_start": 81, "chars": "me" }, { "char_end": 87, "char_start": 84, "chars": "pac" }, { "char_end": 90, "char_start": 88, "chars": ", " } ] }, "commit_link": "github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4", "file_name": "custodia/store/etcdstore.py", "func_name": "set", "line_changes": { "added": [ { "char_end": 85, "char_start": 46, "line": " path = self._absolute_key(key)\n", "line_no": 2 } ], "deleted": [ { "char_end": 95, "char_start": 46, "line": " path = os.path.join(self.namespace, key)\n", "line_no": 2 } ] }, "vul_type": "cwe-022" }
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_e...
[ 1, 1, 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" }, { "char_end": 80, "char_start": 78, "chars": "y(" } ], "deleted": [ { "char_end": 74, "char_start": 61, "chars": "os.path.join(" }, { "char_end": 80, "char_start": 79, "chars": "n" }, { "char_end": 83, "char_start": 81, "chars": "me" }, { "char_end": 87, "char_start": 84, "chars": "pac" }, { "char_end": 90, "char_start": 88, "chars": ", " } ] }, "commit_link": "github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4", "file_name": "custodia/store/etcdstore.py", "func_name": "set", "line_changes": { "added": [ { "char_end": 85, "char_start": 46, "line": " path = self._absolute_key(key)\n", "line_no": 2 } ], "deleted": [ { "char_end": 95, "char_start": 46, "line": " path = os.path.join(self.namespace, key)\n", "line_no": 2 } ] }, "vul_type": "cwe-022" }
49
cwe-022
py