code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
/* * Swagger Petstore * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator p...
cwe
CWE-732
Java
long long Block::GetTime(const Cluster* pCluster) const { assert(pCluster); const long long tc = GetTimeCode(pCluster); const Segment* const pSegment = pCluster->m_pSegment; const SegmentInfo* const pInfo = pSegment->GetInfo(); assert(pInfo); const long long scale = pInfo->GetTimeCodeScale...
cwe
CWE-119
C/C++
static cchar *findAcceptableVersion(cchar *name, cchar *originalCriteria) { MprDirEntry *dp; MprList *files; cchar *criteria; int next; criteria = originalCriteria; if (!criteria || smatch(criteria, "*")) { criteria = "x"; } if (schr(name, '#'))...
cwe
CWE-476
C/C++
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2009 Sage Weil <sage@newdream.net> * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General ...
cwe
CWE-287
C/C++
function html(m, keyPath, ...args) { const html = str(m, keyPath, ...args); return html ? React.createElement('span', { dangerouslySetInnerHTML: { __html: html } }) : null; }
cwe
CWE-79
JavaScript
/* Copyright 2023 The Fluid Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
cwe
CWE-863
Go
archive_wstring_append_from_mbs(struct archive_wstring *dest, const char *p, size_t len) { return archive_wstring_append_from_mbs_in_codepage(dest, p, len, NULL); }
cwe
CWE-125
Unknown
static int ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s, handle_t *handle, struct inode *inode, bool is_block) { struct ext4_xattr_entry *last; struct ext4_xattr_entry *here = s->here; size_t min_offs = s->end - s->base, name_len = strlen(i->name); int in_inode = i->in_ino...
cwe
CWE-416
Unknown
static void iriap_getvaluebyclass_indication(struct iriap_cb *self, struct sk_buff *skb) { struct ias_object *obj; struct ias_attrib *attrib; int name_len; int attr_len; char name[IAS_MAX_CLASSNAME + 1]; /* 60 bytes */ char attr[IAS_MAX_ATTRIBNAME + 1]; /* 60 bytes */ __u8 *fp; int n; IRDA_DEBUG(4, ...
cwe
CWE-119
C/C++
static int dissect_dvb_s2_bb(tvbuff_t *tvb, int cur_off, proto_tree *tree, packet_info *pinfo) { proto_item *ti; proto_tree *dvb_s2_bb_tree; guint8 input8, matype1; guint8 sync_flag = 0; guint16 input16, bb_data_len = 0, user_packet_length; int sub_dissected = 0, f...
cwe
CWE-835
C/C++
void HeaderMapImpl::removeInline(HeaderEntryImpl** ptr_to_entry) { if (!*ptr_to_entry) { return; } HeaderEntryImpl* entry = *ptr_to_entry; *ptr_to_entry = nullptr; headers_.erase(entry->entry_); }
cwe
CWE-400
Unknown
void NetworkHandler::GetAllCookies( std::unique_ptr<GetAllCookiesCallback> callback) { if (!process_) { callback->sendFailure(Response::InternalError()); return; } scoped_refptr<CookieRetriever> retriever = new CookieRetriever(std::move(callback)); BrowserThread::PostTask( Browser...
cwe
CWE-20
C/C++
package server import ( "fmt" "time" "github.com/usememos/memos/server/profile" "github.com/usememos/memos/store" "github.com/gorilla/securecookie" "github.com/gorilla/sessions" "github.com/labstack/echo-contrib/session" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" ) type Server s...
cwe
CWE-79
Go
function V(u){return(u=T(u))? u.substring(0,7):null}
cwe
CWE-79
JavaScript
# -*- coding: utf-8 -*- # Copyright 2016 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
cwe
CWE-74
Python
get_address( exarg_T *eap UNUSED, char_u **ptr, cmd_addr_T addr_type, int skip, // only skip the address, don't use it int silent, // no errors or side effects int to_other_file, // flag: may jump to other file int address_count UNUSED) // 1 for first address, >1 after comma { int...
cwe
CWE-122
C/C++
header_put_be_3byte (SF_PRIVATE *psf, int x) { if (psf->headindex < SIGNED_SIZEOF (psf->header) - 3) { psf->header [psf->headindex++] = (x >> 16) ; psf->header [psf->headindex++] = (x >> 8) ; psf->header [psf->headindex++] = x ; } ; } /* header_put_be_3byte */
cwe
CWE-787
Unknown
void send_file_direct(char *file_name) { int fh, i, length, delta; char str[MAX_PATH_LENGTH], dir[MAX_PATH_LENGTH], charset[80]; getcwd(dir, sizeof(dir)); fh = open(file_name, O_RDONLY | O_BINARY); if (fh > 0) { lseek(fh, 0, SEEK_END); length = TELL(fh); lseek(fh, 0, SEEK_SET); ...
cwe
CWE-79
Unknown
package com.salesmanager.shop.admin.controller.configurations; import java.util.HashMap; import java.util.Locale; import java.util.Map; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; imp...
cwe
CWE-639
Java
static int anr_search(struct ldb_module *module, struct ldb_request *req) { struct ldb_context *ldb; struct ldb_parse_tree *anr_tree; struct ldb_request *down_req; struct anr_context *ac; int ret; ldb = ldb_module_get_ctx(module); ac = talloc(req, struct anr_context); if (!ac) { return ldb_oom(ldb); } ac...
cwe
CWE-703
Unknown
Toolbar.prototype.createTextToolbar=function(){var a=this.editorUi,b=a.editor.graph,f=this.addMenu("",mxResources.get("style"),!0,"formatBlock");f.style.position="relative";f.style.whiteSpace="nowrap";f.style.overflow="hidden";f.innerHTML=mxResources.get("style");this.appendDropDownImageHtml(f);EditorUi.compactUi&&(f.s...
cwe
CWE-94
JavaScript
static Image *ReadSGIImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image; MagickBooleanType status; MagickSizeType number_pixels; MemoryInfo *pixel_info; register IndexPacket *indexes; register PixelPacket *q; register ssize_t i, x; register ...
cwe
CWE-120
C/C++
Number(I.value),[e[t]])}}finally{f.getModel().endUpdate()}});O.className="geBtn gePrimaryBtn";mxEvent.addListener(m,"keypress",function(t){13==t.keyCode&&O.click()});n=document.createElement("div");n.style.marginTop="20px";n.style.textAlign="right";b.editor.cancelFirst?(n.appendChild(c),n.appendChild(O)):(n.appendChild...
cwe
CWE-20
JavaScript
refreshTabs : function(){ "use strict"; window.console.log('refreshTabs'); var self = this; var pltabs = ''; for(var i=0; i<this.managedPlaylists.length; i++){ var pl = this.managedPlaylists[i]; var isactive = '' if(pl.id == this.editingPlayli...
cwe
CWE-22
JavaScript
def retrieve_playlist_by_id(id, db): db.execute( "SELECT id, name, video_position from playlist WHERE id={id};".format(id=id)) row = db.fetchone() return row
cwe
CWE-89
Python
GraphQLPlayground.init(root, ${JSON.stringify( extendedOptions, null, 2, )}) })
cwe
CWE-79
JavaScript
void Compute(OpKernelContext* context) override { const Tensor* input_indices; const Tensor* input_values; const Tensor* input_shape; SparseTensorsMap* map; OP_REQUIRES_OK(context, context->input("sparse_indices", &input_indices)); OP_REQUIRES_OK(context, context->input("sparse_values", &input_...
cwe
CWE-190
C/C++
from collections import defaultdict from typing import Iterable import graphene from django.core.exceptions import ValidationError from django.db import transaction from django.db.models import Exists, OuterRef, Q, Subquery from django.db.models.fields import IntegerField from django.db.models.functions import Coalesc...
cwe
CWE-863
Python
static int path_set_perms(Item *i, const char *path) { char fn[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int)]; _cleanup_close_ int fd = -1; struct stat st; assert(i); assert(path); if (!i->mode_set && !i->uid_set && !i->gid_set) goto shortcut; ...
cwe
CWE-59
Unknown
static int convert_case_filter(int c, void *void_data) { struct convert_case_data *data = (struct convert_case_data *) void_data; unsigned out[3]; unsigned len, i; /* Handle invalid characters early, as we assign special meaning to * codepoints above 0xffffff. */ if (UNEXPECTED(c > 0xffffff)) { (*data->next_f...
cwe
CWE-787
C/C++
export function deepExtend (a, b) { // TODO: add support for Arrays to deepExtend if (Array.isArray(b)) { throw new TypeError('Arrays are not supported by deepExtend') } for (const prop in b) { if (hasOwnProperty(b, prop)) { if (b[prop] && b[prop].constructor === Object) { if (a[prop] ===...
cwe
CWE-1321
JavaScript
// SPDX-FileCopyrightText: 2009-2018 pancake <pancake@nopcode.org> // SPDX-FileCopyrightText: 2009-2018 defragger <rlaemmert@gmail.com> // SPDX-License-Identifier: LGPL-3.0-only #include <rz_core.h> #include <rz_debug.h> #include <libgdbr.h> #include <gdbclient/commands.h> typedef struct { libgdbr_t desc; } RzIOGdb;...
cwe
CWE-787
C/C++
/* BSD 2-Clause License Copyright (c) 2018, lynnl Cleaned up and refactored for r2 in 2021 - 2022: condret All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain...
cwe
CWE-416
C/C++
package typesystem import ( "fmt" "github.com/go-errors/errors" openfgapb "go.buf.build/openfga/go/openfga/api/openfga/v1" ) const ( SchemaVersion1_0 = "1.0" SchemaVersion1_1 = "1.1" ) var ( ErrDuplicateTypes = errors.New("an authorization model cannot contain duplicate types") ErrInvalidSchemaVersion ...
cwe
CWE-863
Go
static int ssd0323_load(QEMUFile *f, void *opaque, int version_id) { SSISlave *ss = SSI_SLAVE(opaque); ssd0323_state *s = (ssd0323_state *)opaque; int i; if (version_id != 1) return -EINVAL; s->cmd_len = qemu_get_be32(f); s->cmd = qemu_get_be32(f); for (i = 0; i < 8; i++) ...
cwe
CWE-119
C/C++
// Copyright (c) 2020 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. // // WSO2 Inc. licenses this file to you under the Apache License, // Version 2.0 (the "License"); you may not use this file except // in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licens...
cwe
CWE-306
Java
snmp_engine(unsigned char *buff, uint32_t buff_len, unsigned char *out, uint32_t *out_len) { static snmp_header_t header; static snmp_varbind_t varbinds[SNMP_MAX_NR_VALUES]; static uint32_t varbind_length = SNMP_MAX_NR_VALUES; buff = snmp_message_decode(buff, buff_len, &header, varbinds, &varbind_length); if...
cwe
CWE-125
C/C++
// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2019, Linaro Ltd */ #include <linux/clk-provider.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/mailbox_client.h> #include <linux/module.h> #include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/thermal.h> #includ...
cwe
CWE-772
C/C++
this.customFonts)))}finally{V.getModel().endUpdate()}}}));this.editorUi.showDialog(W.container,380,Editor.enableWebFonts?250:180,!0,!0);W.init()}),z,null,!0)})))}})();function DiagramPage(b,e){this.node=b;null!=e?this.node.setAttribute("id",e):null==this.getId()&&this.node.setAttribute("id",Editor.guid())}DiagramPage.p...
cwe
CWE-20
JavaScript
public function deleteDir($dirname) { $dirname = Util::normalizePath($dirname); if ($dirname === '') { throw new RootViolationException('Root directories can not be deleted.'); } return (bool) $this->getAdapter()->deleteDir($dirname); }
cwe
CWE-89
JavaScript
ospf6_print_lshdr(netdissect_options *ndo, register const struct lsa6_hdr *lshp, const u_char *dataend) { if ((const u_char *)(lshp + 1) > dataend) goto trunc; ND_TCHECK(lshp->ls_type); ND_TCHECK(lshp->ls_seq); ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", ...
cwe
CWE-125
C/C++
def comments_closed? !(allow_comments? && in_feedback_window?) end
cwe
CWE-284
Ruby
/* * midi.c -- Midi Wavetable Processing library * * Copyright (C) WildMIDI Developers 2001-2016 * * This file is part of WildMIDI. * * WildMIDI is free software: you can redistribute and/or modify the player * under the terms of the GNU General Public License and you can redistribute * and/or modify the libra...
cwe
CWE-125
C/C++
static void stream_cleanup(h2_mplx *m, h2_stream *stream) { ap_assert(stream->state == H2_SS_CLEANUP); if (stream->input) { h2_beam_on_consumed(stream->input, NULL, NULL, NULL); h2_beam_abort(stream->input); } if (stream->output) { h2_beam_on_produced(stream->output, NULL, NULL)...
cwe
CWE-770
Unknown
add_link_ref( struct link_ref **references, const uint8_t *name, size_t name_size) { struct link_ref *ref = calloc(1, sizeof(struct link_ref)); if (!ref) return NULL; ref->id = hash_link_ref(name, name_size); ref->next = references[ref->id % REF_TABLE_SIZE]; references[ref->id % REF_TABLE_SIZE] = ref; retu...
cwe
CWE-327
C/C++
/* * MXF demuxer. * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Softw...
cwe
CWE-125
C/C++
/* * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy,...
cwe
CWE-287
Java
ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags) { struct sock *sk = sock->sk; struct tcp_splice_state tss = { .pipe = pipe, .len = len, .flags = flags, }; long timeo; ssize_t spliced; int ret; sock_rps_record_flow(sk); /* * ...
cwe
CWE-835
C/C++
/* * Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required...
cwe
CWE-754
Go
/* * Swagger Petstore * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator p...
cwe
CWE-732
Java
/** * The contents of this file are subject to the OpenMRS Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://license.openmrs.org * * Software distributed under the License is distributed on an "AS IS" ...
cwe
CWE-79
Java
/************************************************************************ * This file is part of EspoCRM. * * EspoCRM - Open Source CRM application. * Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko * Website: https://www.espocrm.com * * EspoCRM is free software: you can redistribute i...
cwe
CWE-79
JavaScript
static jpc_enc_band_t *band_create(jpc_enc_band_t *band, jpc_enc_cp_t *cp, jpc_enc_rlvl_t *rlvl, jpc_tsfb_band_t *bandinfos) { uint_fast16_t bandno; uint_fast16_t gblbandno; uint_fast16_t rlvlno; jpc_tsfb_band_t *bandinfo; jpc_enc_tcmpt_t *tcmpt; uint_fast32_t prcno; jpc_enc_prc_t *prc; tcmpt = rlvl->tcmpt; ...
cwe
CWE-787
Unknown
def render(self, name, value, attrs=None, renderer=None, **kwargs): """Render all textareas with correct plural labels.""" unit = value values = unit.get_target_plurals() lang = unit.translation.language plural = unit.translation.plural tabindex = self.attrs["tabindex"] ...
cwe
CWE-79
Python
smtp_log_to_file(smtp_t *smtp) { FILE *fp = fopen("/tmp/smtp-alert.log", "a"); time_t now; struct tm tm; char time_buf[25]; int time_buf_len; time(&now); localtime_r(&now, &tm); time_buf_len = strftime(time_buf, sizeof time_buf, "%a %b %e %X %Y", &tm); fprintf(fp, "%s: %s -> %s\n" "%*sSubject: %s\n" ...
cwe
CWE-59
C/C++
func checkKeyValid(r *http.Request, accessKey string) (auth.Credentials, bool, APIErrorCode) { if !globalIAMSys.Initialized() && !globalIsGateway { // Check if server has initialized, then only proceed // to check for IAM users otherwise its okay for clients // to retry with 503 errors when server is coming up. ...
cwe
CWE-285
Go
/** * Copyright (c) 2006-2016, JGraph Ltd * Copyright (c) 2006-2016, Gaudenz Alder */ package com.mxgraph.online; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import...
cwe
CWE-284
Java
/* * Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com> * Copyright (c) 2010-2014, Pieter Noordhuis <pcnoordhuis at gmail dot com> * Copyright (c) 2015, Matt Stancliff <matt at genges dot com>, * Jan-Erik Rediger <janerik at fnordig dot com> * * All rights reserved. * *...
cwe
CWE-190
C/C++
static int check_input_term(struct mixer_build *state, int id, struct usb_audio_term *term) { int protocol = state->mixer->protocol; int err; void *p1; memset(term, 0, sizeof(*term)); while ((p1 = find_audio_control_unit(state, id)) != NULL) { unsigned char *hdr = p1; term->id = id; if (protocol == ...
cwe
CWE-674
Unknown
check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e, struct xt_table_info *newinfo, unsigned int *size, const unsigned char *base, const unsigned char *limit, const unsigned int *hook_entries, const unsigned int *underflows, const char *name) { struct xt_entry_match ...
cwe
CWE-264
C/C++
GF_Err trak_box_size(GF_Box *s) { u32 pos=0; GF_TrackBox *ptr = (GF_TrackBox *)s; if (ptr->sample_encryption && ptr->sample_encryption->load_needed) { GF_Err e = senc_Parse(ptr->moov->mov->movieFileMap->bs, ptr, NULL, ptr->sample_encryption); if (e) return e; } gf_isom_check_position(s, (GF_Box *)ptr->Header...
cwe
CWE-476
Unknown
func (h *Handler) DefaultLogoutHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { h.L.Warnln("A client requested the default logout URL, environment variable OAUTH2_LOGOUT_REDIRECT_URL is probably not set.") fmt.Fprintf(w, ` <html> <head> <title>You logged out successfully</title> </head> <body>...
cwe
CWE-79
Go
char *auth_server(int f_in, int f_out, int module, const char *host, const char *addr, const char *leader) { char *users = lp_auth_users(module); char challenge[MAX_DIGEST_LEN*2]; char line[BIGPATHBUFLEN]; char **auth_uid_groups = NULL; int auth_uid_groups_cnt = -1; const char *err = NULL; int group_match = ...
cwe
CWE-354
Unknown
saveCurrentNode: function () { if (this.currentNode) { if (this.currentNode != "root") { this.currentNode.applyData(); } else { // save root node data var items = this.rootPanel.queryBy(function(item) { if (item == this...
cwe
CWE-79
JavaScript
void pdf_load_pages_kids(FILE *fp, pdf_t *pdf) { int i, id, dummy; char *buf, *c; long start, sz; start = ftell(fp); /* Load all kids for all xref tables (versions) */ for (i=0; i<pdf->n_xrefs; i++) { if (pdf->xrefs[i].version && (pdf->xrefs[i].end != 0)) { ...
cwe
CWE-787
C/C++
var startEditing = function(evt) { // Workaround for various issues in IE if (!mxClient.IS_IOS && !mxClient.IS_FF && (document.documentMode == null || document.documentMode > 9)) { if (label.getAttribute('contentEditable') != 'true') { if (stopEditing != null) ...
cwe
CWE-94
JavaScript
/* * Copyright (C) 2012 Red Hat, Inc. All rights reserved. * Author: Alex Williamson <alex.williamson@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Der...
cwe
CWE-119
C/C++
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % ...
cwe
CWE-119
C/C++
f-10+"px")};Toolbar.prototype.setFontName=function(a){if(null!=this.fontMenu){this.fontMenu.innerHTML="";var b=document.createElement("div");b.style.display="inline-block";b.style.overflow="hidden";b.style.textOverflow="ellipsis";b.style.maxWidth="66px";mxUtils.write(b,a);this.fontMenu.appendChild(b);this.appendDropDow...
cwe
CWE-94
JavaScript
/* Request a key from userspace * * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Found...
cwe
CWE-284
C/C++
xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { xmlIDTablePtr table; xmlIDPtr id; xmlChar *ID; if (doc == NULL) return(-1); if (attr == NULL) return(-1); table = (xmlIDTablePtr) doc->ids; if (table == NULL) return(-1); ID = xmlNodeListGetString(doc, attr->children, 1); if (I...
cwe
CWE-416
Unknown
aspath_put (struct stream *s, struct aspath *as, int use32bit ) { struct assegment *seg = as->segments; size_t bytes = 0; if (!seg || seg->length == 0) return 0; if (seg) { /* * Hey, what do we do when we have > STREAM_WRITABLE(s) here? * At the moment, we would write out a par...
cwe
CWE-20
C/C++
public static void unZipIt(String resourceName, String outputFolder) { byte[] buffer = new byte[1024]; try { ZipInputStream zis = new ZipInputStream(CreateResources.class.getResourceAsStream(resourceName)); ZipEntry ze = zis.getNextEntry(); while (ze != null) { String fileName = ze.getName(); Fi...
cwe
CWE-22
Java
function fastifyMultipart (fastify, options, done) { const attachFieldsToBody = options.attachFieldsToBody if (options.addToBody === true) { if (typeof options.sharedSchemaId === 'string') { fastify.addSchema({ $id: options.sharedSchemaId, type: 'object', properties: { en...
cwe
CWE-770
JavaScript
def parse_profile(name, contents): if name.endswith('.yaml'): # this was a full path name = os.path.splitext(os.path.basename(name))[0] data = yaml.load(contents) if data is None: # this happens if a completely empty YAML file is passed in to # parse_profile, for example ...
cwe
CWE-502
Python
lldp_private_8021_print(netdissect_options *ndo, const u_char *tptr, u_int tlv_len) { int subtype, hexdump = FALSE; u_int sublen; u_int tval; uint8_t i; if (tlv_len < 4) { return hexdump; } subtype = *(tptr+3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", ...
cwe
CWE-399
Unknown
window.OME.formatDryRun = function (dryRunData, showParents) { var html = "", move = [], count, unlink = []; ["Projects", "Datasets", "Screens", "Plates", "Wells", "Images"].forEach(function (otype) { if (otype in dryRunData.includedObjects) { ...
cwe
CWE-116
JavaScript
void CharCodeToUnicode::addMapping(CharCode code, char *uStr, int n, int offset) { CharCode oldLen, i; Unicode u; char uHex[5]; int j; if (code >= mapLen) { oldLen = mapLen; mapLen = (code + 256) & ~255; map = (Unicode *)greallocn(map, mapLen, sizeof(Unicode)); for (i = oldLen; i < map...
cwe
CWE-120
C/C++
static int yam_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __user *data, int cmd) { struct yam_port *yp = netdev_priv(dev); struct yamdrv_ioctl_cfg yi; struct yamdrv_ioctl_mcs *ym; int ioctl_cmd; if (copy_from_user(&ioctl_cmd, data, sizeof(int))) return -EFAULT; if (yp->magic != YAM_MAGIC) ...
cwe
CWE-401
C/C++
ProcessStartupPacket(Port *port, bool SSLdone) { int32 len; void *buf; ProtocolVersion proto; MemoryContext oldcontext; if (pq_getbytes((char *) &len, 4) == EOF) { /* * EOF after SSLdone probably means the client didn't like our * response to NEGOTIATE_SSL_CODE. That's not an error condition, so ...
cwe
CWE-89
Unknown
public function crossOriginRedirectProvider() { return [ ['http://example.com?a=b', 'http://test.com/', false], ['https://example.com?a=b', 'https://test.com/', false], ['http://example.com?a=b', 'https://test.com/', false], ['https://example.com?a=b', 'http:/...
cwe
CWE-212
PHP
static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen) { struct ipv6_pinfo *np = inet6_sk(sk); struct net *net = sock_net(sk); int val, valbool; int retv = -ENOPROTOOPT; bool needs_rtnl = setsockopt_needs_rtnl(optname); if (!optval) val = 0; else...
cwe
CWE-416
Unknown
def show_tree Log.add_info(request, params.inspect) if !@login_user.nil? and @login_user.admin?(User::AUTH_FOLDER) @group_id = nil if !params[:thetisBoxSelKeeper].nil? @group_id = params[:thetisBoxSelKeeper].split(':').last elsif !params[:group_id].nil? and !params[:group_id].empty? ...
cwe
CWE-89
Ruby
mark_trusted_task_thread_func (GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable) { MarkTrustedJob *job = task_data; CommonJob *common; common = (CommonJob *) jo...
cwe
CWE-20
C/C++
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % ...
cwe
CWE-190
C/C++
/* * linux/fs/ext2/acl.c * * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> */ #include <linux/init.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/fs.h> #include "ext2.h" #include "xattr.h" #include "acl.h" /* * Convert from filesystem to in-memory representation. */ static s...
cwe
CWE-285
C/C++
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...
cwe
CWE-22
C/C++
static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, __u8 type, __u8 flags, int paylen, gfp_t gfp) { struct sctp_chunkhdr *chunk_hdr; struct sctp_chunk *retval; struct sk_buff *skb; struct sock *sk; /* No need to allocate LL here, as this is only a chunk. */ skb = alloc...
cwe
CWE-20
Unknown
IMAGE_PATH+'/spin.gif" valign="middle"> '+mxUtils.htmlEntities(mxResources.get("loading"))+"...</div>";C=b.canReplyToReplies();b.commentsSupported()?b.getComments(function(J){function V(P){if(null!=P){P.sort(function(ia,la){return new Date(ia.modifiedDate)-new Date(la.modifiedDate)});for(var R=0;R<P.length;R++)V(P[R].r...
cwe
CWE-94
JavaScript
static int fprintf_utab_fs(FILE *f, struct libmnt_fs *fs) { char *p; assert(fs); assert(f); if (!fs || !f) return -EINVAL; p = mangle(mnt_fs_get_source(fs)); if (p) { fprintf(f, "SRC=%s ", p); free(p); } p = mangle(mnt_fs_get_target(fs)); if (p) { fprintf(f, "TARGET=%s ", p); free(p); } p = mang...
cwe
CWE-399
Unknown
static int nfs_lookup_reply(uchar *pkt, unsigned len) { struct rpc_t rpc_pkt; debug("%s\n", __func__); memcpy(&rpc_pkt.u.data[0], pkt, len); if (ntohl(rpc_pkt.u.reply.id) > rpc_id) return -NFS_RPC_ERR; else if (ntohl(rpc_pkt.u.reply.id) < rpc_id) return -NFS_RPC_DROP; if (rpc_pkt.u.reply.rstatus || ...
cwe
CWE-703
C/C++
/************************************************************ * Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that the above copyright * notice ap...
cwe
CWE-476
C/C++
struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, int64_t count, Error **errp) { GuestFileHandle *gfh = guest_file_handle_find(handle, errp); GuestFileRead *read_data = NULL; guchar *buf; FILE *fh; size_t read_count; if (!gfh) { ...
cwe
CWE-190
C/C++
void Compute(OpKernelContext* context) override { const Tensor& x = context->input(0); const Tensor& y = context->input(1); const float min_x = context->input(2).flat<float>()(0); const float max_x = context->input(3).flat<float>()(0); const float min_y = context->input(4).flat<float>()(0); cons...
cwe
CWE-787
C/C++
public int validateUser(boolean withConfirmEmail, XWikiContext context) throws XWikiException { try { XWikiRequest request = context.getRequest(); // Get the user document String username = convertUsername(request.getParameter("xwikiname"), context); if (usern...
cwe
CWE-285
Java
OMX_ERRORTYPE SoftMPEG4Encoder::initEncParams() { CHECK(mHandle != NULL); memset(mHandle, 0, sizeof(tagvideoEncControls)); CHECK(mEncParams != NULL); memset(mEncParams, 0, sizeof(tagvideoEncOptions)); if (!PVGetDefaultEncOption(mEncParams, 0)) { ALOGE("Failed to get default encoding parameters...
cwe
CWE-119
C/C++
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-754
C/C++
static int decode_unit(SCPRContext *s, PixelModel *pixel, unsigned step, unsigned *rval) { GetByteContext *gb = &s->gb; RangeCoder *rc = &s->rc; unsigned totfr = pixel->total_freq; unsigned value, x = 0, cumfr = 0, cnt_x = 0; int i, j, ret, c, cnt_c; if ((ret = s->get_freq(rc, totfr, &value)) <...
cwe
CWE-119
Unknown
def authenticate(self, username, password): child = None try: child = pexpect.spawn('/bin/sh', ['-c', '/bin/su -c "/bin/echo SUCCESS" - %s' % username], timeout=5) child.expect('.*:') child.sendline(password) result = child.expect(['su: .*', 'SUCCESS']) ...
cwe
CWE-78
Python
authentic_process_fci(struct sc_card *card, struct sc_file *file, const unsigned char *buf, size_t buflen) { struct sc_context *ctx = card->ctx; size_t taglen; int rv; unsigned ii; const unsigned char *tag = NULL; unsigned char ops_DF[8] = { SC_AC_OP_CREATE, SC_AC_OP_DELETE, SC_AC_OP_CRYPTO, 0xFF, 0xFF, 0xFF...
cwe
CWE-125
C/C++