code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
var less, tree; // Node.js does not have a header file added which defines less if (less === undefined) { less = exports; tree = require('./tree'); less.mode = 'node'; } // // less.js - parser // // A relatively straight-forward predictive parser. // There is no tokenization/lexing stage, the input i...
cwe
CWE-74
Java
static function reportForNetworkInformations( $from, array $joincrit, array $where = [], array $select = [], array $leftjoin = [], array $innerjoin = [], array $order = [], $extra = '' ) { global $DB; // This SQL request matches the NetworkPort, then its N...
cwe
CWE-89
PHP
protected function get_remote_contents(&$url, $timeout = 30, $redirect_max = 5, $ua = 'Mozilla/5.0', $fp = null) { if (preg_match('~^(?:ht|f)tps?://[-_.!\~*\'()a-z0-9;/?:\@&=+\$,%#\*\[\]]+~i', $url)) { $info = parse_url($url); $host = trim(strtolower($info['host']), '.'); ...
cwe
CWE-22
PHP
ProcessUtilitySlow(Node *parsetree, const char *queryString, ProcessUtilityContext context, ParamListInfo params, DestReceiver *dest, char *completionTag) { bool isTopLevel = (context == PROCESS_UTILITY_TOPLEVEL); bool isCompleteQuery = (context <= PROCESS_UTILITY_QUERY); bool n...
cwe
CWE-362
Unknown
prep_reprocess_req(krb5_kdc_req *request, krb5_principal *krbtgt_princ) { krb5_error_code retval = KRB5KRB_AP_ERR_BADMATCH; char **realms, **cpp, *temp_buf=NULL; krb5_data *comp1 = NULL, *comp2 = NULL; char *comp1_str = NULL; /* By now we know that server principal name is unknown. * If CANONI...
cwe
CWE-119
C/C++
reverse_nat_packet(struct dp_packet *pkt, const struct conn *conn) { char *tail = dp_packet_tail(pkt); uint8_t pad = dp_packet_l2_pad_size(pkt); struct conn_key inner_key; const char *inner_l4 = NULL; uint16_t orig_l3_ofs = pkt->l3_ofs; uint16_t orig_l4_ofs = pkt->l4_ofs; if (conn->key.dl_t...
cwe
CWE-400
Unknown
const getCdnMarkup = ({ version, cdnUrl = '//cdn.jsdelivr.net/npm', faviconUrl }) => ` <link rel="stylesheet" href="${cdnUrl}/graphql-playground-react${
cwe
CWE-79
JavaScript
EditorUi.prototype.createUi=function(){this.menubar=this.editor.chromeless?null:this.menus.createMenubar(this.createDiv("geMenubar"));null!=this.menubar&&this.menubarContainer.appendChild(this.menubar.container);null!=this.menubar&&(this.statusContainer=this.createStatusContainer(),this.editor.addListener("statusChange...
cwe
CWE-94
JavaScript
static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) { struct fib* srbfib; int status; struct aac_srb *srbcmd = NULL; struct aac_hba_cmd_req *hbacmd = NULL; struct user_aac_srb *user_srbcmd = NULL; struct user_aac_srb __user *user_srb = arg; struct aac_srb_reply __user *user_reply; u32 chn; u32 ...
cwe
CWE-200
C/C++
func (proj AppProject) IsLiveResourcePermitted(un *unstructured.Unstructured, server string, name string) bool { if !proj.IsGroupKindPermitted(un.GroupVersionKind().GroupKind(), un.GetNamespace() != "") { return false } if un.GetNamespace() != "" { return proj.IsDestinationPermitted(ApplicationDestination{Server...
cwe
CWE-200
Go
$scope.save = function() { var form = this.fsForm; RequisitionsService.startTiming(); RequisitionsService.saveForeignSourceDefinition($scope.foreignSourceDef).then( function() { // success growl.success('The definition for the requisition ' + $scope.foreignSource + ' has been saved.'...
cwe
CWE-79
JavaScript
X){null!=X.shortcut&&900>n&&!mxClient.IS_IOS?O.firstChild.nextSibling.setAttribute("title",X.shortcut):m.apply(this,arguments)};var q=App.prototype.updateUserElement;App.prototype.updateUserElement=function(){q.apply(this,arguments);if(null!=this.userElement){var O=this.userElement;O.style.cssText="position:relative;ma...
cwe
CWE-94
JavaScript
main (int argc, char *argv[]) { struct gengetopt_args_info args_info; char *line = NULL; size_t linelen = 0; char *p, *r; uint32_t *q; unsigned cmdn = 0; int rc; setlocale (LC_ALL, ""); set_program_name (argv[0]); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); if (cmdline_parser (a...
cwe
CWE-125
Unknown
MagickExport MagickBooleanType InterpolatePixelInfo(const Image *image, const CacheView_ *image_view,const PixelInterpolateMethod method, const double x,const double y,PixelInfo *pixel,ExceptionInfo *exception) { MagickBooleanType status; double alpha[16], gamma; PixelInfo pixels[16]; reg...
cwe
CWE-190
C/C++
c+";"))}}),mxUtils.bind(this,function(){var n=null;A.getModel().beginUpdate();try{n=A.insertVertex(A.getDefaultParent(),null,c,A.snap(e),A.snap(g),1,1,"text;"+(k?"html=1;":"")),A.updateCellSize(n),A.fireEvent(new mxEventObject("textInserted","cells",[n]))}finally{A.getModel().endUpdate()}A.setSelectionCell(n)}))}else{c...
cwe
CWE-20
JavaScript
/* * Copyright (C) 2005-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "PlayListPLS.h" #include "PlayListFactory.h" #include "Util.h" #include "filesystem/File.h" #include "music/tags/Music...
cwe
CWE-120
C/C++
v8::Local<v8::Value> V8Debugger::generatorObjectLocation(v8::Local<v8::Object> object) { if (!enabled()) { NOTREACHED(); return v8::Null(m_isolate); } v8::Local<v8::Value> argv[] = { object }; v8::Local<v8::Value> location = callDebuggerMethod("getGeneratorObjectLocation", 1, argv...
cwe
CWE-79
C/C++
private function decryptContentEncryptionKey($private_key_or_secret) { switch ($this->header['alg']) { case 'RSA1_5': $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_PKCS1); $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key); ...
cwe
CWE-200
PHP
static void BenchmarkOpenCLDevices(MagickCLEnv clEnv) { MagickCLDevice device; MagickCLEnv testEnv; size_t i, j; testEnv=AcquireMagickCLEnv(); testEnv->library=openCL_library; testEnv->devices=(MagickCLDevice *) AcquireMagickMemory( sizeof(MagickCLDevice)); testEnv->number_devices=1...
cwe
CWE-476
Unknown
it "should reject non-whitelist extensions even if a valid extension is present" do @request.stubs(:request_extensions).returns [{ "oid" => "peach", "value" => "meh", "critical" => false }, ...
cwe
CWE-264
Ruby
__imlib_MergeUpdate(ImlibUpdate * u, int w, int h, int hgapmax) { ImlibUpdate *nu = NULL, *uu; struct _tile *t; int tw, th, x, y, i; int *gaps = NULL; /* if theres no rects to process.. return NULL */ if (!u) return NULL; tw = w >> TB; if (w & T...
cwe
CWE-119
Unknown
gif_get_lzw (GifContext *context) { guchar *dest, *temp; gint lower_bound, upper_bound; /* bounds for emitting the area_updated signal */ gboolean bound_flag; gint first_pass; /* bounds for emitting the area_updated signal */ gint v; if (context->frame == NULL) { context->frame = g_new (GdkPixbuf...
cwe
CWE-20
Unknown
/* * Copyright © 2001-2011 Stéphane Raimbault <stephane.raimbault@gmail.com> * * SPDX-License-Identifier: LGPL-2.1+ * * This library implements the Modbus protocol. * http://libmodbus.org/ */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdarg.h> #include <errno.h> #include <limits.h> #i...
cwe
CWE-125
C/C++
lambda_function_body( char_u **arg, typval_T *rettv, evalarg_T *evalarg, garray_T *newargs, garray_T *argtypes, int varargs, garray_T *default_args, char_u *ret_type) { int evaluate = (evalarg->eval_flags & EVAL_EVALUATE); garray_T *gap = &evalarg->eval_ga; garray_T *freeg...
cwe
CWE-416
C/C++
static int do_timer_create(clockid_t which_clock, struct sigevent *event, timer_t __user *created_timer_id) { const struct k_clock *kc = clockid_to_kclock(which_clock); struct k_itimer *new_timer; int error, new_timer_id; int it_id_set = IT_ID_NOT_SET; if (!kc) return -EINVAL; if (!kc->timer_create) re...
cwe
CWE-190
Unknown
static int smtp_command_parse_parameters(struct smtp_command_parser *parser) { const unsigned char *p, *mp; uoff_t max_size = (parser->auth_response ? parser->limits.max_auth_size : parser->limits.max_parameters_size); /* We assume parameters to match textstr (HT, SP, Printable US-ASCII). For command parame...
cwe
CWE-835
Unknown
from __future__ import unicode_literals from itertools import chain import re import string import six from xml.sax.saxutils import unescape import html5lib from html5lib.constants import ( entities, namespaces, prefixes, tokenTypes, ) try: from html5lib.constants import ReparseException except Im...
cwe
CWE-20
Python
static int http_read_stream(URLContext *h, uint8_t *buf, int size) { HTTPContext *s = h->priv_data; int err, new_location, read_ret; int64_t seek_ret; if (!s->hd) return AVERROR_EOF; if (s->end_chunked_post && !s->end_header) { err = http_read_header(h, &new_location); if (...
cwe
CWE-119
C/C++
private static void validate(final byte[] iv, final int authTagLength) throws JOSEException { if (ByteUtils.bitLength(iv) != IV_BIT_LENGTH) { throw new JOSEException(String.format("IV length of %d bits is required, got %d", IV_BIT_LENGTH, ByteUtils.bitLength(iv))); } if (authTagLength != AUTH_TAG_BIT_LEN...
cwe
CWE-345
Java
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This 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 Software Foundation; either version 2.1 of * th...
cwe
CWE-79
Java
static int netlbl_cipsov4_list(struct sk_buff *skb, struct genl_info *info) { int ret_val; struct sk_buff *ans_skb = NULL; u32 nlsze_mult = 1; void *data; u32 doi; struct nlattr *nla_a; struct nlattr *nla_b; struct cipso_v4_doi *doi_def; u32 iter; if (!info->attrs[NLBL_CIPSOV4_A_DOI]) { ret_val = -EINVAL; ...
cwe
CWE-416
Unknown
int cdc_parse_cdc_header(struct usb_cdc_parsed_header *hdr, struct usb_interface *intf, u8 *buffer, int buflen) { /* duplicates are ignored */ struct usb_cdc_union_desc *union_header = NULL; /* duplicates are not tolerated */ struct usb_cdc_header_desc *header = NULL; struct usb_cdc_ether_desc *ether ...
cwe
CWE-119
C/C++
/* * * Copyright 2017 Asylo 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 agree...
cwe
CWE-787
C/C++
static void get_xref_linear_skipped(FILE *fp, xref_t *xref) { int err; char ch, buf[256]; if (xref->start != 0) return; /* Special case (Linearized PDF with initial startxref at 0) */ xref->is_linear = 1; /* Seek to %%EOF */ if ((xref->end = get_next_eof(fp)) < 0) return; ...
cwe
CWE-835
Unknown
def fence_device_form(params, request, session) if not allowed_for_local_cluster(session, Permissions::READ) return 403, 'Permission denied' end @cur_resource = get_resource_by_id(params[:resource], get_cib_dom(session)) if @cur_resource.instance_of?(ClusterEntity::Primitive) and @cur_resource.stonith ...
cwe
CWE-384
Ruby
function main_parts($content) { qa_html_theme_base::main_parts($content); if( (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) and ($this->template=='question') and (qa_opt('useo_meta_editor_enable')) ){ $this->output('<div class="qa-widgets-main qa-widgets-main-low">'); $this->output('<form name="useo...
cwe
CWE-79
PHP
package com.salesmanager.shop.admin.model.merchant; import javax.validation.Valid; import java.util.ArrayList; import java.util.List; public class StoreLanding { @Valid private List<StoreLandingDescription> descriptions = new ArrayList<StoreLandingDescription>(); public void setDescriptions(List<StoreLandingDes...
cwe
CWE-639
Java
static int tight_compress_data(VncState *vs, int stream_id, size_t bytes, int level, int strategy) { z_streamp zstream = &vs->tight.stream[stream_id]; int previous_out; if (bytes < VNC_TIGHT_MIN_TO_COMPRESS) { vnc_write(vs, vs->tight.tight.buffer, vs->tight.tight.offs...
cwe
CWE-401
Unknown
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # 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 Foundation, either version ...
cwe
CWE-613
Python
static void ahash_def_finup_done1(struct crypto_async_request *req, int err) { struct ahash_request *areq = req->data; err = ahash_def_finup_finish1(areq, err); areq->base.complete(&areq->base, err); }
cwe
CWE-835
Unknown
zephyr_print(netdissect_options *ndo, const u_char *cp, int length) { struct z_packet z; const char *parse = (const char *) cp; int parselen = length; const char *s; int lose = 0; /* squelch compiler warnings */ z.kind = 0; z.class = 0; z.inst = 0; z.opcode = 0; z.sender = ...
cwe
CWE-125
C/C++
h2v1_merged_upsample_565D_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; register int y,...
cwe
CWE-476
Unknown
const std::string& get_tenant() const { ceph_assert(t != Wildcard); return u.tenant; }
cwe
CWE-617
Unknown
def _run_ssh(self, command, check_exit=True, attempts=1): if not self.sshpool: self.sshpool = utils.SSHPool(self.config.san_ip, self.config.san_ssh_port, self.config.ssh_conn_timeout, ...
cwe
CWE-78
Python
static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb) { if (sk->sk_backlog.len >= max(sk->sk_backlog.limit, sk->sk_rcvbuf << 1)) return -ENOBUFS; __sk_add_backlog(sk, skb); sk->sk_backlog.len += skb->truesize; return 0; }
cwe
CWE-400
Unknown
/**************************************** * Computer Algebra System SINGULAR * ****************************************/ /* * ABSTRACT: Singular debugger */ #include "kernel/mod2.h" #include "omalloc/omalloc.h" #include "misc/options.h" #include "reporter/si_signals.h" #include "Singular/tok.h" #include "Singular...
cwe
CWE-269
C/C++
/* Copyright 2015 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-476
Python
f_pyeval(typval_T *argvars, typval_T *rettv) { char_u *str; char_u buf[NUMBUFLEN]; if (p_pyx == 0) p_pyx = 2; str = tv_get_string_buf(&argvars[0], buf); do_pyeval(str, rettv); }
cwe
CWE-78
Unknown
BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out) { int x, y, c, b, sx, sy, p; char *name, *f; size_t i, l; name = file_name; if ((f = strrchr(name, '/')) != NULL) name = f+1; if ((f = strrchr(name, '\\')) != NULL) name = f+1; name = strdup(name); if ((f = strrchr(name, ...
cwe
CWE-787
Unknown
/* Legal Notice: Some portions of the source code contained in this file were derived from the source code of TrueCrypt 7.1a, which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0, also from the source code of Encryption for the Masses 2.02a, which is ...
cwe
CWE-119
C/C++
static int post_msg(struct pptp_conn_t *conn, void *buf, int size) { int n; if (conn->out_size) { log_error("pptp: buffer is not empty\n"); return -1; } again: n=write(conn->hnd.fd, buf, size); if (n < 0) { if (errno == EINTR) goto again; else if (errno == EAGAIN) n = 0; else { if (errno != EPI...
cwe
CWE-787
Unknown
public Response attachTaskFile(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest request) { ICourse course = CoursesWebService.loadCourse(courseId); CourseEditorTreeNode parentNode = getParentNode(course, nodeId); if(course == null) { return Response.serv...
cwe
CWE-22
Java
constructor (p, opt) { opt = opt || {} super(opt) if (typeof p !== 'string') throw new TypeError('path is required') this.path = p // suppress atime, ctime, uid, gid, uname, gname this.portable = !!opt.portable // until node has builtin pwnam functions, this'll have to do this.myui...
cwe
CWE-22
JavaScript
gdk_pixbuf__tiff_image_load (FILE *f, GError **error) { return gdk_pixbuf__tiff_image_load_real (f, NULL, error); }
cwe
CWE-20
Unknown
package io.onedev.server.web.component.markdown; import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Hash...
cwe
CWE-74
Java
predicate_parse(const char *str, int nr_parens, int nr_preds, parse_pred_fn parse_pred, void *data, struct filter_parse_error *pe) { struct prog_entry *prog_stack; struct prog_entry *prog; const char *ptr = str; char *inverts = NULL; int *op_stack; int *top; int invert = 0; int ret = -ENOMEM; int len; int...
cwe
CWE-787
C/C++
nonComputedMember: function(left, right) { var SAFE_IDENTIFIER = /^[$_a-zA-Z][$_a-zA-Z0-9]*$/; var UNSAFE_CHARACTERS = /[^$_a-zA-Z0-9]/g; if (SAFE_IDENTIFIER.test(right)) { return left + '.' + right; } else { return left + '["' + right.replace(UNSAFE_CHARACTERS, this.stringEscapeFn) + '"]';...
cwe
CWE-74
JavaScript
int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, const unsigned char *from, int flen, int num, const unsigned char *param, int plen) { int i, dblen, mlen = -1; const unsigned char *maskeddb; int lzero; unsigned char *db = NULL, seed[SHA_DIGEST_LENGTH], phash[SHA_DIGEST_LENGTH]; unsigned char *padde...
cwe
CWE-310
Unknown
int64_t address_space_cache_init(MemoryRegionCache *cache, AddressSpace *as, hwaddr addr, hwaddr len, bool is_write) { AddressSpaceDispatch *d; hwaddr l; MemoryRegion *mr; ...
cwe
CWE-787
Unknown
static TfLiteStatus InitTemporaryTensors(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); // The prepare function may be executed multiple times. But temporary tensors // only need to be initiated once. if (data->fft_...
cwe
CWE-125
C/C++
Response StorageHandler::UntrackCacheStorageForOrigin( const std::string& origin) { if (!process_) return Response::InternalError(); GURL origin_url(origin); if (!origin_url.is_valid()) return Response::InvalidParams(origin + " is not a valid URL"); BrowserThread::PostTask( BrowserThread...
cwe
CWE-20
C/C++
const char * util_acl_to_str(const sc_acl_entry_t *e) { static char line[80], buf[20]; unsigned int acl; if (e == NULL) return "N/A"; line[0] = 0; while (e != NULL) { acl = e->method; switch (acl) { case SC_AC_UNKNOWN: return "N/A"; case SC_AC_NEVER: return "NEVR"; case SC_AC_NONE: return "N...
cwe
CWE-119
C/C++
function onPaste(event) { var editor = event.listenerData && event.listenerData.editor; var $event = event.data.$; var clipboardData = $event.clipboardData; var found = false; var imageType = /^image/; if (!clipboardData) { return; } return Array.prototype.forEach.call(clipboardData.types, function (type, i)...
cwe
CWE-434
JavaScript
/* * Copyright (C) 2014 Daniel-Constantin Mierla (asipto.com) * * This file is part of kamailio, a free SIP server. * * Kamailio 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 Foundation; either version 2 of the L...
cwe
CWE-787
C/C++
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre, Romain Bouqueau, Cyril Concolato * Copyright (c) Telecom ParisTech 2000-2012 * All rights reserved * * This file is part of GPAC / Media Tools sub-project * * GPAC is free software; you can redistribute it and/or modify * it unde...
cwe
CWE-119
C/C++
- (NSString *) _cardStringWithLabel: (NSString *) label value: (NSString *) value url: (NSString *) url { NSMutableString *cardString; cardString = [NSMutableString stringWithCapacity: 80]; value = [value stringByReplacingString: @"\r" withString: @""...
cwe
CWE-79
Objective-C
int size() const { return m_str ? m_str->size() : 0; }
cwe
CWE-787
C/C++
int main(int argc, char **argv) #endif { #ifdef __EMX__ /* OS/2 */ _wildcard (&argc, &argv); #endif int verify_only = 0, error_count = 0, add_extension = 0, output_spec = 0, c_count = 0, x_count = 0; char outpath, **matches = NULL, *outfilename = NULL, **argv_fn = NULL, selfname [PATH_MAX]; int use_stdi...
cwe
CWE-703
C/C++
/*** x509 modules for lua-openssl binding create and manage x509 certificate @module x509 @usage x509 = require'openssl'.x509 */ #include "openssl.h" #include "private.h" #define CRYPTO_LOCK_REF #include "sk.h" #define MYNAME "x509" #define MYVERSION MYNAME " library for " LUA_VERSION " / Nov 2014 / "\ "based ...
cwe
CWE-295
C/C++
vips_tracked_malloc( size_t size ) { void *buf; vips_tracked_init(); /* Need an extra sizeof(size_t) bytes to track * size of this block. Ask for an extra 16 to make sure we don't break * alignment rules. */ size += 16; if( !(buf = g_try_malloc( size )) ) { #ifdef DEBUG g_assert_not_reac...
cwe
CWE-908
C/C++
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
cwe
CWE-20
Python
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "ESTreeIRGen.h" #include "llvh/ADT/StringSet.h" #include "llvh/Support/Debug.h" #include "llvh/Support/SaveAndRestore.h" ...
cwe
CWE-125
C/C++
void PrintPreviewUI::OnPrintPreviewRequest(int request_id) { g_print_preview_request_id_map.Get().Set(preview_ui_addr_str_, request_id); }
cwe
CWE-200
C/C++
package config import ( "crypto/rand" "fmt" "time" "github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/metrics" "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" "githu...
cwe
CWE-400
Go
void test_path_dotgit__dotgit_modules_symlink(void) { cl_assert_equal_b(true, git_path_isvalid(NULL, ".gitmodules", 0, GIT_PATH_REJECT_DOT_GIT_HFS|GIT_PATH_REJECT_DOT_GIT_NTFS)); cl_assert_equal_b(false, git_path_isvalid(NULL, ".gitmodules", S_IFLNK, GIT_PATH_REJECT_DOT_GIT_HFS)); cl_assert_equal_b(false, git_path_i...
cwe
CWE-20
Unknown
function start(config) { var host = conf.constant.host; if(config) conf.serv = config; function onRequest(request, response) { var frontUrl = ''; if(request.url === '/favicon.ico') return; for(var key in conf.serv) { if(request.headers.host.indexOf(key) !== -1) { host = conf.serv[key]; ...
cwe
CWE-22
JavaScript
static int _6502_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) { char addrbuf[64]; const int buffsize = sizeof (addrbuf) - 1; memset (op, '\0', sizeof (RAnalOp)); op->size = snes_op_get_size (1, 1, &snes_op[data[0]]); //snes-arch is similiar to nes/6502 op->addr = addr; op->type = R_ANAL_OP_T...
cwe
CWE-125
Unknown
/* * Copyright (c) 2012, Codename One and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Sof...
cwe
CWE-668
Java
napi_status napi_get_value_string_latin1(napi_env env, napi_value value, char* buf, size_t bufsize, size_t* result) { CHECK_ENV(env); CHECK_ARG(env, val...
cwe
CWE-191
Unknown
import { ParsePubSub } from './ParsePubSub'; import Parse from 'parse/node'; import logger from '../logger'; class ParseCloudCodePublisher { parsePublisher: Object; // config object of the publisher, right now it only contains the redisURL, // but we may extend it later. constructor(config: any = {}) { th...
cwe
CWE-200
JavaScript
int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time) { char *str; ASN1_TIME atm; long offset; char buff1[24], buff2[24], *p; int i, j; p = buff1; i = ctm->length; str = (char *)ctm->data; if (ctm->type == V_ASN1_UTCTIME) { if ((i < 11) || (i > 17)) return 0; ...
cwe
CWE-119
Unknown
/* $Id: upnpsoap.c,v 1.151 2018/03/13 10:32:53 nanard Exp $ */ /* vim: tabstop=4 shiftwidth=4 noexpandtab * MiniUPnP project * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ * (c) 2006-2018 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the d...
cwe
CWE-476
C/C++
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
cwe
CWE-22
Python
def self.setup_tmpl_folder begin tmpl_folder = Folder.where("folders.name='#{TMPL_ROOT}'").first rescue end if tmpl_folder.nil? # Setup initial template-folders folder = Folder.new folder.name = TMPL_ROOT folder.parent_id = 0 folder.owner_id = 0 folder.xtype = ...
cwe
CWE-89
Ruby
// Copyright 2015 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package repo import ( "fmt" "net/http" "net/url" "strings" "github.com/gogs/git-module" api "github.com/gogs/go-gogs-client" jsoniter "github.com/jso...
cwe
CWE-918
Go
public function html() { switch( $this->type ) { case FILE_ADDED: $t_string = 'timeline_issue_file_added'; break; case FILE_DELETED: $t_string = 'timeline_issue_file_deleted'; break; default: throw new ServiceException( 'Unknown Event Type', ERROR_GENERIC ); } $t_bug_link = string_ge...
cwe
CWE-79
PHP
static int atusb_get_and_show_build(struct atusb *atusb) { struct usb_device *usb_dev = atusb->usb_dev; char build[ATUSB_BUILD_SIZE + 1]; int ret; ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0), ATUSB_BUILD, ATUSB_REQ_FROM_DEV, 0, 0, build, ATUSB_BUILD_SIZE, 1000); if (ret >= 0) { build[ret]...
cwe
CWE-119
C/C++
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...
cwe
CWE-20
Unknown
function(){A()}),1E3)});mxEvent.addListener(q,"click",mxUtils.bind(this,function(L){var M=mxEvent.getSource(L);M!=v&&M!=x?(null!=g&&g(),A(),mxEvent.consume(L)):z()}));window.setTimeout(mxUtils.bind(this,function(){mxUtils.setPrefixedStyle(q.style,"transform","translate(-50%,0%)")}),500);window.setTimeout(z,3E4);m=!0}re...
cwe
CWE-20
JavaScript
protected function _joinPath($dir, $name) { return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name; }
cwe
CWE-78
PHP
static MagickBooleanType SkipDXTMipmaps(Image *image,DDSInfo *dds_info, int texel_size,ExceptionInfo *exception) { register ssize_t i; MagickOffsetType offset; size_t h, w; /* Only skip mipmaps for textures and cube maps */ if (EOFBlob(image) != MagickFalse) { ThrowFileExc...
cwe
CWE-399
Unknown
folly::Optional<TLSMessage> PlaintextReadRecordLayer::read( folly::IOBufQueue& buf) { while (true) { folly::io::Cursor cursor(buf.front()); if (buf.empty() || !cursor.canAdvance(kPlaintextHeaderSize)) { return folly::none; } TLSMessage msg; msg.type = static_cast<ContentType>(cursor.re...
cwe
CWE-131
C/C++
void Compute(OpKernelContext* const context) override { // node_id_range const Tensor* node_id_range_t; OP_REQUIRES_OK(context, context->input("node_id_range", &node_id_range_t)); OP_REQUIRES( context, node_id_range_t->dims() == 1, errors::InvalidArgument("node_id_range must be a rank 1 ...
cwe
CWE-824
C/C++
'use strict' const BB = require('bluebird') const stat = BB.promisify(require('graceful-fs').stat) const gentlyRm = BB.promisify(require('../../utils/gently-rm.js')) const correctMkdir = BB.promisify(require('../../utils/correct-mkdir')) const moduleStagingPath = require('../module-staging-path.js') const move = requ...
cwe
CWE-732
JavaScript
/* * Copyright (c) 2019 HAW Hamburg * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup sys_clif * @{ * * @file * @brief CoRE Link format encoding and decoding li...
cwe
CWE-120
C/C++
def main(_): # Create a dummy dataset. num_examples = 8 steps_per_epoch = 2 input_dims = 3 output_dims = 1 xs = np.zeros([num_examples, input_dims]) ys = np.zeros([num_examples, output_dims]) dataset = tf.data.Dataset.from_tensor_slices( (xs, ys)).repeat(num_examples).batch(int(num_examples / step...
cwe
CWE-377
Python
static int asn1_template_noexp_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_TEMPLATE *tt, char opt, ASN1_TLC *ctx) { int flags, aclass; int ret; ASN1_VALUE *tval; const unsign...
cwe
CWE-674
Unknown
/* * Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved. * Original author: Edmund Wagner * Creation date: 22.05.2007 * * Source: $HeadURL$ * Last changed: $LastChangedDate$ * * the unrar licence applies to all junrar source and binary distributions * you are not allowed to use this source to...
cwe
CWE-835
Java
/* * Copyright (c) 2012, Codename One and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Sof...
cwe
CWE-668
Java
public boolean isValid(String value, ConstraintValidatorContext context) { if (StringUtils.isEmpty(value)) { return true; } try { Pattern.compile(value); return true; } catch (Exception ex) { String errorMessage = String.format("URL parameter '%s' is not a valid ...
cwe
CWE-74
Java