code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
static int kvaser_usb_leaf_set_opt_mode(const struct kvaser_usb_net_priv *priv) { struct kvaser_cmd *cmd; int rc; cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); if (!cmd) return -ENOMEM; cmd->id = CMD_SET_CTRL_MODE; cmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_ctrl_mode); cmd->u.ctrl_mode.tid = 0xff; cmd-...
cwe
CWE-200
Unknown
int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) { int mmu_reset_needed = 0; int i, pending_vec, max_bits; struct descriptor_table dt; vcpu_load(vcpu); dt.limit = sregs->idt.limit; dt.base = sregs->idt.base; kvm_x86_ops->set_idt(vcpu, &dt); dt.limit = sregs->gdt.limit; ...
cwe
CWE-476
Unknown
horizontalDifference16(unsigned short *ip, int n, int stride, unsigned short *wp, uint16 *From14) { register int r1, g1, b1, a1, r2, g2, b2, a2, mask; /* assumption is unsigned pixel values */ #undef CLAMP #define CLAMP(v) From14[(v) >> 2] mask = CODE_MASK; if (n >= stride) { if (stride == 3) { ...
cwe
CWE-787
C/C++
def process_form(): # see https://docs.python.org/3.4/library/cgi.html for the basic usage # here. form = cgi.FieldStorage() if "player1" not in form or "player2" not in form or "size" not in form: raise FormError("Invalid parameters.") player1 = form["player1"].value player2 = form["...
cwe
CWE-89
Python
static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb, struct net_device *dev, struct geneve_sock *gs6, struct flowi6 *fl6, const struct ip_tunnel_info *info) { bool use_cache = ip_tunnel_dst_cache_usable(skb, info); struct geneve_dev *geneve = netdev_priv(dev); struct dst_en...
cwe
CWE-319
Unknown
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor...
cwe
CWE-787
C/C++
static int pk_load_font(DviParams *unused, DviFont *font) { int i; int flag_byte; int loc, hic, maxch; Int32 checksum; FILE *p; #ifndef NODEBUG char s[256]; #endif long alpha, beta, z; font->chars = xnalloc(DviFontChar, 256); p = font->in; memzero(font->chars, 256 * sizeof(DviFontChar)); for(i = 0; i < 256;...
cwe
CWE-20
Unknown
OMX_ERRORTYPE SoftOpus::internalSetParameter( OMX_INDEXTYPE index, const OMX_PTR params) { switch ((int)index) { case OMX_IndexParamStandardComponentRole: { const OMX_PARAM_COMPONENTROLETYPE *roleParams = (const OMX_PARAM_COMPONENTROLETYPE *)params; if (strncmp((...
cwe
CWE-119
C/C++
import graphene import jwt from django.conf import settings from django.contrib.auth import password_validation from django.core.exceptions import ValidationError from django.db import transaction from ....account import events as account_events from ....account import models, notifications, search, utils from ....acc...
cwe
CWE-20
Python
static void renameColumnFunc( sqlite3_context *context, int NotUsed, sqlite3_value **argv ){ sqlite3 *db = sqlite3_context_db_handle(context); RenameCtx sCtx; const char *zSql = (const char*)sqlite3_value_text(argv[0]); const char *zDb = (const char*)sqlite3_value_text(argv[3]); const char *zTable = (co...
cwe
CWE-674
C/C++
void V8LazyEventListener::prepareListenerObject(ExecutionContext* executionContext) { if (!executionContext) return; v8::HandleScope handleScope(toIsolate(executionContext)); v8::Local<v8::Context> v8Context = toV8Context(executionContext, world()); if (v8Context.IsEmpty()) return; ...
cwe
CWE-17
C/C++
static GF_Err gf_media_export_filters(GF_MediaExporter *dumper) { char *args, szSubArgs[1024], szExt[30]; GF_Filter *file_out, *reframer, *remux=NULL, *src_filter; GF_FilterSession *fsess; GF_Err e = GF_OK; u32 codec_id=0; u32 sample_count=0; Bool skip_write_filter = GF_FALSE; Bool ext_forced = GF_FALSE; Bool ...
cwe
CWE-476
C/C++
def handle_meta(message, local, &callback) method = Channel.parse(message['channel'])[1] unless META_METHODS.include?(method) response = make_response(message) response['error'] = Faye::Error.channel_forbidden(message['channel']) response['successful'] = false return callbac...
cwe
CWE-287
Ruby
public static void square(int[] x, int xOff, int[] zz, int zzOff) { long x_0 = x[xOff + 0] & M; long zz_1; int c = 0, w; { int i = 4, j = 10; do { long xVal = (x[xOff + i--] & M); long p = xVal * xVal; ...
cwe
CWE-19
Java
cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, char *mount_data_global, const char *devname) { int rc; int xid; struct smb_vol *volume_info; struct cifsSesInfo *pSesInfo; struct cifsTconInfo *tcon; struct TCP_Server_Info *srvTcp; char *full_path; char *mount_data = mount_data_global; stru...
cwe
CWE-20
C/C++
/* * Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez 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 conditions are met: * * * Redistributions of source code must retain the above co...
cwe
CWE-190
C/C++
/* * mapi_attr.c -- Functions for handling MAPI attributes * * Copyright (C)1999-2006 Mark Simpson <damned@theworld.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 Foundation; either version 2...
cwe
CWE-787
C/C++
$(document).ready(function () { $('[data-toggle="tooltip"]').tooltip(); $("#apiResetForm").submit(function (e) { api.reset() .success(function (response) { user.api_key = response.data successFlash(response.message) $("#api_key").val(user.api_k...
cwe
CWE-79
Go
status_t Parcel::readUtf8FromUtf16(std::string* str) const { size_t utf16Size = 0; const char16_t* src = readString16Inplace(&utf16Size); if (!src) { return UNEXPECTED_NULL; } if (utf16Size == 0u) { str->clear(); return NO_ERROR; } ssize_t utf8Size = utf16_to_utf8_length(src, utf16Siz...
cwe
CWE-264
C/C++
static int tcos_select_file(sc_card_t *card, const sc_path_t *in_path, sc_file_t **file_out) { sc_context_t *ctx; sc_apdu_t apdu; sc_file_t *file=NULL; u8 buf[SC_MAX_APDU_BUFFER_SIZE], pathbuf[SC_MAX_PATH_SIZE], *path = pathbuf; unsigned int i; int r, pathlen; assert(card != NULL && in_path != NUL...
cwe
CWE-415
Unknown
int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep, struct sctp_hmacalgo *hmacs) { int has_sha1 = 0; __u16 id; int i; /* Scan the list looking for unsupported id. Also make sure that * SHA1 is specified. */ for (i = 0; i < hmacs->shmac_num_idents; i++) { id = hmacs->shmac_idents[i]; if (SCTP_AUTH...
cwe
CWE-200
Unknown
/* __ __ _ * \ \ / /__ _ __ (_) ___ ___ * \ \/ / _ \ '_ \| |/ __/ _ \ * \ / __/ | | | | (_| __/ * \/ \___|_| |_|_|\___\___| * * * Copyright 2017-2022 Venice * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with ...
cwe
CWE-22
Java
import { FlowRouter } from 'meteor/ostrio:flow-router-extra' import './projectAccessRights.html' import { t, i18nReady } from '../../utils/i18n.js' import { validateEmail, getGlobalSetting, showToast, } from '../../utils/frontend_helpers' import Projects from '../../api/projects/projects.js' Template.projectAccessRi...
cwe
CWE-79
JavaScript
void PrintViewManager::RenderFrameDeleted( content::RenderFrameHost* render_frame_host) { if (render_frame_host == print_preview_rfh_) print_preview_state_ = NOT_PREVIEWING; PrintViewManagerBase::RenderFrameDeleted(render_frame_host); }
cwe
CWE-416
C/C++
/* * pcrypt - Parallel crypto wrapper. * * Copyright (C) 2009 secunet Security Networks AG * Copyright (C) 2009 Steffen Klassert <steffen.klassert@secunet.com> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * versio...
cwe
CWE-763
C/C++
find_file_name_in_path( char_u *ptr, int len, int options, long count, char_u *rel_fname) // file we are searching relative to { char_u *file_name; int c; # if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) char_u *tofree = NULL; if ((options & FNAME_INCL) && *curbuf->b_p_inex != NU...
cwe
CWE-122
Unknown
static int oidc_request_post_preserved_restore(request_rec *r, const char *original_url) { oidc_debug(r, "enter: original_url=%s", original_url); const char *method = "postOnLoad"; const char *script = apr_psprintf(r->pool, " <script type=\"text/javascript\">\n" " function str_decode(string)...
cwe
CWE-79
C/C++
/* Copyright 2019 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 ...
cwe
CWE-20
C/C++
/************************************************************************ * 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 void launch(OpKernelContext* context, const PoolParameters& params, const Tensor& grad_in, const Tensor& argmax, Tensor* grad_out, const bool include_batch_in_index) { const DeviceBase::CpuWorkerThreads& worker_threads = *(context->device()->tensorflow_cpu_wo...
cwe
CWE-125
C/C++
mem_log_init(const char* prog_name, const char *banner) { size_t log_name_len; char *log_name; if (__test_bit(LOG_CONSOLE_BIT, &debug)) { log_op = stderr; return; } if (log_op) fclose(log_op); log_name_len = 5 + strlen(prog_name) + 5 + 7 + 4 + 1; /* "/tmp/" + prog_name + "_mem." + PID + ".log" + '\0" */ ...
cwe
CWE-59
C/C++
static port::StatusOr<CudnnRnnSequenceTensorDescriptor> Create( GpuExecutor* parent, int max_seq_length, int batch_size, int data_size, cudnnDataType_t data_type) { CHECK_GT(max_seq_length, 0); int dims[] = {batch_size, data_size, 1}; int strides[] = {dims[1] * dims[2], dims[2], 1}; TensorDe...
cwe
CWE-20
Unknown
package com.salesmanager.shop.model.catalog.product.product.definition; import java.util.ArrayList; import java.util.List; import com.salesmanager.shop.model.catalog.category.ReadableCategory; import com.salesmanager.shop.model.catalog.manufacturer.ReadableManufacturer; import com.salesmanager.shop.model.catalog.prod...
cwe
CWE-639
Java
static const char *quote_arg(const char *arg) { /* count chars to quote */ int len = 0, n = 0; int force_quotes = 0; char *q, *d; const char *p = arg; if (!*p) force_quotes = 1; while (*p) { if (isspace(*p) || *p == '*' || *p == '?' || *p == '{' || *p == '\'') force_quotes = 1; else if (*p == '"') n++;...
cwe
CWE-20
Unknown
x[C].apply(this,arguments);null!=G&&B.push(G)}b.sidebar.showEntries(0<B.length?B.join(";"):"",A.checked);b.hideDialog()});g.className="geBtn gePrimaryBtn";f=document.createElement("div");f.style.marginTop="26px";f.style.textAlign="right"}b.editor.cancelFirst?(f.appendChild(n),f.appendChild(g)):(f.appendChild(g),f.appen...
cwe
CWE-94
JavaScript
/* quicklist.c - A doubly linked list of ziplists * * Copyright (c) 2014, Matt Stancliff <matt@genges.com> * 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...
cwe
CWE-680
C/C++
def login(self, provider=None, register=None): log.debug("Provider: {0}".format(provider)) if g.user is not None and g.user.is_authenticated: log.debug("Already authenticated {0}".format(g.user)) return redirect(self.appbuilder.get_url_for_index) if provider is None: ...
cwe
CWE-601
Python
/* nbdkit * Copyright (C) 2013-2019 Red Hat Inc. * * 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 the above copyright * notice, this list of conditions and the f...
cwe
CWE-617
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 n...
cwe
CWE-668
Java
void Compute(OpKernelContext* context) override { const Tensor& input_sizes = context->input(0); const Tensor& filter = context->input(1); const Tensor& out_backprop = context->input(2); TensorShape input_shape; OP_REQUIRES_OK(context, Conv2DBackpropComputeInputShape(input_sizes,...
cwe
CWE-369
Unknown
addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr) { static const XML_Char xmlNamespace[] = {ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, ...
cwe
CWE-668
C/C++
static int rawsock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) { int noblock = flags & MSG_DONTWAIT; struct sock *sk = sock->sk; struct sk_buff *skb; int copied; int rc; pr_debug("sock=%p sk=%p len=%zu flags=%d\n", sock, sk, len, flags); skb = skb_recv_data...
cwe
CWE-269
Unknown
int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf) { struct sockaddr_in6 *sin6 = NULL; struct sockaddr_in *sin = NULL; int len; switch (addr->ss_family) { case AF_INET: sin = (struct sockaddr_in *)addr; break; case AF_INET6: sin6 = (struct sockaddr_in6 ...
cwe
CWE-787
Unknown
OMX_ERRORTYPE omx_video::use_input_buffer( OMX_IN OMX_HANDLETYPE hComp, OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr, OMX_IN OMX_U32 port, OMX_IN OMX_PTR appData, OMX_IN OMX_U32 bytes, OMX_IN OMX_U8* ...
cwe
CWE-200
C/C++
void hfi1_mmu_rb_evict(struct mmu_rb_handler *handler, void *evict_arg) { struct mmu_rb_node *rbnode, *ptr; struct list_head del_list; unsigned long flags; bool stop = false; INIT_LIST_HEAD(&del_list); spin_lock_irqsave(&handler->lock, flags); list_for_each_entry_safe_reverse(rbnode, ptr, &handler->lru_list, ...
cwe
CWE-416
Unknown
/* * 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
function updateLabel() { label.innerHTML = ''; label.style.cursor = 'pointer'; label.style.whiteSpace = 'nowrap'; label.style.textOverflow = 'ellipsis'; mxUtils.write(label, (entry.title != null && entry.title.length > 0) ? entry.title : mxResources.get('untitled')); ...
cwe
CWE-94
JavaScript
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; import { mainPage } from "../../support/page_objects/mainPage"; export const genTest = (apiType, dbType) => { if (!isTestSuiteActive(apiType, dbType)) return; describe(`${apiType.toUpperCase()} api - Lock view`, () => { /...
cwe
CWE-400
JavaScript
public function sdm_save_other_details_meta_data($post_id) { // Save Statistics Upload metabox if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (!isset($_POST['sdm_other_details_nonce_check']) || !wp_verify_nonce($_POST['sdm_other_details_nonce_check'], 'sdm_other_details_nonce')) { return;...
cwe
CWE-79
PHP
static struct dentry *aio_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { static const struct dentry_operations ops = { .d_dname = simple_dname, }; return mount_pseudo(fs_type, "aio:", NULL, &ops, AIO_RING_MAGIC); }
cwe
CWE-264
C/C++
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2000-2021 * All rights reserved * * This file is part of GPAC / mp4box application * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General P...
cwe
CWE-401
C/C++
import dayjs from 'dayjs' import utc from 'dayjs/plugin/utc' import { FlowRouter } from 'meteor/ostrio:flow-router-extra' import { saveAs } from 'file-saver' import { NullXlsx } from '@neovici/nullxlsx' import './dailytimetable.html' import './pagination.js' import './limitpicker.js' import { getGlobalSetting, numb...
cwe
CWE-1236
JavaScript
static int cac_get_serial_nr_from_CUID(sc_card_t* card, sc_serial_number_t* serial) { cac_private_data_t * priv = CAC_DATA(card); SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_NORMAL); if (card->serialnr.len) { *serial = card->serialnr; SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL...
cwe
CWE-415
Unknown
/* * Copyright 2004-present Facebook, 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 a...
cwe
CWE-755
C/C++
/** * OLAT - Online Learning and Training<br> * http://www.olat.org * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unl...
cwe
CWE-22
Java
void color_sycc_to_rgb(opj_image_t *img) { if(img->numcomps < 3) { img->color_space = OPJ_CLRSPC_GRAY; return; } if((img->comps[0].dx == 1) && (img->comps[1].dx == 2) && (img->comps[2].dx == 2) && (img->comps[0].dy == 1) && (img->comps[1].dy == 2) && (img->comps[2].dy == 2))/* horizontal and vertical sub-...
cwe
CWE-125
C/C++
void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a) { BN_ULONG t[16]; bn_sqr_normal(r,a,8,t); }
cwe
CWE-310
Unknown
unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf, unsigned char *limit, int *al) { int extdatalen = 0; unsigned char *orig = buf; unsigned char *ret = buf; #ifndef OPENSSL_NO_NEXTPROTONEG int next_proto_neg_seen; #endif #ifndef OPENSSL_NO_EC ...
cwe
CWE-20
Unknown
atm_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { u_int caplen = h->caplen; u_int length = h->len; uint32_t llchdr; u_int hdrlen = 0; if (caplen < 1 || length < 1) { ND_PRINT((ndo, "%s", tstr)); return (caplen); } /* Cisco Style NLPID ? */ if ...
cwe
CWE-787
Unknown
function sendTestEmail(){var o=[];$.each($("#headersTable").DataTable().rows().data(),function(e,a){o.push({key:unescapeHtml(a[0]),value:unescapeHtml(a[1])})});var e={template:{},first_name:$("input[name=to_first_name]").val(),last_name:$("input[name=to_last_name]").val(),email:$("input[name=to_email]").val(),position:...
cwe
CWE-79
JavaScript
Grocy.Components.ProductPicker = {}; Grocy.Components.ProductPicker.GetPicker = function() { return $('#product_id'); } Grocy.Components.ProductPicker.GetInputElement = function() { return $('#product_id_text_input'); } Grocy.Components.ProductPicker.GetValue = function() { return $('#product_id').val(); } Grocy...
cwe
CWE-79
JavaScript
get_user_var_name(expand_T *xp, int idx) { static long_u gdone; static long_u bdone; static long_u wdone; static long_u tdone; static int vidx; static hashitem_T *hi; hashtab_T *ht; if (idx == 0) { gdone = bdone = wdone = vidx = 0; tdone = 0; } // Global variables i...
cwe
CWE-476
Unknown
void Compute(OpKernelContext* ctx) override { const Tensor& shape_t = ctx->input(0); const Tensor& alpha_t = ctx->input(1); OP_REQUIRES(ctx, TensorShapeUtils::IsVector(shape_t.shape()) && (shape_t.dtype() == DataType::DT_INT32 || shape_t.dtype() == D...
cwe
CWE-197
Unknown
int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode, struct ext4_xattr_info *i, struct ext4_xattr_ibody_find *is) { struct ext4_xattr_ibody_header *header; struct ext4_xattr_search *s = &is->s; int error; if (EXT4_I(inode)->i_extra_isize == 0) return -ENOSPC; error = ext4_xattr_set_ent...
cwe
CWE-787
Unknown
void FoFiType1::parse() { char *line, *line1, *p, *p2; char buf[256]; char c; int n, code, i, j; char *tokptr; for (i = 1, line = (char *)file; i <= 100 && line && (!name || !encoding); ++i) { if (!name && !strncmp(line, "/FontName", 9)) { strncpy(buf, line, 255); buf[255] = ...
cwe
CWE-20
C/C++
buffer_add_range(int fd, struct evbuffer *evb, struct range *range) { char buf[BUFSIZ]; size_t n, range_sz; ssize_t nread; if (lseek(fd, range->start, SEEK_SET) == -1) return (0); range_sz = range->end - range->start + 1; while (range_sz) { n = MINIMUM(range_sz, sizeof(buf)); if ((nread = read(fd, buf, n)) ...
cwe
CWE-770
C/C++
vhost_scsi_send_evt(struct vhost_scsi *vs, struct vhost_scsi_tpg *tpg, struct se_lun *lun, u32 event, u32 reason) { struct vhost_scsi_evt *evt; evt = vhost_scsi_allocate_evt(vs, event, reason); if (!evt) return; if (tpg && lun) { /* TODO: share lun setup code with virtio-scsi.ko */ /* ...
cwe
CWE-200
Unknown
TfLiteStatus EvalHashtableImport(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input_resource_id_tensor = GetInput(context, node, kInputResourceIdTensor); const int resource_id = input_resource_id_tensor->data.i32[0]; const TfLiteTensor* key_tensor = GetInput(context, node, kKeyTensor); ...
cwe
CWE-787
C/C++
package oidc import ( "context" "fmt" "net/http" "strings" gooidc "github.com/coreos/go-oidc" log "github.com/sirupsen/logrus" "golang.org/x/oauth2" ) // Provider is a wrapper around go-oidc provider to also provide the following features: // 1. lazy initialization/querying of the provider // 2. automatic det...
cwe
CWE-863
Go
def self.get_childs(klass, node_id, recursive, ret_obj) SqlHelper.validate_token([node_id]) array = [] if recursive tree = klass.get_tree(Hash.new, nil, node_id) return array if tree.nil? tree.each do |parent_id, childs| if ret_obj array |= childs else ...
cwe
CWE-89
Ruby
static int snd_pcm_hw_free(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime; int result; if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; runtime = substream->runtime; snd_pcm_stream_lock_irq(substream); switch (runtime->status->state) { case SNDRV_PCM_STATE_SETUP: case SNDRV_PCM_STATE_...
cwe
CWE-125
Unknown
NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s) { static const char module[] = "NeXTDecode"; unsigned char *bp, *op; tmsize_t cc; uint8* row; tmsize_t scanline, n; (void) s; /* * Each scanline is assumed to start off as all * white (we assume a PhotometricInterpretation * of ``min-is-black''). ...
cwe
CWE-119
Unknown
func LoadAll(basedir string) ([]*Plugin, error) { plugins := []*Plugin{} // We want basedir/*/plugin.yaml scanpath := filepath.Join(basedir, "*", PluginFileName) matches, err := filepath.Glob(scanpath) if err != nil { return plugins, err } if matches == nil { return plugins, nil } for _, yaml := range ma...
cwe
CWE-20
Go
__u32 secure_ip_id(__be32 daddr) { struct keydata *keyptr; __u32 hash[4]; keyptr = get_keyptr(); /* * Pick a unique starting offset for each IP destination. * The dest ip address is placed in the starting vector, * which is then hashed with random data. */ hash[0] = (__force __u32)daddr; hash[1] = ke...
cwe
CWE-703
Unknown
package io.onedev.server.product; import java.util.EnumSet; import javax.inject.Inject; import javax.servlet.DispatcherType; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; import org.apache.shiro.web.env.EnvironmentLoader; import org.apache.shiro.web.env.EnvironmentLoaderL...
cwe
CWE-552
Java
void Compute(OpKernelContext* const context) override { // node_ids. const Tensor* node_ids_t; OP_REQUIRES_OK(context, context->input("node_ids", &node_ids_t)); const auto node_ids = node_ids_t->vec<int32>(); // gradients. const Tensor* gradients_t; OP_REQUIRES_OK(context, context->input("g...
cwe
CWE-476
Unknown
static ssize_t aio_setup_single_vector(struct kiocb *kiocb, int rw, char __user *buf, unsigned long *nr_segs, size_t len, struct iovec *iovec) { if (unlikely(!access_ok(!rw, buf, len))) return -EFAULT; iovec->iov_base = buf; iovec->iov_len = len; *nr_segs = 1...
cwe
CWE-703
C/C++
static gint conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf) { const guchar *in = inbuf; guchar *out = outbuf; JISState state = JIS_ASCII; while (*in != '\0') { if (IS_ASCII(*in)) { K_OUT(); *out++ = *in++; } else if (iseuckanji(*in)) { if (iseuckanji(*(in + 1))) { K_IN(); *out++ ...
cwe
CWE-119
Unknown
package configserver import ( "crypto/sha256" "encoding/base64" "encoding/json" "fmt" "net/http" "strings" "time" v3 "github.com/rancher/rancher/pkg/apis/management.cattle.io/v3" "github.com/rancher/rancher/pkg/controllers/provisioningv2/rke2" capicontrollers "github.com/rancher/rancher/pkg/generated/contro...
cwe
CWE-331
Go
def get_auth_teams Log.add_info(request, params.inspect) begin @folder = Folder.find(params[:id]) rescue @folder = nil end target_user_id = (@login_user.admin?(User::AUTH_TEAM))?(nil):(@login_user.id) @teams = Team.get_for(target_user_id, true) session[:folder_id] = params[:id...
cwe
CWE-89
Ruby
/* * 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
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None): result = super(TagFormWidget, self).create_option( name=name, value=value, label=label, selected=selected, index=index, subindex=subindex, attrs=attrs ) result['attrs']['data-color']...
cwe
CWE-79
Python
void CreateNgrams(const tstring* data, tstring* output, int num_ngrams, int ngram_width) const { for (int ngram_index = 0; ngram_index < num_ngrams; ++ngram_index) { int pad_width = get_pad_width(ngram_width); int left_padding = std::max(0, pad_width - ngram_index); int right_p...
cwe
CWE-787
Unknown
bool asn1_check_BOOLEAN(struct asn1_data *data, bool v) { uint8_t b = 0; asn1_read_uint8(data, &b); if (b != ASN1_BOOLEAN) { data->has_error = true; return false; } asn1_read_uint8(data, &b); if (b != v) { data->has_error = true; return false; } return !data->has_error; }
cwe
CWE-399
Unknown
static BROTLI_INLINE uint32_t GetInsertBase(uint16_t inscode) { return kInsBase[inscode]; }
cwe
CWE-120
Unknown
package api import ( "encoding/json" "fmt" ) type UserSettingKey string const ( // UserSettingLocaleKey is the key type for user locale. UserSettingLocaleKey UserSettingKey = "locale" // UserSettingAppearanceKey is the key type for user appearance. UserSettingAppearanceKey UserSettingKey = "appearance" // Use...
cwe
CWE-319
Go
static void bt_for_each(struct blk_mq_hw_ctx *hctx, struct blk_mq_bitmap_tags *bt, unsigned int off, busy_iter_fn *fn, void *data, bool reserved) { struct request *rq; int bit, i; for (i = 0; i < bt->map_nr; i++) { struct blk_align_bitmap *bm = &bt->map[i]; for (bit = find_first_bit(&bm->word, bm->depth); ...
cwe
CWE-264
Unknown
void caps_print_filter(pid_t pid) { EUID_ASSERT(); // in case the pid is that of a firejail process, use the pid of the first child process pid = switch_to_child(pid); // exit if no permission to join the sandbox check_join_permission(pid); uint64_t caps = extract_caps(pid); int i; uint64_t mask; int elems ...
cwe
CWE-94
Unknown
pub async fn run(&mut self) -> TResult<()> { loop { // Take the permit first, but we won't use it right now // that's why we will forget it self.base.climit.acquire().await.unwrap().forget(); let stream = self.accept().await?; let mut chandle = Connect...
cwe
CWE-252
Rust
static struct sock *dccp_v6_request_recv_sock(struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst) { struct inet6_request_sock *ireq6 = inet6_rsk(req); struct ipv6_pinfo *newnp, *np = inet6_sk(sk); struct inet_sock *newinet; struct dccp6_sock *newdp...
cwe
CWE-362
Unknown
get_html_data (MAPI_Attr *a) { VarLenData **body = XCALLOC(VarLenData*, a->num_values + 1); int j; for (j = 0; j < a->num_values; j++) { body[j] = XMALLOC(VarLenData, 1); body[j]->len = a->values[j].len; body[j]->data = CHECKED_XCALLOC(unsigned char, a->values[j].len); memmove (body[j]->data, a->va...
cwe
CWE-787
C/C++
# # Copyright © 2012–2022 Michal Čihař <michal@cihar.com> # # This file is part of Weblate <https://weblate.org/> # # 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 3 of the Licens...
cwe
CWE-79
Python
xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltStylePreCompPtr castedComp) { #ifdef XSLT_REFACTORED xsltStyleItemElementPtr comp = (xsltStyleItemElementPtr) castedComp; #else xsltStylePreCompPtr comp = castedComp; #endif xmlChar *prop = NULL; const xmlChar *name, *p...
cwe
CWE-119
C/C++
BaseShadow::log_except(const char *msg) { ShadowExceptionEvent event; bool exception_already_logged = false; if(!msg) msg = ""; sprintf(event.message, msg); if ( BaseShadow::myshadow_ptr ) { BaseShadow *shadow = BaseShadow::myshadow_ptr; event.recvd_bytes = shadow-...
cwe
CWE-134
C/C++
static int fuse_atomic_open(struct inode *dir, struct dentry *entry, struct file *file, unsigned flags, umode_t mode) { int err; struct fuse_conn *fc = get_fuse_conn(dir); struct dentry *res = NULL; if (d_in_lookup(entry)) { res = fuse_lookup(dir, entry, 0); if (IS_ERR(res)) return PTR_ERR(res...
cwe
CWE-459
Unknown
// Copyright 2018 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. // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix import ( "runtime" "unsafe" ) // ioctl itself should not be exposed direct...
cwe
CWE-287
Go
def get_current_node_name() stdout, stderror, retval = run_cmd( PCSAuth.getSuperuserSession, CRM_NODE, "-n" ) if retval == 0 and stdout.length > 0 return stdout[0].chomp() end return "" end
cwe
CWE-384
Ruby
/* * via parsing automaton * * Copyright (C) 2001-2003 FhG Fokus * * This file is part of opensips, a free SIP server. * * opensips 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 ...
cwe
CWE-908
C/C++
bool Webm2Pes::WritePesPacket(const VideoFrame& frame, PacketDataBuffer* packet_data) { if (frame.buffer().data.get() == nullptr || frame.buffer().length < 1) return false; Ranges frame_ranges; if (frame.codec() == VideoFrame::kVP9) { const bool has_superframe_index = ParseV...
cwe
CWE-125
Unknown
static void dispatch_message_real( Server *s, struct iovec *iovec, size_t n, size_t m, const ClientContext *c, const struct timeval *tv, int priority, pid_t object_pid) { char source_time[sizeof("_SOURCE_REALTIME_TI...
cwe
CWE-770
Unknown