code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static struct sock *dccp_v6_request_recv_sock(const struct sock *sk,
struct sk_buff *skb,
struct request_sock *req,
struct dst_entry *dst,
struct request_sock *req_unhash,
bool *own_req)
{
struct inet_request_sock *ireq = inet_rsk(req);
struct ipv6_pinfo *newnp;
... | cwe | CWE-416 | C/C++ |
bool MemFile::seek(int64_t offset, int whence /* = SEEK_SET */) {
assertx(m_len != -1);
if (whence == SEEK_CUR) {
if (offset > 0 && offset < bufferedLen()) {
setReadPosition(getReadPosition() + offset);
setPosition(getPosition() + offset);
return true;
}
offset += getPosition();
wh... | cwe | CWE-122 | C/C++ |
Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size) {
Error error;
Vector<uint8_t> pixels;
error = pixels.resize(p_pixel_size);
if (error != OK) {
return error;
}
uint8_t *pixels_w = pixels.ptrw();
size_t compres... | cwe | CWE-787 | Unknown |
////////////////////////////////////////////////////////////////////////////
// **** WAVPACK **** //
// Hybrid Lossless Wavefile Compressor //
// Copyright (c) 1998 - 2019 David Bryant. //
// ... | cwe | CWE-369 | C/C++ |
static int set_default_flags(int *flags)
{
if (((*flags) & IDN2_TRANSITIONAL) && ((*flags) & IDN2_NONTRANSITIONAL))
return IDN2_INVALID_FLAGS;
if (((*flags) & (IDN2_TRANSITIONAL|IDN2_NONTRANSITIONAL)) && ((*flags) & IDN2_NO_TR46))
return IDN2_INVALID_FLAGS;
if (!((*flags) & (IDN2_NO_TR46|IDN2_TRANSITION... | cwe | CWE-20 | Unknown |
static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
unsigned char
attributes,
tag[3];
Image
*image;
IndexPacket
index;
MagickBooleanType
status;
PDBImage
pdb_image;
PDBInfo
pdb_info;
register IndexPacket
*indexes;
register ssize_t
... | cwe | CWE-120 | C/C++ |
function escapeArgPowerShell(arg, interpolation, quoted) {
let result = arg
.replace(/\u0000/g, "")
.replace(/`/g, "``")
.replace(/\$/g, "`$");
if (interpolation) {
result = result
.replace(/\n|\r/g, " ")
.replace(/(^|\s|\u0085)((?:\*|[1-6])?)(>)/g, "$1$2`$3")
.replace(/(^|\s|\u00... | cwe | CWE-1333 | JavaScript |
static int svm_cpu_init(int cpu)
{
struct svm_cpu_data *sd;
int r;
sd = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL);
if (!sd)
return -ENOMEM;
sd->cpu = cpu;
r = -ENOMEM;
sd->save_area = alloc_page(GFP_KERNEL);
if (!sd->save_area)
goto err_1;
if (svm_sev_enabled()) {
r = -ENOMEM;
sd->sev_vmcbs = ... | cwe | CWE-401 | C/C++ |
getcmdline_int(
int firstc,
long count UNUSED, // only used for incremental search
int indent, // indent for inside conditionals
int clear_ccline) // clear ccline first
{
int c;
int i;
int j;
int gotesc = FALSE; // TRUE when <ESC> just typed
int do_abbr; // when TRUE check... | cwe | CWE-674 | Unknown |
static void copyMultiCh8(short *dst, const int *const *src, unsigned nSamples, unsigned nChannels)
{
for (unsigned i = 0; i < nSamples; ++i) {
for (unsigned c = 0; c < nChannels; ++c) {
*dst++ = src[c][i] << 8;
}
}
} | cwe | CWE-119 | C/C++ |
znumicc_components(i_ctx_t * i_ctx_p)
{
ref * pnval;
ref * pstrmval;
stream * s;
int ncomps, expected = 0, code;
cmm_profile_t *picc_profile;
os_ptr op = osp;
check_type(*op, t_dictionary);
... | cwe | CWE-704 | C/C++ |
static char *print_array( cJSON *item, int depth, int fmt )
{
char **entries;
char *out = 0, *ptr, *ret;
int len = 5;
cJSON *child = item->child;
int numentries = 0, i = 0, fail = 0;
/* How many entries in the array? */
while ( child ) {
++numentries;
child = child->next;
}
/* Allocate an array to ho... | cwe | CWE-120 | C/C++ |
static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
cache_filename[MaxTextExtent],
id[MaxTextExtent],
keyword[MaxTextExtent],
*options;
const unsigned char
*p;
GeometryInfo
geometry_info;
Image
*image;
int
c;
LinkedListInfo
*profil... | cwe | CWE-401 | Unknown |
static void follow_dotdot(struct nameidata *nd)
{
if (!nd->root.mnt)
set_root(nd);
while(1) {
struct dentry *old = nd->path.dentry;
if (nd->path.dentry == nd->root.dentry &&
nd->path.mnt == nd->root.mnt) {
break;
}
if (nd->path.dentry != nd->path.mnt->mnt_root) {
/* rare case of legitimate... | cwe | CWE-254 | C/C++ |
function s(){o.detach().trigger("closed.bs.alert").remove()} | cwe | CWE-79 | JavaScript |
goa_web_view_init (GoaWebView *self)
{
GoaWebViewPrivate *priv;
GtkWidget *scrolled_window;
SoupCookieJar *cookie_jar;
SoupSession *session;
WebKitWebSettings *settings;
self->priv = GOA_WEB_VIEW_GET_PRIVATE (self);
priv = self->priv;
session = webkit_get_default_session ();
soup_session_add_featur... | cwe | CWE-310 | Unknown |
static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx,
struct oz_usb_hdr *usb_hdr, int len)
{
struct oz_data *data_hdr = (struct oz_data *)usb_hdr;
switch (data_hdr->format) {
case OZ_DATA_F_MULTIPLE_FIXED: {
struct oz_multiple_fixed *body =
(struct oz_multiple_fixed *)data_hdr;
u8 *data = body... | cwe | CWE-119 | 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-190 | Python |
function j(t,e){if(e.length===0&&e.needDrain){e.needDrain=false;t.emit("drain")}} | cwe | CWE-1333 | JavaScript |
asn1_header_decode(struct asn1_ctx *ctx,
unsigned char **eoc,
unsigned int *cls, unsigned int *con, unsigned int *tag)
{
unsigned int def = 0;
unsigned int len = 0;
if (!asn1_id_decode(ctx, cls, con, tag))
return 0;
if (!asn1_length_decode(ctx, &def, &len))
return 0;
if (def)
*eoc = ctx->pointer... | cwe | CWE-119 | Unknown |
private def listAllUsersImpl(usernamePrefix: String, request: ApiRequest[_]): JsArray = {
// Also load deleted anon12345 members. Simpler, and they'll typically be very few or none. [5KKQXA4]
// ... stop doing that?
val members = request.dao.loadUsersWithUsernamePrefix(
usernamePrefix, caseSensitive =... | cwe | CWE-613 | Scala |
QPDF::getExtensionLevel()
{
int result = 0;
QPDFObjectHandle obj = getRoot();
if (obj.hasKey("/Extensions"))
{
obj = obj.getKey("/Extensions");
if (obj.isDictionary() && obj.hasKey("/ADBE"))
{
obj = obj.getKey("/ADBE");
if (obj.isDictionary() && obj.hasKey... | cwe | CWE-787 | Unknown |
/*
* Copyright 2017-2020 original 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | cwe | CWE-22 | Java |
/*
* 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 InitSkBitmapDataForTransfer(const SkBitmap& bitmap) {
const SkImageInfo& info = bitmap.info();
color_type = info.colorType();
alpha_type = info.alphaType();
width = info.width();
height = info.height();
} | cwe | CWE-125 | C/C++ |
RequestHandler::RequestHandler(
std::shared_ptr<CheckWorkflow> check_workflow,
std::shared_ptr<context::ServiceContext> service_context,
std::unique_ptr<Request> request_data)
: context_(new context::RequestContext(service_context,
std::move(request_data))),
... | cwe | CWE-290 | C/C++ |
static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
struct nci_rf_intf_activated_ntf *ntf, __u8 *data)
{
struct activation_params_nfca_poll_iso_dep *nfca_poll;
struct activation_params_nfcb_poll_iso_dep *nfcb_poll;
switch (ntf->activation_rf_tech_and_mode) {
case NCI_NFC_A_PASSIVE_POLL_MODE:
... | cwe | CWE-119 | C/C++ |
static void setFeature(DocumentBuilderFactory dbf, String featureName) throws ParserConfigurationException {
try {
dbf.setFeature(featureName, true);
} catch (ParserConfigurationException e) {
if (Boolean.getBoolean(SYSTEM_PROPERTY_IGNORE_XXE_PROTECTION_FAILURES)) {
... | cwe | CWE-611 | Java |
dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
int num, size_t size, off_t fsize, int *flags, int sh_num)
{
Elf32_Phdr ph32;
Elf64_Phdr ph64;
const char *linking_style = "statically";
const char *interp = "";
unsigned char nbuf[BUFSIZ];
char ibuf[BUFSIZ];
ssize_t bufsize;
size_t of... | cwe | CWE-20 | C/C++ |
Database.prototype.register = function(attendee) {
let query = "INSERT INTO tb_events (uid, key, value, payload) VALUES "
+ "("
+ "'" + attendee.event + "', "
+ "'attendee', "
+ "'" + attendee.name + "', "
+ "'" + attendee.times + "'"
... | cwe | CWE-89 | JavaScript |
static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
struct sctp_association *assoc,
sctp_socket_type_t type)
{
struct sctp_sock *oldsp = sctp_sk(oldsk);
struct sctp_sock *newsp = sctp_sk(newsk);
struct sctp_bind_bucket *pp; /* hash list port iterator */
struct sctp_endpoint *newe... | cwe | CWE-476 | C/C++ |
fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
{
int num;
OnigCodePoint c, c2;
OnigSyntaxType* syn = env->syntax;
OnigEncoding enc = env->enc;
UChar* prev;
UChar* p = *src;
PFETCH_READY;
if (PEND) {
tok->type = TK_EOT;
return tok->type;
}
PFETCH(c);
tok->type = ... | cwe | CWE-787 | C/C++ |
gs_main_finit(gs_main_instance * minst, int exit_status, int code)
{
i_ctx_t *i_ctx_p = minst->i_ctx_p;
gs_dual_memory_t dmem = {0};
int exit_code;
ref error_object;
char *tempnames;
/* NB: need to free gs_name_table
*/
/*
* Previous versions of this code closed the devices in th... | cwe | CWE-416 | Unknown |
AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new(
int numsubsamples,
uint8_t key[16],
uint8_t iv[16],
cryptoinfo_mode_t mode,
size_t *clearbytes,
size_t *encryptedbytes) {
size_t cryptosize = sizeof(AMediaCodecCryptoInfo) + sizeof(size_t) * numsubsamples * 2;
AMediaCodecCryptoInfo *ret = (AMed... | cwe | CWE-190 | C/C++ |
PJ_DEF(pj_status_t) pjmedia_rtcp_fb_parse_rpsi(
const void *buf,
pj_size_t length,
pjmedia_rtcp_fb_rpsi *rpsi)
{
pjmedia_rtcp_common *hdr = (pjmedia_rtcp_common*) buf;
pj_uint8_t *p;
pj_uint8_t padlen;
pj_size_t rpsi_len;
PJ_ASSERT_RETURN(buf && rpsi, PJ_EINVAL);
PJ_ASSERT_RETURN... | cwe | CWE-787 | C/C++ |
/*
* cotp.c
*
* ISO 8073 Connection Oriented Transport Protocol over TCP (RFC1006)
*
* Partial implementation of the ISO 8073 COTP (ISO TP0) protocol for MMS.
*
* Copyright 2013-2018 Michael Zillgith
*
* This file is part of libIEC61850.
*
* libIEC61850 is free software: you can redistribute it and/or ... | cwe | CWE-122 | C/C++ |
SECURITY_STATUS ntlm_read_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
{
wStream* s;
int length;
PBYTE StartOffset;
PBYTE PayloadOffset;
NTLM_AV_PAIR* AvTimestamp;
NTLM_CHALLENGE_MESSAGE* message;
ntlm_generate_client_challenge(context);
message = &context->CHALLENGE_MESSAGE;
ZeroMemory(message, ... | cwe | CWE-125 | C/C++ |
from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from import_export.fields import Field
from import_export.resources import ModelResource
import import_export.widgets as widgets
from build.models import Build, BuildItem
import part.models
class BuildResource(ModelResource):
... | cwe | CWE-1236 | Python |
@staticmethod
def compare_and_update(user, message):
"""
This method compare a user object from the bot and his info from
the Telegram message to check whether a user has changed his bio
or not. If yes, the user object that represents him in the bot will
be updated accordingl... | cwe | CWE-89 | Python |
void SignatureUtil::CheckSignature(
const FilePath& file_path,
ClientDownloadRequest_SignatureInfo* signature_info) {
VLOG(2) << "Checking signature for " << file_path.value();
WINTRUST_FILE_INFO file_info;
file_info.cbStruct = sizeof(file_info);
file_info.pcwszFilePath = file_path.value().c_str();
f... | cwe | CWE-347 | C/C++ |
/*
* Marvell Wireless LAN device driver: WMM
*
* Copyright (C) 2011-2014, Marvell International Ltd.
*
* This software file (the "File") is distributed by Marvell International
* Ltd. under the terms of the GNU General Public License Version 2, June 1991
* (the "License"). You may use, redistribute and/or modif... | cwe | CWE-787 | C/C++ |
$path = Helpers::isAbsolute($item) ? $item : ($this->getRepositoryPath() . DIRECTORY_SEPARATOR . $item);
if (!file_exists($path)) {
throw new GitException("The path at '$item' does not represent a valid file.");
}
$this->run('add', $item);
} | cwe | CWE-88 | PHP |
this.customFonts)))}finally{U.getModel().endUpdate()}}}));this.editorUi.showDialog(W.container,380,Editor.enableWebFonts?250:180,!0,!0);W.init()}),y,null,!0)})))}})();function DiagramPage(b,f){this.node=b;null!=f?this.node.setAttribute("id",f):null==this.getId()&&this.node.setAttribute("id",Editor.guid())}DiagramPage.p... | cwe | CWE-20 | JavaScript |
goa_ews_client_autodiscover (GoaEwsClient *client,
const gchar *email,
const gchar *password,
const gchar *username,
const gchar *server,
... | cwe | CWE-310 | Unknown |
read_new_length(cdk_stream_t inp,
size_t * r_len, size_t * r_size, size_t * r_partial)
{
int c, c1;
c = cdk_stream_getc(inp);
(*r_size)++;
if (c < 192)
*r_len = c;
else if (c >= 192 && c <= 223) {
c1 = cdk_stream_getc(inp);
(*r_size)++;
*r_len = ((c - 192) << 8) + c1 + 192;
} else if (c == 255) {
*r_... | cwe | CWE-125 | Unknown |
bool format_go_output(const string& file_path) {
const string command = "gofmt -w " + file_path;
if (system(command.c_str()) == 0) {
return true;
}
fprintf(stderr, "WARNING - Running '%s' failed.\n", command.c_str());
return false;
} | cwe | CWE-77 | C/C++ |
static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data)
{
int i;
int ret;
ret = xen_pcibk_read_config_word(dev, offset, value, data);
if (!pci_is_enabled(dev))
return ret;
for (i = 0; i < PCI_ROM_RESOURCE; i++) {
if (dev->resource[i].flags & IORESOURCE_IO)
*value |= PCI_COMMAND_IO... | cwe | CWE-264 | Unknown |
static int target_xcopy_parse_target_descriptors(struct se_cmd *se_cmd,
struct xcopy_op *xop, unsigned char *p,
unsigned short tdll, sense_reason_t *sense_ret)
{
struct se_device *local_dev = se_cmd->se_dev;
unsigned char *desc = p;
int offset = tdll % XCOPY_TARGET_DESC_LEN, rc;
unsigned short cscd_index = ... | cwe | CWE-22 | Unknown |
static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
{
struct trace_array *tr = data;
struct ftrace_event_file *ftrace_file;
struct syscall_trace_enter *entry;
struct syscall_metadata *sys_data;
struct ring_buffer_event *event;
struct ring_buffer *buffer;
unsigned long irq_flags;
int pc;
... | cwe | CWE-125 | Unknown |
#include "jsi.h"
#include "jsvalue.h"
#include "jsbuiltin.h"
#include "utf.h"
#include "regexp.h"
static const char *checkstring(js_State *J, int idx)
{
if (!js_iscoercible(J, idx))
js_typeerror(J, "string function called on null or undefined");
return js_tostring(J, idx);
}
int js_runeat(js_State *J, const char ... | cwe | CWE-400 | C/C++ |
func NewLocalSessionCache(config Config) SessionCache {
ctx, ctxCancelFn := context.WithCancel(context.Background())
s := &LocalSessionCache{
config: config,
ctx: ctx,
ctxCancelFn: ctxCancelFn,
cache: make(map[uuid.UUID]*sessionCacheUser),
}
go func() {
ticker := time.NewTicker(2 * time.Durati... | cwe | CWE-613 | Go |
cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
uint32_t offs, cdf_property_info_t **info, size_t *count, size_t *maxcount)
{
const cdf_section_header_t *shp;
cdf_section_header_t sh;
const uint8_t *p, *q, *e;
int16_t s16;
int32_t s32;
uint32_t u32;
int64_t s64;
uint64_t u64;
cdf_tim... | cwe | CWE-119 | C/C++ |
def escape_javascript(javascript)
javascript = javascript.to_s
if javascript.empty?
result = ""
else
result = javascript.gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"'])/u, JS_ESCAPE_MAP)
end
javascript.html_safe? ? result.html_safe : result
end | cwe | CWE-79 | Ruby |
static void sctp_generate_timeout_event(struct sctp_association *asoc,
sctp_event_timeout_t timeout_type)
{
struct net *net = sock_net(asoc->base.sk);
int error = 0;
bh_lock_sock(asoc->base.sk);
if (sock_owned_by_user(asoc->base.sk)) {
pr_debug("%s: sock is busy: timer %d\n", __func__,
timeout_type);
... | cwe | CWE-362 | Unknown |
onedev.server.markdown = {
getCookiePrefix: function($container) {
if ($container.hasClass("compact-mode"))
return "markdownEditor.compactMode";
else
return "markdownEditor.normalMode";
},
fireInputEvent: function($input) {
if(document.createEventObject) {
$input[0].fireEvent("input");
} else {
... | cwe | CWE-502 | Java |
bool WebRequestPermissions::CanExtensionAccessURL(
const extensions::InfoMap* extension_info_map,
const std::string& extension_id,
const GURL& url,
bool crosses_incognito,
HostPermissionsCheck host_permissions_check) {
if (!extension_info_map)
return true;
const extensions::Extension* exten... | cwe | CWE-200 | C/C++ |
slide: slide_cb(),
stop: stop_cb(),
}).data('channel-idx', i);
};
for (i=channels.length-1; i>=0; i--) {
var btnClass = channels[i].active?'pressed':'';
if (OME.isDark(channels[i].color)) {
btnClass += " fontWhite";
}
... | cwe | CWE-116 | JavaScript |
/*
* Stellarium
* Copyright (C) 2009 Matthew Gates
* Copyright (C) 2007 Fabien Chereau
*
* 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
* of the License, or (at your op... | cwe | CWE-22 | C/C++ |
static Image *ReadCAPTIONImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
*caption,
geometry[MaxTextExtent],
*property,
*text;
const char
*gravity,
*option;
DrawInfo
*draw_info;
Image
*image;
MagickBooleanType
split,
status;
register ssize_t
... | cwe | CWE-399 | C/C++ |
function XMLRPCremoveUserGroupPriv($name, $affiliation, $nodeid, $permissions){
require_once(".ht-inc/privileges.php");
global $user;
if(! checkUserHasPriv("userGrant", $user['id'], $nodeid)){
return array('status' => 'error',
'errorcode' => 53,
'errormsg' => 'Unabl... | cwe | CWE-264 | PHP |
/***************************************************************************
ofx_preproc.cpp
-------------------
copyright : (C) 2002 by Benoit GrοΏ½oir
email : benoitg@coeus.ca
***********************************************************************... | cwe | CWE-119 | C/C++ |
TEST_P(Http2CodecImplDeferredResetTest, DeferredResetServer) {
initialize();
InSequence s;
TestRequestHeaderMapImpl request_headers;
HttpTestUtility::addDefaultHeaders(request_headers);
EXPECT_CALL(request_decoder_, decodeHeaders_(_, false));
request_encoder_->encodeHeaders(request_headers, false);
// ... | cwe | CWE-400 | Unknown |
async function validApiKey(request, response, next) {
const multiUserMode = await SystemSettings.isMultiUserMode();
response.locals.multiUserMode = multiUserMode;
const auth = request.header("Authorization");
const bearerKey = auth ? auth.split(" ")[1] : null;
if (!bearerKey) {
response.status(403).json(... | cwe | CWE-305 | JavaScript |
multi_update::initialize_tables(JOIN *join)
{
TABLE_LIST *table_ref;
DBUG_ENTER("initialize_tables");
if (unlikely((thd->variables.option_bits & OPTION_SAFE_UPDATES) &&
error_if_full_join(join)))
DBUG_RETURN(1);
main_table=join->join_tab->table;
table_to_update= 0;
/* Any update has at ... | cwe | CWE-617 | Unknown |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_arr.c
*/
#include "lsquic_arr.h"
int
lsquic_arr_push (struct lsquic_arr *arr, uintptr_t val)
{
uintptr_t *new_els;
unsigned n;
if (arr->off + arr->nelem < arr->nalloc)
{
arr->els[arr->off + arr->nelem] = v... | cwe | CWE-476 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
Subgraph* subgraph = reinterpret_cast<Subgraph*>(context->impl_);
const TfLiteTensor* input_resource_id_tensor =
GetInput(context, node, kInputVariableId);
const TfLiteTensor* input_value_tensor = GetInput(context, node, kInputValue);
int res... | cwe | CWE-125 | C/C++ |
static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
{
struct rdma_id_private *listen_id, *conn_id;
struct rdma_cm_event event;
int offset, ret;
u8 smac[ETH_ALEN];
u8 alt_smac[ETH_ALEN];
u8 *psmac = smac;
u8 *palt_smac = alt_smac;
int is_iboe = ((rdma_node_get_transport(cm_id->dev... | cwe | CWE-20 | C/C++ |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_path
from os.path import join as join_path, exists as... | cwe | CWE-79 | Python |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
#define _GNU_SOURCE /* for memmem */
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <time.h>
#include <string.h>
#include <sys/queue.h>
#ifndef WIN32
#include <netinet/in.h>
#include <netdb.h>
#include <sys/socket.h>... | cwe | CWE-476 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
auto* op_data = static_cast<OpData*>(node->user_data);
// Inputs: box_encodings, scores, anchors
TF_LITE_ENSURE_EQ(context, NumInputs(node), 3);
const TfLiteTensor* input_box_encodings =
GetInput(context, node, kInputTensorBoxEncodings);
c... | cwe | CWE-125 | 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 |
var exec = require('child_process').exec;
var aspect = require('aspectratio');
var dirname = require('path').dirname;
var basename = require('path').basename;
var extname = require('path').extname;
var join = require('path').join;
var sprintf = require('util').format;
module.exports = function(image, output, cb) {
v... | cwe | CWE-78 | JavaScript |
bool WebMediaPlayerImpl::DidPassCORSAccessCheck() const {
if (data_source_)
return data_source_->DidPassCORSAccessCheck();
return false;
} | cwe | CWE-732 | C/C++ |
void FFmpegVideoDecodeEngine::Initialize(
MessageLoop* message_loop,
VideoDecodeEngine::EventHandler* event_handler,
VideoDecodeContext* context,
const VideoDecoderConfig& config) {
static const int kDecodeThreads = 2;
static const int kMaxDecodeThreads = 16;
codec_context_ = avcodec_alloc_contex... | cwe | CWE-125 | C/C++ |
static int get_client_master_key(SSL *s)
{
int is_export, i, n, keya, ek;
unsigned long len;
unsigned char *p;
const SSL_CIPHER *cp;
const EVP_CIPHER *c;
const EVP_MD *md;
p = (unsigned char *)s->init_buf->data;
if (s->state == SSL2_ST_GET_CLIENT_MASTER_KEY_A) {
i = ssl2_read(s,... | cwe | CWE-20 | 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.
*/
/*
* vim9execute.c: execute Vim9 script in... | cwe | CWE-416 | C/C++ |
public function changeTableInfoAction()
{
$field = $_REQUEST['field'];
if ($field == 'pma_null') {
$this->response->addJSON('field_type', '');
$this->response->addJSON('field_collation', '');
$this->response->addJSON('field_operators', '');
$this->resp... | cwe | CWE-79 | PHP |
@staticmethod
def preparehttpserver(httpserver, ui):
try:
import ssl
ssl.wrap_socket
except ImportError:
raise error.Abort(_("SSL support is unavailable"))
certfile = ui.config('web', 'certificate')
httpserver.socket = ssl.wrap_socket(
... | cwe | CWE-327 | Python |
make_backsig (PKT_signature *sig, PKT_public_key *pk,
PKT_public_key *sub_pk, PKT_public_key *sub_psk,
u32 timestamp, const char *cache_nonce)
{
gpg_error_t err;
PKT_signature *backsig;
cache_public_key (sub_pk);
err = make_keysig_packet (&backsig, pk, NULL, sub_pk, sub_psk, 0x19,
... | cwe | CWE-20 | Unknown |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-399 | C/C++ |
/*
* 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-200 | Java |
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got.get(`https://front-end-rss.now.sh/`);
const $ = cheerio.load(response.data);
const fn = Function($($('script')[1]).html() + 'return Array.isArray(LINKS_DATA) ? LINKS_DATA : [... | cwe | CWE-74 | JavaScript |
// Copyright Istio 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 wri... | cwe | CWE-863 | Go |
static void* swoole_unserialize_arr(void *buffer, zval *zvalue, uint32_t nNumOfElements, long flag)
{
//Initialize zend array
zend_ulong h, nIndex, max_index = 0;
uint32_t size = cp_zend_hash_check_size(nNumOfElements);
if (!size)
{
return NULL;
}
if (!buffer)
{
php_error... | cwe | CWE-200 | Unknown |
private String findPathConsideringContracts(LibraryInfo library,
String resourceName,
String localePrefix,
ContractInfo [] outContract,
FacesContext ctx) {
UIViewRo... | cwe | CWE-22 | Java |
package com.salesmanager.shop.admin.controller.products;
import com.salesmanager.core.business.services.catalog.product.ProductService;
import com.salesmanager.core.business.services.catalog.product.attribute.ProductAttributeService;
import com.salesmanager.core.business.services.catalog.product.attribute.ProductOptio... | cwe | CWE-639 | Java |
GF_Err dinf_Read(GF_Box *s, GF_BitStream *bs)
{
GF_Err e = gf_isom_box_array_read(s, bs, dinf_AddBox);
if (e) {
return e;
}
if (!((GF_DataInformationBox *)s)->dref) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Missing dref box in dinf\n"));
((GF_DataInformationBox *)s)->dref = (GF_DataReferenceBo... | cwe | CWE-400 | C/C++ |
dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *ppi_tree = NULL, *ppi_flags_tree = NULL, *seg_tree = NULL, *ampdu_tree = NULL;
proto_tree *agg_tree = NULL;
proto_item *ti = NULL;
tvbuff_t *next_tvb;
int offset = 0;
guint... | cwe | CWE-20 | C/C++ |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (le... | cwe | CWE-125 | Java |
async renderMermaid () {
const codes = this.exportContainer.querySelectorAll('code.language-mermaid')
for (const code of codes) {
const preEle = code.parentNode
const mermaidContainer = document.createElement('div')
mermaidContainer.innerHTML = code.innerHTML
mermaidContainer.classList.a... | cwe | CWE-79 | JavaScript |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2012
* All rights reserved
*
* This file is part of GPAC / ISO Media File Format sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU L... | cwe | CWE-476 | C/C++ |
/*
* Copyright (c) 2012-2019 Belledonne Communications SARL.
*
* This file is part of belle-sip.
*
* 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 License, or
* (... | cwe | CWE-444 | C/C++ |
package com.salesmanager.shop.admin.controller.orders;
import com.salesmanager.core.business.services.catalog.product.PricingService;
import com.salesmanager.core.business.services.customer.CustomerService;
import com.salesmanager.core.business.services.order.OrderService;
import com.salesmanager.core.business.service... | cwe | CWE-639 | Java |
setupConnection(host, port, family = 4) {
const closeExistingServer = () => Promise.resolve(
this.dataSocket ? this.dataSocket.destroy() : undefined);
return closeExistingServer()
.then(() => {
this.dataSocket = new Socket();
this.dataSocket.on('error', (err) => this.server && this.server... | cwe | CWE-918 | JavaScript |
struct tcp_sock_t *tcp_open(uint16_t port)
{
struct tcp_sock_t *this = calloc(1, sizeof *this);
if (this == NULL) {
ERR("callocing this failed");
goto error;
}
this->sd = -1;
this->sd = socket(AF_INET6, SOCK_STREAM, 0);
if (this->sd < 0) {
ERR("sockect open failed");
goto error;
}
struct s... | cwe | CWE-264 | C/C++ |
/**
* Copyright (c) 2006-2012, JGraph Ltd
*/
/**
* Constructs a new graph editor
*/
EditorUi = function(editor, container, lightbox)
{
mxEventSource.call(this);
this.destroyFunctions = [];
this.editor = editor || new Editor();
this.container = container || document.body;
var graph = this.editor.graph;
gra... | cwe | CWE-79 | JavaScript |
error::Error GLES2DecoderImpl::HandleGetMultipleIntegervCHROMIUM(
uint32 immediate_data_size, const gles2::GetMultipleIntegervCHROMIUM& c) {
GLuint count = c.count;
uint32 pnames_size;
if (!SafeMultiplyUint32(count, sizeof(GLenum), &pnames_size)) {
return error::kOutOfBounds;
}
const GLenum* pnames = ... | cwe | CWE-189 | C/C++ |
const Cluster* Segment::GetNext(const Cluster* pCurr)
{
assert(pCurr);
assert(pCurr != &m_eos);
assert(m_clusters);
long idx = pCurr->m_index;
if (idx >= 0)
{
assert(m_clusterCount > 0);
assert(idx < m_clusterCount);
assert(pCurr == m_clusters[idx]);
++idx;... | cwe | CWE-119 | C/C++ |
/*
Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com>
All rights reserved.
This file is part of x11vnc.
x11vnc 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 License, or ... | cwe | CWE-862 | C/C++ |
reallocarray (void *ptr,
size_t nmemb,
size_t size)
{
assert (nmemb > 0 && size > 0);
if (SIZE_MAX / nmemb < size) {
errno = ENOMEM;
return NULL;
}
return realloc (ptr, nmemb * size);
} | cwe | CWE-190 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.