Dataset Viewer
Auto-converted to Parquet Duplicate
func_name
stringlengths
2
53
func_src_before
stringlengths
63
114k
func_src_after
stringlengths
86
114k
line_changes
dict
char_changes
dict
commit_link
stringlengths
66
117
file_name
stringlengths
5
72
vul_type
stringclasses
9 values
dd_get_item_size
long dd_get_item_size(struct dump_dir *dd, const char *name) { long size = -1; char *iname = concat_path_file(dd->dd_dirname, name); struct stat statbuf; if (lstat(iname, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) size = statbuf.st_size; else { if (errno == ENOENT) ...
long dd_get_item_size(struct dump_dir *dd, const char *name) { if (!str_is_correct_filename(name)) error_msg_and_die("Cannot get item size. '%s' is not a valid file name", name); long size = -1; char *iname = concat_path_file(dd->dd_dirname, name); struct stat statbuf; if (lstat(iname, &st...
{ "deleted": [], "added": [ { "line_no": 3, "char_start": 63, "char_end": 103, "line": " if (!str_is_correct_filename(name))\n" }, { "line_no": 4, "char_start": 103, "char_end": 191, "line": " error_msg_and_die(\"Cannot get item size. '%s' is not...
{ "deleted": [], "added": [ { "char_start": 67, "char_end": 196, "chars": "if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot get item size. '%s' is not a valid file name\", name);\n\n " } ] }
github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277
src/lib/dump_dir.c
cwe-022
zmi_page_request
def zmi_page_request(self, *args, **kwargs): request = self.REQUEST RESPONSE = request.RESPONSE SESSION = request.SESSION self._zmi_page_request() RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822()) RESPONSE.setHeader('Cache-Control', ...
def zmi_page_request(self, *args, **kwargs): request = self.REQUEST RESPONSE = request.RESPONSE SESSION = request.SESSION self._zmi_page_request() RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822()) RESPONSE.setHeader('Cache-Control', ...
{ "deleted": [ { "line_no": 26, "char_start": 1313, "char_end": 1395, "line": " if len(filter(lambda x:x.find('.')>0 or x.startswith('manage_'),path))==0:\r\n" } ], "added": [ { "line_no": 26, "char_start": 1313, "char_end": 1436, "line": " if ...
{ "deleted": [], "added": [ { "char_start": 1322, "char_end": 1363, "chars": "self.getDocumentElement().id in path and " } ] }
github.com/zms-publishing/zms4/commit/3f28620d475220dfdb06f79787158ac50727c61a
ZMSItem.py
cwe-022
nntp_hcache_namer
static int nntp_hcache_namer(const char *path, char *dest, size_t destlen) { return snprintf(dest, destlen, "%s.hcache", path); }
static int nntp_hcache_namer(const char *path, char *dest, size_t destlen) { int count = snprintf(dest, destlen, "%s.hcache", path); /* Strip out any directories in the path */ char *first = strchr(dest, '/'); char *last = strrchr(dest, '/'); if (first && last && (last > first)) { memmove(first, last, ...
{ "deleted": [ { "line_no": 3, "char_start": 77, "char_end": 130, "line": " return snprintf(dest, destlen, \"%s.hcache\", path);\n" } ], "added": [ { "line_no": 3, "char_start": 77, "char_end": 135, "line": " int count = snprintf(dest, destlen, \"%s.hc...
{ "deleted": [ { "char_start": 79, "char_end": 81, "chars": "re" }, { "char_start": 83, "char_end": 84, "chars": "r" } ], "added": [ { "char_start": 79, "char_end": 81, "chars": "in" }, { "char_start": 82, "char_end": 85...
github.com/neomutt/neomutt/commit/9bfab35522301794483f8f9ed60820bdec9be59e
newsrc.c
cwe-022
TarFileReader::extract
std::string TarFileReader::extract(const string &_path) { if (_path.empty()) THROW("path cannot be empty"); if (!hasMore()) THROW("No more tar files"); string path = _path; if (SystemUtilities::isDirectory(path)) path += "/" + getFilename(); LOG_DEBUG(5, "Extracting: " << path); return extract(*SystemUti...
std::string TarFileReader::extract(const string &_path) { if (_path.empty()) THROW("path cannot be empty"); if (!hasMore()) THROW("No more tar files"); string path = _path; if (SystemUtilities::isDirectory(path)) { path += "/" + getFilename(); // Check that path is under the target directory strin...
{ "deleted": [ { "line_no": 6, "char_start": 180, "char_end": 251, "line": " if (SystemUtilities::isDirectory(path)) path += \"/\" + getFilename();\n" }, { "line_no": 10, "char_start": 293, "char_end": 342, "line": " return extract(*SystemUtilities::oopen(...
{ "deleted": [], "added": [ { "char_start": 222, "char_end": 228, "chars": "{\n " }, { "char_start": 260, "char_end": 544, "chars": " // Check that path is under the target directory\n string a = SystemUtilities::getCanonicalPath(_path);\n string b = SystemU...
github.com/CauldronDevelopmentLLC/cbang/commit/1c1dba62bd3e6fa9d0d0c0aa21926043b75382c7
src/cbang/tar/TarFileReader.cpp
cwe-022
handle_method_call
static void handle_method_call(GDBusConnection *connection, const gchar *caller, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, ...
static void handle_method_call(GDBusConnection *connection, const gchar *caller, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, ...
{ "deleted": [], "added": [ { "line_no": 259, "char_start": 9073, "char_end": 9119, "line": " if (!allowed_problem_dir(problem_id))\n" }, { "line_no": 260, "char_start": 9119, "char_end": 9129, "line": " {\n" }, { "line_no": 261...
{ "deleted": [], "added": [ { "char_start": 9086, "char_end": 9241, "chars": "allowed_problem_dir(problem_id))\n {\n return_InvalidProblemDir_error(invocation, problem_id);\n return;\n }\n\n if (!" }, { "char_start": 11712, "char_e...
github.com/abrt/abrt/commit/7a47f57975be0d285a2f20758e4572dca6d9cdd3
src/dbus/abrt-dbus.c
cwe-022
_inject_file_into_fs
def _inject_file_into_fs(fs, path, contents): absolute_path = os.path.join(fs, path.lstrip('/')) parent_dir = os.path.dirname(absolute_path) utils.execute('mkdir', '-p', parent_dir, run_as_root=True) utils.execute('tee', absolute_path, process_input=contents, run_as_root=True)
def _inject_file_into_fs(fs, path, contents, append=False): absolute_path = _join_and_check_path_within_fs(fs, path.lstrip('/')) parent_dir = os.path.dirname(absolute_path) utils.execute('mkdir', '-p', parent_dir, run_as_root=True) args = [] if append: args.append('-a') args.append(abs...
{ "deleted": [ { "line_no": 5, "char_start": 212, "char_end": 276, "line": " utils.execute('tee', absolute_path, process_input=contents,\n" }, { "line_no": 6, "char_start": 276, "char_end": 303, "line": " run_as_root=True)\n" } ], "added"...
{ "deleted": [ { "char_start": 67, "char_end": 69, "chars": "s." }, { "char_start": 73, "char_end": 76, "chars": ".jo" }, { "char_start": 216, "char_end": 218, "chars": "ut" }, { "char_start": 219, "char_end": 220, "ch...
github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7
nova/virt/disk/api.py
cwe-022
set_interface_var
set_interface_var(const char *iface, const char *var, const char *name, uint32_t val) { FILE *fp; char spath[64+IFNAMSIZ]; /* XXX: magic constant */ if (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath)) return -1; if (access(spath, F_OK) != 0) return -1; fp = fopen(spath, "w"); if (!fp) {...
set_interface_var(const char *iface, const char *var, const char *name, uint32_t val) { FILE *fp; char spath[64+IFNAMSIZ]; /* XXX: magic constant */ if (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath)) return -1; /* No path traversal */ if (strstr(name, "..") || strchr(name, '/')) return -...
{ "deleted": [], "added": [ { "line_no": 10, "char_start": 239, "char_end": 264, "line": "\t/* No path traversal */\n" }, { "line_no": 11, "char_start": 264, "char_end": 310, "line": "\tif (strstr(name, \"..\") || strchr(name, '/'))\n" }, { "...
{ "deleted": [], "added": [ { "char_start": 240, "char_end": 325, "chars": "/* No path traversal */\n\tif (strstr(name, \"..\") || strchr(name, '/'))\n\t\treturn -1;\n\n\t" } ] }
github.com/reubenhwk/radvd/commit/92e22ca23e52066da2258df8c76a2dca8a428bcc
device-linux.c
cwe-022
cut
def cut(self, key): try: self.etcd.delete(os.path.join(self.namespace, key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as err: log_error("Error removing key %s: [%r]" % (key, repr(err))) raise CSStoreError('Error occur...
def cut(self, key): try: self.etcd.delete(self._absolute_key(key)) except etcd.EtcdKeyNotFound: return False except etcd.EtcdException as err: log_error("Error removing key %s: [%r]" % (key, repr(err))) raise CSStoreError('Error occurred while ...
{ "deleted": [ { "line_no": 3, "char_start": 37, "char_end": 101, "line": " self.etcd.delete(os.path.join(self.namespace, key))\n" } ], "added": [ { "line_no": 3, "char_start": 37, "char_end": 91, "line": " self.etcd.delete(self._ab...
{ "deleted": [ { "char_start": 66, "char_end": 79, "chars": "os.path.join(" }, { "char_start": 84, "char_end": 85, "chars": "n" }, { "char_start": 86, "char_end": 88, "chars": "me" }, { "char_start": 89, "char_end": 92, ...
github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4
custodia/store/etcdstore.py
cwe-022
wiki_handle_http_request
wiki_handle_http_request(HttpRequest *req) { HttpResponse *res = http_response_new(req); char *page = http_request_get_path_info(req); char *command = http_request_get_query_string(req); char *wikitext = ""; util_dehttpize(page); /* remove any encoding on the requested ...
wiki_handle_http_request(HttpRequest *req) { HttpResponse *res = http_response_new(req); char *page = http_request_get_path_info(req); char *command = http_request_get_query_string(req); char *wikitext = ""; util_dehttpize(page); /* remove any encoding on the requested ...
{ "deleted": [ { "line_no": 54, "char_start": 1350, "char_end": 1375, "line": " if (strchr(page, '/'))\n" } ], "added": [ { "line_no": 54, "char_start": 1350, "char_end": 1382, "line": " if (!page_name_is_good(page))\n" } ] }
{ "deleted": [ { "char_start": 1357, "char_end": 1362, "chars": "trchr" }, { "char_start": 1367, "char_end": 1372, "chars": ", '/'" } ], "added": [ { "char_start": 1356, "char_end": 1368, "chars": "!page_name_i" }, { "char_sta...
github.com/yarolig/didiwiki/commit/5e5c796617e1712905dc5462b94bd5e6c08d15ea
src/wiki.c
cwe-022
candidate_paths_for_url
def candidate_paths_for_url(self, url): for root, prefix in self.directories: if url.startswith(prefix): yield os.path.join(root, url[len(prefix):])
def candidate_paths_for_url(self, url): for root, prefix in self.directories: if url.startswith(prefix): path = os.path.join(root, url[len(prefix):]) if os.path.commonprefix((root, path)) == root: yield path
{ "deleted": [ { "line_no": 4, "char_start": 129, "char_end": 188, "line": " yield os.path.join(root, url[len(prefix):])\n" } ], "added": [ { "line_no": 4, "char_start": 129, "char_end": 190, "line": " path = os.path.join(ro...
{ "deleted": [ { "char_start": 145, "char_end": 150, "chars": "yield" } ], "added": [ { "char_start": 145, "char_end": 151, "chars": "path =" }, { "char_start": 189, "char_end": 283, "chars": "\n if os.path.commonprefix((root...
github.com/evansd/whitenoise/commit/4d8a3ab1e97d7ddb18b3fa8b4909c92bad5529c6
whitenoise/base.py
cwe-022
updateKey
def updateKey(client): """Updates the contents of a key that already exists in our system. Returns an error if the specified key doesn't exist for the specified user. """ global NOT_FOUND global CREATED validateClient(client) client_pub_key = loadClientRSAKey(client) token_data = decodeRequestToken(request.da...
def updateKey(client): """Updates the contents of a key that already exists in our system. Returns an error if the specified key doesn't exist for the specified user. """ global NOT_FOUND global CREATED validateClient(client) client_pub_key = loadClientRSAKey(client) token_data = decodeRequestToken(request.dat...
{ "deleted": [ { "line_no": 9, "char_start": 233, "char_end": 234, "line": "\n" } ], "added": [ { "line_no": 12, "char_start": 371, "char_end": 408, "line": "\tvalidateKeyName(token_data['name'])\n" } ] }
{ "deleted": [ { "char_start": 233, "char_end": 234, "chars": "\n" } ], "added": [ { "char_start": 369, "char_end": 406, "chars": ")\n\tvalidateKeyName(token_data['name']" } ] }
github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833
impl.py
cwe-022
create_basename_core
def create_basename_core(basename): try: basename = basename.casefold() except Exception: basename = basename.lower() basename = basename.replace(' ', '-') basename = re.sub(r'<[^>]*>', r'', basename) basename = re.sub(r'[^a-z0-9\-]', r'', basename) basename = re.sub(r'\-\-', r'...
def create_basename_core(basename): try: basename = basename.casefold() except Exception: basename = basename.lower() basename = re.sub(r'[ \./]', r'-', basename) basename = re.sub(r'<[^>]*>', r'', basename) basename = re.sub(r'[^a-z0-9\-]', r'', basename) basename = re.sub(r'\-...
{ "deleted": [ { "line_no": 7, "char_start": 143, "char_end": 185, "line": " basename = basename.replace(' ', '-')\n" } ], "added": [ { "line_no": 7, "char_start": 143, "char_end": 192, "line": " basename = re.sub(r'[ \\./]', r'-', basename)\n" ...
{ "deleted": [ { "char_start": 158, "char_end": 165, "chars": "basenam" }, { "char_start": 168, "char_end": 175, "chars": "eplace(" } ], "added": [ { "char_start": 158, "char_end": 159, "chars": "r" }, { "char_start": 161, ...
github.com/syegulalp/mercury/commit/3f7c7442fa49aec37577dbdb47ce11a848e7bd03
MeTal/core/utils.py
cwe-022
get
def get(self, key): try: result = self.etcd.get(os.path.join(self.namespace, key)) except etcd.EtcdException as err: log_error("Error fetching key %s: [%r]" % (key, repr(err))) raise CSStoreError('Error occurred while trying to get key') return result.valu...
def get(self, key): try: result = self.etcd.get(self._absolute_key(key)) except etcd.EtcdException as err: log_error("Error fetching key %s: [%r]" % (key, repr(err))) raise CSStoreError('Error occurred while trying to get key') return result.value
{ "deleted": [ { "line_no": 3, "char_start": 37, "char_end": 107, "line": " result = self.etcd.get(os.path.join(self.namespace, key))\n" } ], "added": [ { "line_no": 3, "char_start": 37, "char_end": 97, "line": " result = self.etcd....
{ "deleted": [ { "char_start": 72, "char_end": 85, "chars": "os.path.join(" }, { "char_start": 90, "char_end": 91, "chars": "n" }, { "char_start": 92, "char_end": 94, "chars": "me" }, { "char_start": 95, "char_end": 98, ...
github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4
custodia/store/etcdstore.py
cwe-022
PHYSICALPATH_FUNC
PHYSICALPATH_FUNC(mod_alias_physical_handler) { plugin_data *p = p_d; int uri_len, basedir_len; char *uri_ptr; size_t k; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, p); /* not to include the tailing slash */ basedir_len = buffer_string_length(con->physi...
PHYSICALPATH_FUNC(mod_alias_physical_handler) { plugin_data *p = p_d; int uri_len, basedir_len; char *uri_ptr; size_t k; if (buffer_is_empty(con->physical.path)) return HANDLER_GO_ON; mod_alias_patch_connection(srv, con, p); /* not to include the tailing slash */ basedir_len = buffer_string_length(con->physi...
{ "deleted": [], "added": [ { "line_no": 29, "char_start": 928, "char_end": 994, "line": "\t\t\t/* check for path traversal in url-path following alias if key\n" }, { "line_no": 30, "char_start": 994, "char_end": 1062, "line": "\t\t\t * does not end in sla...
{ "deleted": [], "added": [ { "char_start": 931, "char_end": 1449, "chars": "/* check for path traversal in url-path following alias if key\n\t\t\t * does not end in slash, but replacement value ends in slash */\n\t\t\tif (uri_ptr[alias_len] == '.') {\n\t\t\t\tchar *s = uri_ptr + alias_len + 1...
github.com/lighttpd/lighttpd1.4/commit/2105dae0f9d7a964375ce681e53cb165375f84c1
src/mod_alias.c
cwe-022
download_check_files
def download_check_files(self, filelist): # only admins and allowed users may download if not cherrypy.session['admin']: uo = self.useroptions.forUser(self.getUserId()) if not uo.getOptionValue('media.may_download'): return 'not_permitted' # make sure ...
def download_check_files(self, filelist): # only admins and allowed users may download if not cherrypy.session['admin']: uo = self.useroptions.forUser(self.getUserId()) if not uo.getOptionValue('media.may_download'): return 'not_permitted' # make sure ...
{ "deleted": [ { "line_no": 9, "char_start": 383, "char_end": 411, "line": " if '/../' in f:\n" } ], "added": [ { "line_no": 10, "char_start": 443, "char_end": 494, "line": " if '/../' in f or f.startswith('../'):\n" }, { ...
{ "deleted": [], "added": [ { "char_start": 395, "char_end": 455, "chars": "# don't allow to traverse up in the file system\n " }, { "char_start": 469, "char_end": 625, "chars": " or f.startswith('../'):\n return 'invalid_file'\n #...
github.com/devsnd/cherrymusic/commit/62dec34a1ea0741400dd6b6c660d303dcd651e86
cherrymusicserver/httphandler.py
cwe-022
get_files
def get_files(self, submit_id, password=None, astree=False): """ Returns files from a submitted analysis. @param password: The password to unlock container archives with @param astree: sflock option; determines the format in which the files are returned @return: A tree of fil...
def get_files(self, submit_id, password=None, astree=False): """ Returns files from a submitted analysis. @param password: The password to unlock container archives with @param astree: sflock option; determines the format in which the files are returned @return: A tree of fil...
{ "deleted": [ { "line_no": 14, "char_start": 574, "char_end": 645, "line": " filepath = os.path.join(submit.tmp_path, data[\"data\"])\n" }, { "line_no": 15, "char_start": 645, "char_end": 700, "line": " filedata = open(filepath...
{ "deleted": [ { "char_start": 631, "char_end": 661, "chars": "data[\"data\"])\n " }, { "char_start": 665, "char_end": 675, "chars": "data = ope" }, { "char_start": 676, "char_end": 682, "chars": "(filep" }, { "char...
github.com/cuckoosandbox/cuckoo/commit/168cabf86730d56b7fa319278bf0f0034052666a
cuckoo/core/submit.py
cwe-022
handle
def handle(self, keepalive=True, initial_timeout=None): # we are requested to skip processing and keep the previous values if self.skip: return self.response.handle() # default to no keepalive in case something happens while even trying ensure we have a request self.keep...
def handle(self, keepalive=True, initial_timeout=None): # we are requested to skip processing and keep the previous values if self.skip: return self.response.handle() # default to no keepalive in case something happens while even trying ensure we have a request self.keep...
{ "deleted": [ { "line_no": 53, "char_start": 1744, "char_end": 1834, "line": " self.method, self.resource, self.request_http = self.request_line.split()\n" } ], "added": [ { "line_no": 53, "char_start": 1744, "char_end": 1829, "line": " ...
{ "deleted": [ { "char_start": 1773, "char_end": 1778, "chars": "self." } ], "added": [ { "char_start": 1827, "char_end": 1890, "chars": ")\n self.resource = urllib.parse.unquote(resource" } ] }
github.com/fkmclane/python-fooster-web/commit/80202a6d3788ad1212a162d19785c600025e6aa4
fooster/web/web.py
cwe-022
dd_delete_item
int dd_delete_item(struct dump_dir *dd, const char *name) { if (!dd->locked) error_msg_and_die("dump_dir is not opened"); /* bug */ char *path = concat_path_file(dd->dd_dirname, name); int res = unlink(path); if (res < 0) { if (errno == ENOENT) errno = res = 0; ...
int dd_delete_item(struct dump_dir *dd, const char *name) { if (!dd->locked) error_msg_and_die("dump_dir is not opened"); /* bug */ if (!str_is_correct_filename(name)) error_msg_and_die("Cannot delete item. '%s' is not a valid file name", name); char *path = concat_path_file(dd->dd_dirname...
{ "deleted": [], "added": [ { "line_no": 6, "char_start": 145, "char_end": 185, "line": " if (!str_is_correct_filename(name))\n" }, { "line_no": 7, "char_start": 185, "char_end": 271, "line": " error_msg_and_die(\"Cannot delete item. '%s' is not ...
{ "deleted": [], "added": [ { "char_start": 149, "char_end": 276, "chars": "if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot delete item. '%s' is not a valid file name\", name);\n\n " } ] }
github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277
src/lib/dump_dir.c
cwe-022
render
def render(self, request): action = "download" if "action" in request.args: action = request.args["action"][0] if "file" in request.args: filename = request.args["file"][0].decode('utf-8', 'ignore').encode('utf-8') filename = re.sub("^/+", "/", os.path.realpath(filename)) if not os.path.exists(file...
def render(self, request): action = "download" if "action" in request.args: action = request.args["action"][0] if "file" in request.args: filename = lenient_force_utf_8(request.args["file"][0]) filename = sanitise_filename_slashes(os.path.realpath(filename)) if not os.path.exists(filename): ret...
{ "deleted": [ { "line_no": 7, "char_start": 149, "char_end": 229, "line": "\t\t\tfilename = request.args[\"file\"][0].decode('utf-8', 'ignore').encode('utf-8')\n" }, { "line_no": 8, "char_start": 229, "char_end": 290, "line": "\t\t\tfilename = re.sub(\"^/+\...
{ "deleted": [ { "char_start": 186, "char_end": 227, "chars": ".decode('utf-8', 'ignore').encode('utf-8'" }, { "char_start": 243, "char_end": 244, "chars": "r" }, { "char_start": 245, "char_end": 246, "chars": "." }, { "char_start...
github.com/E2OpenPlugins/e2openplugin-OpenWebif/commit/a846b7664eda3a4c51a452e00638cf7337dc2013
plugin/controllers/file.py
cwe-022
_inject_net_into_fs
def _inject_net_into_fs(net, fs, execute=None): """Inject /etc/network/interfaces into the filesystem rooted at fs. net is the contents of /etc/network/interfaces. """ netdir = os.path.join(os.path.join(fs, 'etc'), 'network') utils.execute('mkdir', '-p', netdir, run_as_root=True) utils.execute(...
def _inject_net_into_fs(net, fs, execute=None): """Inject /etc/network/interfaces into the filesystem rooted at fs. net is the contents of /etc/network/interfaces. """ netdir = _join_and_check_path_within_fs(fs, 'etc', 'network') utils.execute('mkdir', '-p', netdir, run_as_root=True) utils.exec...
{ "deleted": [ { "line_no": 6, "char_start": 181, "char_end": 243, "line": " netdir = os.path.join(os.path.join(fs, 'etc'), 'network')\n" }, { "line_no": 10, "char_start": 426, "char_end": 475, "line": " netfile = os.path.join(netdir, 'interfaces')\n" ...
{ "deleted": [ { "char_start": 194, "char_end": 202, "chars": "os.path." }, { "char_start": 206, "char_end": 210, "chars": "(os." }, { "char_start": 214, "char_end": 217, "chars": ".jo" }, { "char_start": 229, "char_end": 23...
github.com/openstack/nova/commit/2427d4a99bed35baefd8f17ba422cb7aae8dcca7
nova/virt/disk/api.py
cwe-022
canonicalize
def canonicalize(self): """:: path = path.canonicalize() Canonicalize path. :: # "/foo/baz" Pyjo.Path.new('/foo/./bar/../baz').canonicalize() # "/../baz" Pyjo.Path.new('/foo/../bar/../../baz').canonicalize() """ parts = ...
def canonicalize(self): """:: path = path.canonicalize() Canonicalize path by resolving ``.`` and ``..``, in addition ``...`` will be treated as ``.`` to protect from path traversal attacks. # "/foo/baz" Pyjo.Path.new('/foo/./bar/../baz').canonicalize()...
{ "deleted": [ { "line_no": 6, "char_start": 83, "char_end": 113, "line": " Canonicalize path. ::\n" }, { "line_no": 17, "char_start": 375, "char_end": 425, "line": " if parts[i] == '.' or parts[i] == '':\n" } ], "added": [ { ...
{ "deleted": [ { "char_start": 110, "char_end": 112, "chars": "::" } ], "added": [ { "char_start": 108, "char_end": 124, "chars": " by resolving ``" }, { "char_start": 125, "char_end": 171, "chars": "`` and ``..``, in addition ``...`` will ...
github.com/dex4er/Pyjoyment/commit/e4b115bc80c41615b2133091af3a74ee5d995c2e
Pyjo/Path.py
cwe-022
CWebSock::GetSkinPath
CString CWebSock::GetSkinPath(const CString& sSkinName) { CString sRet = CZNC::Get().GetZNCPath() + "/webskins/" + sSkinName; if (!CFile::IsDir(sRet)) { sRet = CZNC::Get().GetCurPath() + "/webskins/" + sSkinName; if (!CFile::IsDir(sRet)) { sRet = CString(_SKINDIR_) + "/" + sSkinNam...
CString CWebSock::GetSkinPath(const CString& sSkinName) { const CString sSkin = sSkinName.Replace_n("/", "_").Replace_n(".", "_"); CString sRet = CZNC::Get().GetZNCPath() + "/webskins/" + sSkin; if (!CFile::IsDir(sRet)) { sRet = CZNC::Get().GetCurPath() + "/webskins/" + sSkin; if (!CFile:...
{ "deleted": [ { "line_no": 2, "char_start": 58, "char_end": 130, "line": " CString sRet = CZNC::Get().GetZNCPath() + \"/webskins/\" + sSkinName;\n" }, { "line_no": 5, "char_start": 162, "char_end": 230, "line": " sRet = CZNC::Get().GetCurPath() + ...
{ "deleted": [ { "char_start": 124, "char_end": 128, "chars": "Name" }, { "char_start": 224, "char_end": 228, "chars": "Name" }, { "char_start": 317, "char_end": 321, "chars": "Name" } ], "added": [ { "char_start": 62, "...
github.com/znc/znc/commit/a4a5aeeb17d32937d8c7d743dae9a4cc755ce773
src/WebModules.cpp
cwe-022
addKey
def addKey(client): """Adds a new key with the specified name and contents. Returns an error if a key with the specified name already exists. """ global BAD_REQUEST global CREATED validateClient(client) client_pub_key = loadClientRSAKey(client) token_data = decodeRequestToken(request.data, client_pub_key) va...
def addKey(client): """Adds a new key with the specified name and contents. Returns an error if a key with the specified name already exists. """ global BAD_REQUEST global CREATED validateClient(client) client_pub_key = loadClientRSAKey(client) token_data = decodeRequestToken(request.data, client_pub_key) val...
{ "deleted": [ { "line_no": 9, "char_start": 210, "char_end": 211, "line": "\n" } ], "added": [ { "line_no": 12, "char_start": 348, "char_end": 385, "line": "\tvalidateKeyName(token_data['name'])\n" } ] }
{ "deleted": [ { "char_start": 210, "char_end": 211, "chars": "\n" } ], "added": [ { "char_start": 346, "char_end": 383, "chars": ")\n\tvalidateKeyName(token_data['name']" } ] }
github.com/Mimickal/FoxLock/commit/7c665e556987f4e2c1a75e143a1e80ae066ad833
impl.py
cwe-022
dd_save_text
void dd_save_text(struct dump_dir *dd, const char *name, const char *data) { if (!dd->locked) error_msg_and_die("dump_dir is not opened"); /* bug */ char *full_path = concat_path_file(dd->dd_dirname, name); save_binary_file(full_path, data, strlen(data), dd->dd_uid, dd->dd_gid, dd->mode); free(...
void dd_save_text(struct dump_dir *dd, const char *name, const char *data) { if (!dd->locked) error_msg_and_die("dump_dir is not opened"); /* bug */ if (!str_is_correct_filename(name)) error_msg_and_die("Cannot save text. '%s' is not a valid file name", name); char *full_path = concat_path...
{ "deleted": [], "added": [ { "line_no": 6, "char_start": 162, "char_end": 202, "line": " if (!str_is_correct_filename(name))\n" }, { "line_no": 7, "char_start": 202, "char_end": 286, "line": " error_msg_and_die(\"Cannot save text. '%s' is not a ...
{ "deleted": [], "added": [ { "char_start": 166, "char_end": 291, "chars": "if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save text. '%s' is not a valid file name\", name);\n\n " } ] }
github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277
src/lib/dump_dir.c
cwe-022
misc_file_checks
def misc_file_checks(self): print_header("MISC FILE CHECKS") # # Check for recommended and mandatory files # filenames = ("manifest.json", "LICENSE", "README.md", "scripts/install", "scripts/remove", "scripts/upgrade", ...
def misc_file_checks(self): print_header("MISC FILE CHECKS") # # Check for recommended and mandatory files # filenames = ("manifest.json", "LICENSE", "README.md", "scripts/install", "scripts/remove", "scripts/upgrade", ...
{ "deleted": [ { "line_no": 39, "char_start": 1268, "char_end": 1336, "line": " if not os.path.isfile(self.path + \"/conf/\" + filename):\n" } ], "added": [ { "line_no": 42, "char_start": 1425, "char_end": 1520, "line": " if not os....
{ "deleted": [], "added": [ { "char_start": 1153, "char_end": 1184, "chars": "Analyze nginx conf\n # - " }, { "char_start": 1240, "char_end": 1292, "chars": " - Spot path traversal issue vulnerability\n #" }, { "char_start": 1363, "ch...
github.com/YunoHost/package_linter/commit/f6e98894cfe841aedaa7efd590937f0255193913
package_linter.py
cwe-022
dd_save_binary
void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size) { if (!dd->locked) error_msg_and_die("dump_dir is not opened"); /* bug */ char *full_path = concat_path_file(dd->dd_dirname, name); save_binary_file(full_path, data, size, dd->dd_uid, dd->dd_gid, dd->mode); ...
void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size) { if (!dd->locked) error_msg_and_die("dump_dir is not opened"); /* bug */ if (!str_is_correct_filename(name)) error_msg_and_die("Cannot save binary. '%s' is not a valid file name", name); char *full...
{ "deleted": [], "added": [ { "line_no": 6, "char_start": 179, "char_end": 219, "line": " if (!str_is_correct_filename(name))\n" }, { "line_no": 7, "char_start": 219, "char_end": 305, "line": " error_msg_and_die(\"Cannot save binary. '%s' is not ...
{ "deleted": [], "added": [ { "char_start": 183, "char_end": 310, "chars": "if (!str_is_correct_filename(name))\n error_msg_and_die(\"Cannot save binary. '%s' is not a valid file name\", name);\n\n " } ] }
github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277
src/lib/dump_dir.c
cwe-022
pascal_case
def pascal_case(value: str) -> str: return stringcase.pascalcase(value)
def pascal_case(value: str) -> str: return stringcase.pascalcase(_sanitize(value))
{ "deleted": [ { "line_no": 2, "char_start": 36, "char_end": 75, "line": " return stringcase.pascalcase(value)\n" } ], "added": [ { "line_no": 2, "char_start": 36, "char_end": 86, "line": " return stringcase.pascalcase(_sanitize(value))\n" } ...
{ "deleted": [], "added": [ { "char_start": 69, "char_end": 79, "chars": "_sanitize(" }, { "char_start": 85, "char_end": 86, "chars": ")" } ] }
github.com/openapi-generators/openapi-python-client/commit/3e7dfae5d0b3685abf1ede1bc6c086a116ac4746
openapi_python_client/utils.py
cwe-022
cleanup_pathname
cleanup_pathname(struct archive_write_disk *a) { char *dest, *src; char separator = '\0'; dest = src = a->name; if (*src == '\0') { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Invalid empty pathname"); return (ARCHIVE_FAILED); } #if defined(__CYGWIN__) cleanup_pathname_win(a); #endif /* Skip ...
cleanup_pathname(struct archive_write_disk *a) { char *dest, *src; char separator = '\0'; dest = src = a->name; if (*src == '\0') { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Invalid empty pathname"); return (ARCHIVE_FAILED); } #if defined(__CYGWIN__) cleanup_pathname_win(a); #endif /* Skip ...
{ "deleted": [ { "line_no": 17, "char_start": 336, "char_end": 354, "line": "\tif (*src == '/')\n" } ], "added": [ { "line_no": 17, "char_start": 336, "char_end": 356, "line": "\tif (*src == '/') {\n" }, { "line_no": 18, "char_start":...
{ "deleted": [], "added": [ { "char_start": 353, "char_end": 543, "chars": " {\n\t\tif (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {\n\t\t\tarchive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,\n\t\t\t \"Path is absolute\");\n\t\t\treturn (ARCHIVE_FAILED);\n\t\t}\n" }...
github.com/libarchive/libarchive/commit/59357157706d47c365b2227739e17daba3607526
libarchive/archive_write_disk_posix.c
cwe-022
create_dump_dir_from_problem_data
struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name) { INITIALIZE_LIBREPORT(); char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER); if (!type) { error_msg(_("Missing required item: '%s'"), FILENAME_ANALYZER); ...
struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name) { INITIALIZE_LIBREPORT(); char *type = problem_data_get_content_or_NULL(problem_data, FILENAME_ANALYZER); if (!type) { error_msg(_("Missing required item: '%s'"), FILENAME_ANALYZER); ...
{ "deleted": [ { "line_no": 90, "char_start": 2743, "char_end": 2817, "line": " /* only files should contain '/' and those are handled earlier */\n" }, { "line_no": 91, "char_start": 2817, "char_end": 2866, "line": " if (name[0] == '.' || strch...
{ "deleted": [ { "char_start": 2709, "char_end": 2963, "chars": "\n continue;\n }\n\n /* only files should contain '/' and those are handled earlier */\n if (name[0] == '.' || strchr(name, '/'))\n {\n error_msg(\"Problem data field name contains ...
github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277
src/lib/create_dump_dir.c
cwe-022
list
def list(self, keyfilter='/'): path = os.path.join(self.namespace, keyfilter) if path != '/': path = path.rstrip('/') try: result = self.etcd.read(path, recursive=True) except etcd.EtcdKeyNotFound: return None except etcd.EtcdException as e...
def list(self, keyfilter='/'): path = self._absolute_key(keyfilter) if path != '/': path = path.rstrip('/') try: result = self.etcd.read(path, recursive=True) except etcd.EtcdKeyNotFound: return None except etcd.EtcdException as err: ...
{ "deleted": [ { "line_no": 2, "char_start": 35, "char_end": 90, "line": " path = os.path.join(self.namespace, keyfilter)\n" } ], "added": [ { "line_no": 2, "char_start": 35, "char_end": 80, "line": " path = self._absolute_key(keyfilter)\n"...
{ "deleted": [ { "char_start": 50, "char_end": 63, "chars": "os.path.join(" }, { "char_start": 68, "char_end": 69, "chars": "n" }, { "char_start": 70, "char_end": 72, "chars": "me" }, { "char_start": 73, "char_end": 76, ...
github.com/latchset/custodia/commit/785fc87f38b4811bc4ce43a0a9b2267ee7d500b4
custodia/store/etcdstore.py
cwe-022
process
local void process(char *path) { int method = -1; /* get_header() return value */ size_t len; /* length of base name (minus suffix) */ struct stat st; /* to get file type and mod time */ /* all compressed suffixes for decoding search, in length order */...
local void process(char *path) { int method = -1; /* get_header() return value */ size_t len; /* length of base name (minus suffix) */ struct stat st; /* to get file type and mod time */ /* all compressed suffixes for decoding search, in length order */...
{ "deleted": [ { "line_no": 224, "char_start": 8033, "char_end": 8058, "line": " char *to, *repl;\n" }, { "line_no": 225, "char_start": 8058, "char_end": 8059, "line": "\n" }, { "line_no": 226, "char_start": 8059, "char_end":...
{ "deleted": [ { "char_start": 8052, "char_end": 8053, "chars": "r" }, { "char_start": 8055, "char_end": 8056, "chars": "l" }, { "char_start": 8070, "char_end": 8071, "chars": "u" }, { "char_start": 8076, "char_end": 8078, ...
github.com/madler/pigz/commit/fdad1406b3ec809f4954ff7cdf9e99eb18c2458f
pigz.c
cwe-022
imap_hcache_open
header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path) { struct ImapMbox mx; struct Url url; char cachepath[PATH_MAX]; char mbox[PATH_MAX]; if (path) imap_cachepath(idata, path, mbox, sizeof(mbox)); else { if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) < 0) re...
header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path) { struct ImapMbox mx; struct Url url; char cachepath[PATH_MAX]; char mbox[PATH_MAX]; if (path) imap_cachepath(idata, path, mbox, sizeof(mbox)); else { if (!idata->ctx || imap_parse_path(idata->ctx->path, &mx) < 0) re...
{ "deleted": [], "added": [ { "line_no": 19, "char_start": 413, "char_end": 504, "line": " if (strstr(mbox, \"/../\") || (strcmp(mbox, \"..\") == 0) || (strncmp(mbox, \"../\", 3) == 0))\n" }, { "line_no": 20, "char_start": 504, "char_end": 521, "line": " ...
{ "deleted": [], "added": [ { "char_start": 415, "char_end": 627, "chars": "if (strstr(mbox, \"/../\") || (strcmp(mbox, \"..\") == 0) || (strncmp(mbox, \"../\", 3) == 0))\n return NULL;\n size_t len = strlen(mbox);\n if ((len > 3) && (strcmp(mbox + len - 3, \"/..\") == 0))\n return NUL...
github.com/neomutt/neomutt/commit/57971dba06346b2d7179294f4528b8d4427a7c5d
imap/util.c
cwe-022
_normalize
def _normalize(self, metaerrors): """Normalize output format to be usable by Anaconda's linting frontend """ errors = [] for error in metaerrors: if self.filepath not in error.get('path', ''): continue error_type = error.get('severity', 'X')....
def _normalize(self, metaerrors): """Normalize output format to be usable by Anaconda's linting frontend """ errors = [] for error in metaerrors: last_path = os.path.join( os.path.basename(os.path.dirname(self.filepath)), os.path.basename(...
{ "deleted": [ { "line_no": 7, "char_start": 183, "char_end": 242, "line": " if self.filepath not in error.get('path', ''):\n" } ], "added": [ { "line_no": 7, "char_start": 183, "char_end": 221, "line": " last_path = os.path.join(\n...
{ "deleted": [], "added": [ { "char_start": 195, "char_end": 217, "chars": "last_path = os.path.jo" }, { "char_start": 218, "char_end": 273, "chars": "n(\n os.path.basename(os.path.dirname(sel" }, { "char_start": 274, "char_end": 287...
github.com/DamnWidget/anaconda_go/commit/d3db90bb8853d832927818699591b91f56f6413c
plugin/handlers_go/anagonda/context/gometalinter.py
cwe-022
dd_load_text_ext
char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags) { // if (!dd->locked) // error_msg_and_die("dump_dir is not opened"); /* bug */ /* Compat with old abrt dumps. Remove in abrt-2.1 */ if (strcmp(name, "release") == 0) name = FILENAME_OS_RELEASE; char *ful...
char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags) { // if (!dd->locked) // error_msg_and_die("dump_dir is not opened"); /* bug */ if (!str_is_correct_filename(name)) { error_msg("Cannot load text. '%s' is not a valid file name", name); if (!(flags & D...
{ "deleted": [], "added": [ { "line_no": 6, "char_start": 175, "char_end": 215, "line": " if (!str_is_correct_filename(name))\n" }, { "line_no": 7, "char_start": 215, "char_end": 221, "line": " {\n" }, { "line_no": 8, "char_start"...
{ "deleted": [], "added": [ { "char_start": 179, "char_end": 393, "chars": "if (!str_is_correct_filename(name))\n {\n error_msg(\"Cannot load text. '%s' is not a valid file name\", name);\n if (!(flags & DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE))\n xfunc_die();\n }\n\...
github.com/abrt/libreport/commit/239c4f7d1f47265526b39ad70106767d00805277
src/lib/dump_dir.c
cwe-022
_download_file
@staticmethod def _download_file(bucket, filename, local_dir): key = bucket.get_key(filename) local_filename = os.path.join(local_dir, filename) key.get_contents_to_filename(local_filename) return local_filename
@staticmethod def _download_file(bucket, filename, local_dir): key = bucket.get_key(filename) local_filename = os.path.join(local_dir, os.path.basename(filename)) key.get_contents_to_filename(local_filename) return local_filename
{ "deleted": [ { "line_no": 4, "char_start": 110, "char_end": 169, "line": " local_filename = os.path.join(local_dir, filename)\n" } ], "added": [ { "line_no": 4, "char_start": 110, "char_end": 187, "line": " local_filename = os.path.join(l...
{ "deleted": [], "added": [ { "char_start": 159, "char_end": 176, "chars": "os.path.basename(" }, { "char_start": 184, "char_end": 185, "chars": ")" } ] }
github.com/openstack/nova/commit/76363226bd8533256f7795bba358d7f4b8a6c9e6
nova/image/s3.py
cwe-022
End of preview. Expand in Data Studio

Dataset Card for "sven"

Unofficial, not affiliated with the authors.

Paper: https://arxiv.org/abs/2302.05319
Repository: https://github.com/eth-sri/sven
Downloads last month
39

Paper for bstee615/sven