code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
func generatePrivateKey(keyType string, keyBits int, container ParsedPrivateKeyContainer, entropyReader io.Reader) error { var err error var privateKeyType PrivateKeyType var privateKeyBytes []byte var privateKey crypto.Signer var randReader io.Reader = rand.Reader if entropyReader != nil { randReader = entrop...
cwe
CWE-326
Go
static int IntensityCompare(const void *x,const void *y) { PixelInfo *color_1, *color_2; ssize_t intensity; color_1=(PixelInfo *) x; color_2=(PixelInfo *) y; intensity=(ssize_t) (GetPixelInfoIntensity((const Image *) NULL,color_1)- GetPixelInfoIntensity((const Image *) NULL,color_2)); retu...
cwe
CWE-190
Unknown
static int encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct blkcipher_walk walk; struct crypto_blkcipher *tfm = desc->tfm; struct salsa20_ctx *ctx = crypto_blkcipher_ctx(tfm); int err; blkcipher_walk_init(&walk, dst, src, nbytes); err ...
cwe
CWE-20
C/C++
bool asn1_write_DATA_BLOB_LDAPString(struct asn1_data *data, const DATA_BLOB *s) { asn1_write(data, s->data, s->length); return !data->has_error; }
cwe
CWE-399
Unknown
static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); unsigned int i; if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) return rdesc; for (i = 0; i < *rsize - 4; i++) if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) {...
cwe
CWE-703
C/C++
TRIO_PRIVATE void TrioWriteString TRIO_ARGS5((self, string, flags, width, precision), trio_class_t* self, TRIO_CONST char* string, trio_flags_t flags, int width, int precision) { int length; int ch; assert(VALID(self)); asser...
cwe
CWE-125
C/C++
void jslTokenAsString(int token, char *str, size_t len) { // see JS_ERROR_TOKEN_BUF_SIZE if (token>32 && token<128) { assert(len>=4); str[0] = '\''; str[1] = (char)token; str[2] = '\''; str[3] = 0; return; } switch (token) { case LEX_EOF : strncpy(str, "EOF", len); return; case LEX_...
cwe
CWE-787
Unknown
void read_boot(DOS_FS * fs) { struct boot_sector b; unsigned total_sectors; unsigned short logical_sector_size, sectors; unsigned fat_length; unsigned total_fat_entries; off_t data_size; fs_read(0, sizeof(b), &b); logical_sector_size = GET_UNALIGNED_W(b.sector_size); if (!logical_se...
cwe
CWE-119
C/C++
/* * 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-22
Java
TfLiteStatus ReverseSequenceImpl(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); const TfLiteTensor* seq_lengths_tensor = GetInput(context, node, kSeqLengthsTensor); const TS* seq_lengths = GetTensorData<TS>(seq_lengths_tensor); auto* params ...
cwe
CWE-125
C/C++
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2); TfLiteTensor* output = GetOutput(context, node, kOut...
cwe
CWE-787
C/C++
void CoreUserInputHandler::handleSay(const BufferInfo &bufferInfo, const QString &msg) { if (bufferInfo.bufferName().isEmpty() || !bufferInfo.acceptsRegularMessages()) return; // server buffer QByteArray encMsg = channelEncode(bufferInfo.bufferName(), msg); #ifdef HAVE_QCA2 putPrivmsg(serverEncode...
cwe
CWE-399
Unknown
Status TrySimplify(NodeDef* consumer, string* simplified_node_name) override { NodeDef* producer; TF_RETURN_IF_ERROR(GetInputNode(consumer->input(0), &producer)); const bool producer_is_cast = IsCastLike(*producer); const bool can_optimize = !IsCheckNumerics(*producer) && ((producer_is_c...
cwe
CWE-476
C/C++
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package template import ( "bytes" "fmt" "html" "internal/godebug" "io" "text/template" "text/template/parse" ) // escapeTemplate rewrites the named tem...
cwe
CWE-74
Go
static void keyring_describe(const struct key *keyring, struct seq_file *m) { if (keyring->description) seq_puts(m, keyring->description); else seq_puts(m, "[anon]"); if (key_is_instantiated(keyring)) { if (keyring->keys.nr_leaves_on_tree != 0) seq_printf(m, ": %lu", keyring->keys.nr_leaves_on_tree); els...
cwe
CWE-20
C/C++
Get the key size of cipher */ PHP_FUNCTION(mcrypt_get_key_size) { char *cipher; char *module; int cipher_len, module_len; char *cipher_dir_string; char *module_dir_string; MCRYPT td; MCRYPT_GET_INI if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &cipher, &cipher_len, &module, &module_len) == F...
cwe
CWE-190
Unknown
xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { int len = 0, l; int c; int count = 0; #ifdef DEBUG nbParseNCNameComplex++; #endif /* * Handler for more complex cases */ GROW; c = CUR_CHAR(l); if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ (!xmlIsNameStartCha...
cwe
CWE-119
C/C++
/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * * Do ":help uganda" in Vim to read copying and usage conditions. * Do ":help credits" in Vim to see a list of people who contributed. * See README.txt for an overview of the Vim source code. */ /* * drawscreen.c: Code for updating all t...
cwe
CWE-122
C/C++
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]; } } var nowTemp = host.frondend + (request.url.replace('/', '') || host.bas...
cwe
CWE-22
JavaScript
buildRawGenesisTx(config: configBuildRawGenesisTx, type = 0x01) { if(config.mintReceiverSatoshis === undefined) config.mintReceiverSatoshis = new BigNumber(546); if(config.batonReceiverSatoshis === undefined) config.batonReceiverSatoshis = new BigNumber(546); // Make ...
cwe
CWE-20
JavaScript
package client import ( "encoding/json" "fmt" api "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/kubeedge/beehive/pkg/core/model" "github.com/kubeedge/kubeedge/edge/pkg/common/message" "github.com/kubeedge/kubeedge/edge/pkg/common/modules" "github.com/kubeedge/kubeedge/edge/pk...
cwe
CWE-476
Go
/* * 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-862
Java
/* * . .o8 oooo * .o8 "888 `888 * .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo * 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P' * 888 888 888 888 8...
cwe
CWE-190
JavaScript
query: codemirror_editor ? codemirror_editor.getValue() : $('#sqlquery').val(), database: db }, function (data) { var i; if (typeof data !== 'undefined' && data.success === true) { data = data.message; } if (data.error) { ...
cwe
CWE-79
JavaScript
std::string encodeBase64(const std::string& input) { using namespace boost::archive::iterators; using b64it = base64_from_binary<transform_width<const char*, 6, 8>>; auto data = input.data(); std::string encoded(b64it(data), b64it(data + (input.length()))); encoded.append((3 - (input.length() % 3)) % 3, '=')...
cwe
CWE-787
C/C++
static int protocol_client_init(VncState *vs, uint8_t *data, size_t len) { char buf[1024]; VncShareMode mode; int size; mode = data[0] ? VNC_SHARE_MODE_SHARED : VNC_SHARE_MODE_EXCLUSIVE; switch (vs->vd->share_policy) { case VNC_SHARE_POLICY_IGNORE: /* * Ignore the shared flag. ...
cwe
CWE-125
Unknown
static void show_entry(struct diff_options *opt, const char *prefix, struct tree_desc *desc, const char *base, int baselen) { unsigned mode; const char *path; const unsigned char *sha1 = tree_entry_extract(desc, &path, &mode); if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode)) { enum object_type type; ...
cwe
CWE-119
Unknown
static void nlmclnt_unlock_callback(struct rpc_task *task, void *data) { struct nlm_rqst *req = data; u32 status = ntohl(req->a_res.status); if (RPC_ASSASSINATED(task)) goto die; if (task->tk_status < 0) { dprintk("lockd: unlock failed (err = %d)\n", -task->tk_status); goto retry_rebind; } if (status == N...
cwe
CWE-703
Unknown
int main(int argc, const char **argv) { int force = 0; const char *stateFile = STATEFILE; const char *logFile = NULL; FILE *logFd = NULL; int rc = 0; int arg; const char **files; poptContext optCon; struct logInfo *log; struct poptOption options[] = { {"debug", 'd', 0, N...
cwe
CWE-732
Unknown
NTSTATUS check_reduced_name_with_privilege(connection_struct *conn, const char *fname, struct smb_request *smbreq) { NTSTATUS status; TALLOC_CTX *ctx = talloc_tos(); const char *conn_rootdir; size_t rootdir_len; char *dir_name = NULL; const char *last_component = NULL; char *resolved_name = NULL; char *sa...
cwe
CWE-264
Unknown
/* ** proc.c - Proc class ** ** See Copyright Notice in mruby.h */ #include <mruby.h> #include <mruby/class.h> #include <mruby/proc.h> #include <mruby/opcode.h> #include <mruby/data.h> #include <mruby/presym.h> #include <mruby/array.h> #include <mruby/hash.h> static const mrb_code call_iseq[] = { OP_CALL, }; stati...
cwe
CWE-476
C/C++
function T(t,e,n){for(var i=""+Math.abs(t),r=0<=t;i.length<e;)i="0"+i;return(r?n?"+":"":"-")+i}
cwe
CWE-1236
JavaScript
TfLiteStatus ResizeOutput(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); const TfLiteTensor* multipliers = GetInput(context, node, kInputMultipliers); const int num_dimensions = NumDi...
cwe
CWE-125
Unknown
accountsApi.update = function (req, res) { var username = req.params.username var postData = req.body if (!username || !postData) return apiUtil.sendApiError_InvalidPostData(res) let passwordUpdated = false async.series( { user: function (next) { User.getByUsername(username, function (err,...
cwe
CWE-521
JavaScript
null!=sa[ua]&&(ua=sa[ua]);ua={url:oa.getAttribute("url"),libs:oa.getAttribute("libs"),title:oa.getAttribute("title"),tooltip:oa.getAttribute("name")||oa.getAttribute("url"),preview:oa.getAttribute("preview"),clibs:ua,tags:oa.getAttribute("tags")};xa.push(ua);null!=ya&&(xa=za[wa],null==xa&&(xa={},za[wa]=xa),wa=xa[ya],nu...
cwe
CWE-20
JavaScript
void HeapObjectHeader::zapMagic() { ASSERT(checkHeader()); m_magic = zappedMagic; }
cwe
CWE-787
C/C++
""" This module defines a built-in contrib module that enables external files to be included within the slide. This is extremely useful when having source code displayed in a code block, and then running/doing something with the source data in a terminal on the same slide. """ from marshmallow import fields, Schema i...
cwe
CWE-78
Python
import asyncio import string from random import choice from typing import Optional import discord from redbot.core import Config, commands from redbot.core.i18n import Translator, cog_i18n _ = Translator("Roomer", __file__) @cog_i18n(_) class Roomer(commands.Cog): __version__ = "1.0.0" def format_help_for_...
cwe
CWE-287
Python
typeof fa.getAttribute&&null!=fa.getAttribute("title")&&sa.push({img:fa.getAttribute("img"),libs:fa.getAttribute("libs"),clibs:fa.getAttribute("clibs"),title:fa.getAttribute("title")}),fa=fa.nextSibling;F(sa)}});var ra=function(fa,ca,ba){la.style.display="";Ea.stop();W=!1;if(V)V=!1;else if(ca)aa.innerHTML=ca;else{ba=ba...
cwe
CWE-20
JavaScript
ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr, const char **elem_rtrn, const char **field_rtrn, ExprDef **index_rtrn) { switch (expr->expr.op) { case EXPR_IDENT: *elem_rtrn = NULL; *field_rtrn = xkb_atom_text(ctx, expr->ident.ident); *index_rtr...
cwe
CWE-476
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-197
C/C++
def get_mails if params[:action] == 'get_mails' Log.add_info(request, params.inspect) end if !params[:pop].nil? and params[:pop] == 'true' begin new_arrivals_h = {} mail_account_id = params[:mail_account_id] if mail_account_id.blank? mail_accounts = MailAccoun...
cwe
CWE-89
Ruby
void nsexec(void) { int pipenum; jmp_buf env; int sync_child_pipe[2], sync_grandchild_pipe[2]; struct nlconfig_t config = { 0 }; /* * If we don't have an init pipe, just return to the go routine. * We'll only get an init pipe for start or exec. */ pipenum = initpipe(); if (pipenum == -1) return; /* Pa...
cwe
CWE-78
Unknown
static void *__dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags, struct dma_attrs *attrs) { if (dev == NULL) { WARN_ONCE(1, "Use an actual device structure for DMA allocation\n"); return NULL; } if (IS_ENABLED(CONFIG_ZONE_DMA) && dev->coherent_dma_mask <= ...
cwe
CWE-200
C/C++
static int sony_init_ff(struct sony_sc *sc) { struct hid_input *hidinput = list_entry(sc->hdev->inputs.next, struct hid_input, list); struct input_dev *input_dev = hidinput->input; input_set_capability(input_dev, EV_FF, FF_RUMBLE); return input_ff_create_memless(input_dev, NULL, sony_play_effect); }
cwe
CWE-787
C/C++
/* * Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com> * Copyright (c) 2009-2012, Pieter Noordhuis <pcnoordhuis at gmail dot com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following condition...
cwe
CWE-190
C/C++
double64_init (SF_PRIVATE *psf) { static int double64_caps ; if (psf->sf.channels < 1) { psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ; return SFE_INTERNAL ; } ; double64_caps = double64_get_capability (psf) ; psf->blockwidth = sizeof (double) * psf->sf.channels ...
cwe
CWE-369
Unknown
/* * FreeRTOS Kernel V10.4.2 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * 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, includ...
cwe
CWE-190
C/C++
Response StorageHandler::TrackCacheStorageForOrigin(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::IO, FR...
cwe
CWE-20
C/C++
// imagew-jpeg.c // Part of ImageWorsener, Copyright (c) 2011 by Jason Summers. // For more information, see the readme.txt file. #include "imagew-config.h" #if IW_SUPPORT_JPEG == 1 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <setjmp.h> #include <jpeglib.h> #include <jerror...
cwe
CWE-119
C/C++
const fs = require('fs') const express = require('express') const ms = require('ms') // @ts-ignore const Grant = require('grant').express() const merge = require('lodash.merge') const cookieParser = require('cookie-parser') const interceptor = require('express-interceptor') const { isURL } = require('validator') const ...
cwe
CWE-863
JavaScript
function critere_where_dist($idb, &$boucles, $crit) { $boucle = &$boucles[$idb]; if (isset($crit->param[0])) { $_where = calculer_liste($crit->param[0], $idb, $boucles, $boucle->id_parent); } else { $_where = '@$Pile[0]["where"]'; } if ($crit->cond) { $_where = "(($_where) ? ($_where) : '')"; } if ($crit...
cwe
CWE-79
PHP
static void set_fdc(int drive) { if (drive >= 0 && drive < N_DRIVE) { fdc = FDC(drive); current_drive = drive; } if (fdc != 1 && fdc != 0) { pr_info("bad fdc value\n"); return; } set_dor(fdc, ~0, 8); #if N_FDC > 1 set_dor(1 - fdc, ~8, 0); #endif if (FDCS->rawcmd == 2) reset_fdc_info(1); if (fd_inb(FD_...
cwe
CWE-125
Unknown
virDomainDiskSourceFormatNetworkCookies(virBufferPtr buf, virStorageSourcePtr src) { g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf); size_t i; for (i = 0; i < src->ncookies; i++) { virBufferEscapeString(&childBuf, "<cookie name='%s'>", src->cookies[i...
cwe
CWE-212
Unknown
const entities = require('entities'); const cheerio = require('cheerio'); const { simplecc } = require('simplecc-wasm'); const got = require('@/utils/got'); const config = require('@/config').value; const RE2 = require('re2'); let mercury_parser; const resolveRelativeLink = ($, elem, attr, baseUrl) => { const $el...
cwe
CWE-79
JavaScript
function parse (pattern, isSub) { if (pattern.length > 1024 * 64) { throw new TypeError('pattern is too long') } var options = this.options // shortcuts if (!options.noglobstar && pattern === '**') return GLOBSTAR if (pattern === '') return '' var re = '' var hasMagic = !!options.nocase var esc...
cwe
CWE-400
JavaScript
/*- * Copyright 2014 Square Inc. * * 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...
cwe
CWE-326
Go
static void Ins_MIRP( INS_ARG ) { Int point, cvtEntry; TT_F26Dot6 cvt_dist, distance, cur_dist, org_dist; point = (Int)args[0]; cvtEntry = (Int)args[1]; /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */ if ( BOUNDS( arg...
cwe
CWE-125
Unknown
xmlParsePEReference(xmlParserCtxtPtr ctxt) { const xmlChar *name; xmlEntityPtr entity = NULL; xmlParserInputPtr input; if (RAW != '%') return; NEXT; name = xmlParseName(ctxt); if (name == NULL) { xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, "xmlParsePEReference: no name\n"); return; } if (RAW !...
cwe
CWE-611
C/C++
def _cli_run(self, verb, cli_args): """Runs a CLI command over SSH, without doing any result parsing.""" cli_arg_strings = [] if cli_args: for k, v in cli_args.items(): if k == '': cli_arg_strings.append(" %s" % k) else: ...
cwe
CWE-78
Python
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2017-2018 New Vector Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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 Licens...
cwe
CWE-79
Python
/* 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-787
Python
function tEnvoyNaClSigningKey(key, type = "secret", password = null, passwordProtected = [], tEnvoy = TogaTech.tEnvoy) { let _key; let _nonce; let _password; let _passwordProtected; let _type; let _assertPassword; let _getKey; let _setKey; let _getPassword; let _setPassword; let _tEnvoy = tEnvoy; let _nacl ...
cwe
CWE-347
JavaScript
/* Module for popovers that have been ported to the modern TippyJS/Popper popover library from the legacy Bootstrap popovers system in popovers.js. */ import $ from "jquery"; import {delegate} from "tippy.js"; import render_compose_control_buttons_popover from "../templates/compose_control_buttons_popover.hbs";...
cwe
CWE-79
JavaScript
static int bin_pe_parse_imports(RBinPEObj* pe, struct r_bin_pe_import_t** importp, int* nimp, const char* dll_name, PE_DWord OriginalFirstThunk, PE_DWord FirstThunk) { char import_name[PE_NAM...
cwe
CWE-400
C/C++
def on_save(self): connection = get_connection() cursor = connection.cursor() cursor.execute( f"insert into visitors (ip_address, user_agent, referrer, full_path, visit_time) values ('{self.ip_address}', '{self.user_agent}', '{self.referrer}', '{self.full_path}', '{self.visit_time}')...
cwe
CWE-89
Python
getTiledChunkOffsetTableSize(const Header& header) { // // Save the dataWindow information // const Box2i &dataWindow = header.dataWindow(); // // Precompute level and tile information. // int* numXTiles; int* numYTiles; int numXLevels; int numYLevels; precalculate...
cwe
CWE-125
Unknown
import dayjs from 'dayjs' import customParseFormat from 'dayjs/plugin/customParseFormat' import { t } from './i18n.js' import Projects from '../api/projects/projects.js' import projectUsers from '../api/users/users.js' import { periodToDates } from './periodHelpers.js' import { getGlobalSetting, getUserSetting } from '...
cwe
CWE-79
JavaScript
void qemu_chr_be_event(CharDriverState *s, int event) { /* Keep track if the char device is open */ switch (event) { case CHR_EVENT_OPENED: s->be_open = 1; break; case CHR_EVENT_CLOSED: s->be_open = 0; break; } if (!s->chr_event) r...
cwe
CWE-416
Unknown
rdpdr_process(STREAM s) { uint32 handle; uint16 vmin; uint16 component; uint16 pakid; logger(Protocol, Debug, "rdpdr_process()"); /* hexdump(s->p, s->end - s->p); */ in_uint16(s, component); in_uint16(s, pakid); if (component == RDPDR_CTYP_CORE) { switch (pakid) { case PAKID_CORE_DEVICE_IOREQU...
cwe
CWE-119
C/C++
func apiCallbacksFollow(w http.ResponseWriter, r *http.Request) { challenge := r.URL.Query().Get("hub.challenge") if challenge != "" { fmt.Fprint(w, challenge) return } body, err := ioutil.ReadAll(r.Body) if err != nil { panic(err) } var response followResponse err = json.Unmarshal(body, &response) if...
cwe
CWE-79
Go
dhcpv4_print(netdissect_options *ndo, const u_char *cp, u_int length, int indent) { u_int i, t; const u_char *tlv, *value; uint8_t type, optlen; i = 0; while (i < length) { tlv = cp + i; type = (uint8_t)tlv[0]; optlen = (uint8_t)tlv[1]; value = tlv...
cwe
CWE-125
C/C++
/* Copyright 2014 Alexander Okoli 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, software...
cwe
CWE-331
Go
#include "webcc/url.h" #include <algorithm> #include <cctype> #include <functional> #include "boost/algorithm/string/trim.hpp" #include "webcc/string.h" #include "webcc/utility.h" namespace webcc { // ----------------------------------------------------------------------------- namespace { // Convert a hex chara...
cwe
CWE-22
C/C++
void rose_start_t2timer(struct sock *sk) { struct rose_sock *rose = rose_sk(sk); del_timer(&rose->timer); rose->timer.function = rose_timer_expiry; rose->timer.expires = jiffies + rose->t2; add_timer(&rose->timer); }
cwe
CWE-416
Unknown
null!=this.linkHint&&(this.linkHint.style.visibility="")};var Za=mxEdgeHandler.prototype.destroy;mxEdgeHandler.prototype.destroy=function(){Za.apply(this,arguments);null!=this.linkHint&&(this.linkHint.parentNode.removeChild(this.linkHint),this.linkHint=null);null!=this.changeHandler&&(this.graph.getModel().removeListen...
cwe
CWE-20
JavaScript
/** * Copyright (c) 2010-2020 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse....
cwe
CWE-611
Java
static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc) { struct dentry *parent = desc->file->f_path.dentry; struct inode *dir = parent->d_inode; struct nfs_entry *entry = desc->entry; struct dentry *dentry, *alias; struct qstr name = { .name = entry->name, .len = entry->len, }; struct inode...
cwe
CWE-20
Unknown
/* * Copyright (C) 2012 Square, Inc. * * 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 agre...
cwe
CWE-22
Java
def self.validate_token(tokens, extra_chars=nil) extra_chars ||= [] regexp = Regexp.new("^\s*[a-zA-Z0-9_.#{extra_chars.join()}]+\s*$") [tokens].flatten.each do |token| next if token.blank? if token.to_s.match(regexp).nil? raise("[ERROR] SqlHelper.validate_token failed: #{token}") ...
cwe
CWE-89
Ruby
void yyerror(YYLTYPE *yylloc, void *scanner, struct yang_parameter *param, ...) { free(*param->value); if (yylloc->first_line != -1) { if (*param->data_node && (*param->data_node) == (*param->actual_node)) { LOGVAL(param->module->ctx, LYE_INSTMT, LY_VLOG_LYS, *param->data_node, yyget_text(scanner)); }...
cwe
CWE-415
Unknown
# Copyright 2014-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 law or agreed to in w...
cwe
CWE-74
Python
package eu.nimble.utility.validation; import com.fasterxml.jackson.core.type.TypeReference; import eu.nimble.utility.JsonSerializationUtility; import eu.nimble.utility.exception.AuthenticationException; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import org.apache.commons.codec.binary.Base64; import or...
cwe
CWE-290
Java
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */ /* * lsquic_parse_gquic_common.c -- Parsing functions common to GQUIC */ #include <assert.h> #include <errno.h> #include <inttypes.h> #include <string.h> #include <stdlib.h> #include <sys/queue.h> #ifndef WIN32 #include <sys/types.h> #else #in...
cwe
CWE-476
C/C++
/* * Performance events core code: * * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de> * Copyright (C) 2008-2011 Red Hat, Inc., Ingo Molnar * Copyright (C) 2008-2011 Red Hat, Inc., Peter Zijlstra * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com> * * For licensing details see kernel...
cwe
CWE-362
C/C++
package tuple import ( v0 "github.com/authzed/authzed-go/proto/authzed/api/v0" ) // ONRSet is a set of ObjectAndRelation's. type ONRSet struct { onrs map[string]*v0.ObjectAndRelation } // NewONRSet creates a new set. func NewONRSet(onrs ...*v0.ObjectAndRelation) *ONRSet { created := &ONRSet{ onrs: map[string]*v...
cwe
CWE-20
Go
static void endElementHandler(void *userData, const char *name) { userdata_t *ud = (userdata_t *) userData; if (strcmp(name, "graph") == 0) { pop_subg(); popString(&ud->elements); ud->closedElementType = TAG_GRAPH; } else if (strcmp(name, "node") == 0) { char *ele_name = topString(ud->elements); if (u...
cwe
CWE-476
Unknown
authzPretty( Syntax *syntax, struct berval *val, struct berval *out, void *ctx) { int rc; Debug( LDAP_DEBUG_TRACE, ">>> authzPretty: <%s>\n", val->bv_val, 0, 0 ); rc = authzPrettyNormal( val, out, ctx, 0 ); Debug( LDAP_DEBUG_TRACE, "<<< authzPretty: <%s> (%d)\n", out->bv_val, rc, 0 ); return rc; }
cwe
CWE-617
Unknown
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); TF_LITE_ENSURE_TY...
cwe
CWE-125
C/C++
public InputStream getResourceAsStream(String path) { return classLoader.getResourceAsStream(resourceRoot + path); }
cwe
CWE-552
Java
protected void onInitialize() { super.onInitialize(); container = new WebMarkupContainer("container"); container.setOutputMarkupId(true); add(container); WebMarkupContainer editLink = new WebMarkupContainer("editLink"); WebMarkupContainer splitLink = new WebMarkupContainer("splitLink"); WebMarkupCo...
cwe
CWE-74
JavaScript
/* * 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
file_check_mem(struct magic_set *ms, unsigned int level) { size_t len; if (level >= ms->c.len) { len = (ms->c.len += 20) * sizeof(*ms->c.li); ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ? emalloc(len) : erealloc(ms->c.li, len)); if (ms->c.li == NULL) { file_oomem(ms, len); return ...
cwe
CWE-119
C/C++
public SVNAuthentication createSVNAuthentication(String kind) { if(kind.equals(ISVNAuthenticationManager.SSL)) try { SVNSSLAuthentication authentication = new SVNSSLAuthentication( Base64.decode(certificate.getPlainText().toChar...
cwe
CWE-255
Java
function action_wireless(iface) luci.http.prepare_content("application/json") local bwc = io.popen("luci-bwc -r %q 2>/dev/null" % iface) if bwc then luci.http.write("[") while true do local ln = bwc:read("*l") if not ln then break end luci.http.write(ln) end luci.http.write("]") bwc:close() en...
cwe
CWE-78
Lua
static int cdrom_ioctl_media_changed(struct cdrom_device_info *cdi, unsigned long arg) { struct cdrom_changer_info *info; int ret; cd_dbg(CD_DO_IOCTL, "entering CDROM_MEDIA_CHANGED\n"); if (!CDROM_CAN(CDC_MEDIA_CHANGED)) return -ENOSYS; /* cannot select disc or select current disc */ if (!CDROM_CAN(CDC_SEL...
cwe
CWE-119
Unknown
ac_circ_buf_t *ac_circ_buf_new(u32 size, u32 elem_sz) { ac_circ_buf_t *cbuf; if (!is_pow2(size)) return NULL; cbuf = malloc(sizeof(ac_circ_buf_t)); cbuf->head = cbuf->tail = 0; cbuf->size = size; if (elem_sz == 0) { cbuf->elem_sz = 1; cbuf->type = PTR_BUF; cbuf->buf.ptr_buf = malloc(size * sizeof(void ...
cwe
CWE-190
C/C++
def GetActionAllowAnyone(f: GetRequest => Result): Action[Unit] = PlainApiAction(cc.parsers.empty, NoRateLimits, allowAnyone = true)(f)
cwe
CWE-613
Scala
function is_form_content_type(request) { return is_content_type(request, 'application/x-www-form-urlencoded', 'multipart/form-data'); }
cwe
CWE-352
JavaScript
int DecodeTeredo(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) { if (!g_teredo_enabled) return TM_ECODE_FAILED; uint8_t *start = pkt; /* Is this packet to short to contain an IPv6 packet ? */ if (len < IPV6_HEADER_LEN) return TM_ECODE_FA...
cwe
CWE-20
C/C++