code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
void __detach_mounts(struct dentry *dentry)
{
struct mountpoint *mp;
struct mount *mnt;
namespace_lock();
mp = lookup_mountpoint(dentry);
if (!mp)
goto out_unlock;
lock_mount_hash();
while (!hlist_empty(&mp->m_list)) {
mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list);
umount_tree(mnt, 0);
... | cwe | CWE-284 | C/C++ |
package api
// Visibility is the type of a visibility.
type Visibility string
const (
// Public is the PUBLIC visibility.
Public Visibility = "PUBLIC"
// Protected is the PROTECTED visibility.
Protected Visibility = "PROTECTED"
// Private is the PRIVATE visibility.
Private Visibility = "PRIVATE"
)
func (e Visi... | cwe | CWE-287 | Go |
package org.mozilla.jss.ssl.javax;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.channels.WritableByteChannel;
import java.nio.channels.Channels;
import java.security.PublicKey;
import java.nio.ByteBuffer;
import javax.net.ssl.*;
import... | cwe | CWE-401 | Java |
int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
{
struct sk_buff *frag;
struct rt6_info *rt = (struct rt6_info*)skb_dst(skb);
struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
struct ipv6hdr *tmp_hdr;
struct frag_hdr *fh;
unsigned int mtu, hlen, left, len;
__be32 frag_id = 0;
in... | cwe | CWE-703 | Unknown |
_pango_emoji_iter_next (PangoEmojiIter *iter)
{
PangoEmojiType current_emoji_type = PANGO_EMOJI_TYPE_INVALID;
if (iter->end == iter->text_end)
return FALSE;
iter->start = iter->end;
for (; iter->end < iter->text_end; iter->end = g_utf8_next_char (iter->end))
{
gunichar ch = g_utf8_get_char (ite... | cwe | CWE-119 | C/C++ |
bool Permissions::check_create_datawriter(
const PermissionsHandle& local_handle,
const uint32_t /*domain_id*/,
const std::string& topic_name,
const std::vector<std::string>& partitions,
SecurityException& exception)
{
bool returned_value = false;
const AccessPermissionsH... | cwe | CWE-284 | Unknown |
# Copyright 2017 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 applica... | cwe | CWE-94 | Python |
bool DNP3_Base::ProcessData(int len, const u_char* data, bool orig)
{
Endpoint* endp = orig ? &orig_state : &resp_state;
while ( len )
{
if ( endp->in_hdr )
{
// We're parsing the DNP3 header and link layer, get that in full.
if ( ! AddToBuffer(endp, PSEUDO_APP_LAYER_INDEX, &data, &len) )
return tr... | cwe | CWE-119 | C/C++ |
def resolve
if @uri && @uri.port == 80 && FinalDestination.is_https_domain?(@uri.hostname)
@uri.scheme = "https"
@uri = URI(@uri.to_s)
end
if @limit < 0
@status = :too_many_redirects
log(:warn, "FinalDestination could not resolve URL (too many redirects): #{@uri}") if @verbose
... | cwe | CWE-835 | Ruby |
static bool parseRange(HttpConn *conn, char *value)
{
HttpTx *tx;
HttpRange *range, *last, *next;
char *tok, *ep;
tx = conn->tx;
value = sclone(value);
if (value == 0) {
return 0;
}
/*
Step over the "bytes="
*/
stok(value, "=", &value);
for (l... | cwe | CWE-476 | C/C++ |
static void p54u_disconnect(struct usb_interface *intf)
{
struct ieee80211_hw *dev = usb_get_intfdata(intf);
struct p54u_priv *priv;
if (!dev)
return;
priv = dev->priv;
wait_for_completion(&priv->fw_wait_load);
p54_unregister_common(dev);
usb_put_dev(interface_to_usbdev(intf));
release_firmware(priv->fw);
... | cwe | CWE-416 | 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++ |
static int requireDirective(MaState *state, cchar *key, cchar *value)
{
char *age, *type, *rest, *option, *ovalue, *tok;
int domains;
if (!maTokenize(state, value, "%S ?*", &type, &rest)) {
return MPR_ERR_BAD_SYNTAX;
}
if (scaselesscmp(type, "ability") == 0) {
httpSetAuthRequ... | cwe | CWE-476 | C/C++ |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
import stat
import sys
#VERSION="2.1dev4"
VERSION="2.23.1"
# Taken from kennethreitz/requests/setup.py
package_directory = os.path.realpath(os.path.dirname(__file__))
def get_file_contents(file_path):
"""Get the context of the file us... | cwe | CWE-20 | Python |
int overrun(int itemSize, int nItems) {
int len = ptr - start + itemSize * nItems;
if (len < (end - start) * 2)
len = (end - start) * 2;
U8* newStart = new U8[len];
memcpy(newStart, start, ptr - start);
ptr = newStart + (ptr - start);
delete [] start;
start = newStart;... | cwe | CWE-787 | C/C++ |
xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2,
int hasNullEntries)
{
if ((set1 == NULL) && (hasNullEntries == 0)) {
/*
* Note that doing a memcpy of the list, namespace nodes are
* just assigned to set1, since set2 is cleared anyway.
*/
set1 = xmlXPathNodeSetCreateSize(set2->nodeN... | cwe | CWE-189 | Unknown |
processBatchMultiRuleset(batch_t *pBatch)
{
ruleset_t *currRuleset;
batch_t snglRuleBatch;
int i;
int iStart; /* start index of partial batch */
int iNew; /* index for new (temporary) batch */
DEFiRet;
CHKiRet(batchInit(&snglRuleBatch, pBatch->nElem));
snglRuleBatch.pbShutdownImmediate = pBatch->pbShutdownImme... | cwe | CWE-772 | C/C++ |
package helm
import (
"fmt"
"io/ioutil"
"net/url"
"os"
"os/exec"
"strings"
"github.com/ghodss/yaml"
"github.com/argoproj/argo-cd/v2/util/config"
executil "github.com/argoproj/argo-cd/v2/util/exec"
pathutil "github.com/argoproj/argo-cd/v2/util/io/path"
)
type HelmRepository struct {
Creds
Name strin... | cwe | CWE-59 | Go |
@hook.command(adminonly=True)
def openPoll(question, reply=None, db=None):
"""Creates a new poll."""
if not db_ready: db_init(db)
try:
active = db.execute("SELECT pollID FROM polls WHERE active = 1").fetchone()[0]
if active:
reply("There already is an open poll.")
re... | cwe | CWE-89 | Python |
X){null!=X.shortcut&&900>n&&!mxClient.IS_IOS?O.firstChild.nextSibling.setAttribute("title",X.shortcut):m.apply(this,arguments)};var q=App.prototype.updateUserElement;App.prototype.updateUserElement=function(){q.apply(this,arguments);if(null!=this.userElement){var O=this.userElement;O.style.cssText="position:relative;ma... | cwe | CWE-20 | JavaScript |
static int vmci_transport_dgram_dequeue(struct kiocb *kiocb,
struct vsock_sock *vsk,
struct msghdr *msg, size_t len,
int flags)
{
int err;
int noblock;
struct vmci_datagram *dg;
size_t payload_len;
struct sk_buff *skb;
noblock = flags & MSG_DONTWAIT;
if (flags & MSG_OOB || flags & MSG_ERRQUEUE)
... | cwe | CWE-269 | Unknown |
static X509_ALGOR *rsa_mgf1_decode(X509_ALGOR *alg)
{
const unsigned char *p;
int plen;
if (alg == NULL)
return NULL;
if (OBJ_obj2nid(alg->algorithm) != NID_mgf1)
return NULL;
if (alg->parameter->type != V_ASN1_SEQUENCE)
return NULL;
p = alg->parameter->value.seque... | cwe | CWE-476 | Unknown |
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()]; | cwe | CWE-79 | PHP |
func doesPolicySignatureV4Match(formValues http.Header) APIErrorCode {
// Server region.
region := globalServerRegion
// Parse credential tag.
credHeader, s3Err := parseCredentialHeader("Credential="+formValues.Get(xhttp.AmzCredential), region, serviceS3)
if s3Err != ErrNone {
return s3Err
}
cred, _, s3Err :... | cwe | CWE-285 | Go |
static inline int object_common2(UNSERIALIZE_PARAMETER, long elements)
{
zval *retval_ptr = NULL;
zval fname;
if (Z_TYPE_PP(rval) != IS_OBJECT) {
return 0;
}
if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_OBJPROP_PP(rval), elements, 1)) {
/* We've got partially constructed object on our hands here. Wip... | cwe | CWE-119 | C/C++ |
# Documentation for Zulip's authentication backends is split across a few places:
#
# * https://zulip.readthedocs.io/en/latest/production/authentication-methods.html and
# zproject/prod_settings_template.py have user-level configuration documentation.
# * https://zulip.readthedocs.io/en/latest/development/authenticat... | cwe | CWE-287 | Python |
private function buildWhereClause(Select $select)
{
global $zdb, $login;
try {
if ($this->filters->email_filter == self::FILTER_W_EMAIL) {
$select->where('email_adh != \'\'');
}
if ($this->filters->email_filter == self::FILTER_WO_EMAIL) {
... | cwe | CWE-89 | PHP |
void HTMLImportsController::Dispose() {
for (const auto& loader : loaders_)
loader->Dispose();
loaders_.clear();
if (root_) {
root_->Dispose();
root_.Clear();
}
} | cwe | CWE-416 | C/C++ |
/*
* Host code generation
*
* Copyright (c) 2003 Fabrice Bellard
*
* This library 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 the License, or (at your option) any l... | cwe | CWE-697 | C/C++ |
static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
{
vm_flags_t vm_flags = vma->vm_flags;
int write = (gup_flags & FOLL_WRITE);
int foreign = (gup_flags & FOLL_REMOTE);
if (vm_flags & (VM_IO | VM_PFNMAP))
return -EFAULT;
if (write) {
if (!(vm_flags & VM_WRITE)) {
if (!(gup_fla... | cwe | CWE-119 | Unknown |
# -*- coding: utf-8 -*-
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# Copyright (C) 2018-2019 OzzieIsaacs, cervinko, jkrehm, bodybybuddha, ok11,
# andy29485, idalin, Kyosfonica, wuqi, Kennyl, lemmsh,
# falgh1, grunjol, csitk... | cwe | CWE-352 | Python |
$ul->appendChild(new XMLElement('li', $s->get('navigation_group')));
$groups[] = $s->get('navigation_group');
} | cwe | CWE-79 | PHP |
void DocumentModuleScriptFetcher::NotifyFinished(Resource* resource) {
ClearResource();
ScriptResource* script_resource = ToScriptResource(resource);
HeapVector<Member<ConsoleMessage>> error_messages;
if (!WasModuleLoadSuccessful(script_resource, &error_messages)) {
Finalize(WTF::nullopt, error_messages);... | cwe | CWE-200 | C/C++ |
def remove
lu = Tr8n::LanguageUser.find(:first, :conditions => ["language_id = ? and user_id = ?", params[:language_id], tr8n_current_user.id])
lu.destroy if lu
redirect_to_source
end | cwe | CWE-89 | Ruby |
$(function () {
function SettingsViewModel(parameters) {
var self = this;
self.loginState = parameters[0];
self.access = parameters[1];
self.printerProfiles = parameters[2];
self.about = parameters[3];
// TODO: remove in upcoming version, this is only for backwards ... | cwe | CWE-79 | Python |
// Copyright 2014 Unknown
//
// 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 writ... | cwe | CWE-20 | Go |
/*******************************************************************************
* Copyright (c) 2013 Mover Zhou
*
* 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.apac... | cwe | CWE-707 | Java |
package com.salesmanager.shop.model.catalog.product.attribute;
import java.io.Serializable;
public class ProductOptionEntity extends ProductOption implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private int order;
private String type;
public void setOrder(int order) {
... | cwe | CWE-639 | Java |
void brcmf_rx_event(struct device *dev, struct sk_buff *skb)
{
struct brcmf_if *ifp;
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_pub *drvr = bus_if->drvr;
brcmf_dbg(EVENT, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
if (brcmf_rx_hdrpull(drvr, skb, &ifp))
return;
brcmf_fweh_process_skb(ifp->... | cwe | CWE-20 | Unknown |
function insertRecord(recordRankType, dateDone,requirementID,
scoutID, connection)
{
var strQuery = "INSERT INTO record VALUES('"+recordRankType+"', '" +
dateDone + "', '" +requirementID+"', '"+scoutID+"', 'NULL')";
connection.query( strQuery, function(err, rows)
{if(err) {
throw err;
}else{
if(... | cwe | CWE-89 | JavaScript |
def delete_playlists_videos(playlist_id, db):
db.execute("DELETE FROM video where playlist_id={playlist_id};".format(
playlist_id=playlist_id)) | cwe | CWE-89 | Python |
const bootbox = require('bootbox');
const Requisition = require('../model/Requisition');
require('../services/Requisitions');
require('../services/Synchronize');
/**
* @author Alejandro Galue <agalue@opennms.org>
* @copyright 2014 The OpenNMS Group, Inc.
*/
(function() {
'use strict';
angular.module('onms-req... | cwe | CWE-79 | Java |
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute i... | cwe | CWE-79 | JavaScript |
tcpmss_mangle_packet(struct sk_buff *skb,
const struct xt_action_param *par,
unsigned int family,
unsigned int tcphoff,
unsigned int minlen)
{
const struct xt_tcpmss_info *info = par->targinfo;
struct tcphdr *tcph;
int len, tcp_hdrlen;
unsigned int i;
__be16 oldval;
u16 newmss;
u8 *op... | cwe | CWE-416 | C/C++ |
static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
{
int sx, sy;
int dx, dy;
int width, height;
int depth;
int notify = 0;
depth = s->get_bpp((VGAState *)s) / 8;
s->get_resolution((VGAState *)s, &width, &height);
/* extra x, y */
sx = (src % (width * dept... | cwe | CWE-787 | Unknown |
package envoyconfig
import (
"encoding/json"
"fmt"
"net/url"
"sort"
envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
envoy_config_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
envoy_type_matcher_v3 "github.com/envoyproxy/go-control-plane/envoy/type/ma... | cwe | CWE-200 | Go |
static int i740fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
switch (var->bits_per_pixel) {
case 8:
var->red.offset = var->green.offset = var->blue.offset = 0;
var->red.length = var->green.length = var->blue.length = 8;
break;
case 16:
switch (var->green.length) {
default:
case 5:
... | cwe | CWE-369 | C/C++ |
void jpc_qmfb_join_colres(jpc_fix_t *a, int numrows, int numcols,
int stride, int parity)
{
int bufsize = JPC_CEILDIVPOW2(numrows, 1);
jpc_fix_t joinbuf[QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE];
jpc_fix_t *buf = joinbuf;
jpc_fix_t *srcptr;
jpc_fix_t *dstptr;
register jpc_fix_t *srcptr2;
register jpc_fix_t *dst... | cwe | CWE-189 | Unknown |
function ame_ajax_toggle_showinvisposts( status ) {
jQuery("#ame_toggle_showinvisposts").prop("value", ameAjaxL10n.pleaseWait);
var ame_sack = new sack( ajaxurl );
ame_sack.execute = 1;
ame_sack.method = 'POST';
ame_sack.setVar( "action", "ame_toggle_showinvisposts" );
ame_sack.setVar( "status", status );
ame_sa... | cwe | CWE-352 | JavaScript |
/*!
Copyright (c) REBUILD <https://getrebuild.com/> and/or its owners. All rights reserved.
rebuild is dual-licensed under commercial and open source licenses (GPLv3).
See LICENSE and COMMERCIAL in the project root for license information.
*/
// eslint-disable-next-line no-undef
RbForm.postAfter = function (data) {
... | cwe | CWE-89 | Java |
void Compute(OpKernelContext* context) override {
// Get inputs
const Tensor& input_tensor = context->input(0);
const auto input_tensor_flat = input_tensor.flat<int32>();
const Tensor& input_splits = context->input(1);
const auto input_splits_flat = input_splits.flat<SPLITS_TYPE>();
// Operatio... | cwe | CWE-787 | 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 |
package com.salesmanager.shop.admin.controller.products;
import com.salesmanager.core.business.services.catalog.product.ProductService;
import com.salesmanager.core.business.services.catalog.product.image.ProductImageService;
import com.salesmanager.core.business.utils.ajax.AjaxPageableResponse;
import com.salesmanage... | cwe | CWE-79 | Java |
XcursorImageCreate (int width, int height)
{
XcursorImage *image;
image = malloc (sizeof (XcursorImage) +
width * height * sizeof (XcursorPixel));
if (!image)
image->height = height;
image->delay = 0;
return image;
} | cwe | CWE-190 | C/C++ |
void smp_process_keypress_notification(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
uint8_t* p = (uint8_t*)p_data;
uint8_t reason = SMP_INVALID_PARAMETERS;
SMP_TRACE_DEBUG("%s", __func__);
p_cb->status = *(uint8_t*)p_data;
if (smp_command_has_invalid_parameters(p_cb)) {
smp_sm_event(p_cb, SMP_AUTH_CMPL... | cwe | CWE-125 | C/C++ |
'use strict';
// @ts-check
// ==================================================================================
// internet.js
// ----------------------------------------------------------------------------------
// Description: System Information - library
// for Node.js
// Copyright: (c) 2014 - ... | cwe | CWE-78 | JavaScript |
smtp_server_connection_handle_input(struct smtp_server_connection *conn)
{
struct smtp_server_command *pending_command;
enum smtp_command_parse_error error_code;
const char *cmd_name, *cmd_params, *error;
int ret;
/* Check whether we are continuing a command */
pending_command = NULL;
if (conn->command_queue_ta... | cwe | CWE-77 | Unknown |
static int dtls1_retrieve_buffered_fragment(SSL *s, long max, int *ok)
{
/*-
* (0) check whether the desired fragment is available
* if so:
* (1) copy over the fragment to s->init_buf->data[]
* (2) update s->init_num
*/
pitem *item;
hm_fragment *frag;
int al;
*ok = 0;
i... | cwe | CWE-399 | Unknown |
void Compute(OpKernelContext* context) override {
const Tensor& images = context->input(0);
const Tensor& boxes = context->input(1);
const int64 depth = images.dim_size(3);
OP_REQUIRES(context, images.dims() == 4,
errors::InvalidArgument("The rank of the images should be 4"));
OP_RE... | cwe | CWE-476 | C/C++ |
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2019 MediaTek Inc.
* Authors:
* Stanley Chu <stanley.chu@mediatek.com>
* Peter Wang <peter.wang@mediatek.com>
*/
#include <linux/arm-smccc.h>
#include <linux/bitfield.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include... | cwe | CWE-476 | C/C++ |
/* package identityHandlers provides a collection of handlers for target systems,
these handlers create accounts and sso tokens */
package identityHandlers
import (
"encoding/json"
"errors"
"fmt"
"net/http"
"strings"
"sync"
"time"
"github.com/markbates/goth"
uuid "github.com/satori/go.uuid"
logger "github.... | cwe | CWE-287 | Go |
cfm_print(netdissect_options *ndo,
register const u_char *pptr, register u_int length)
{
const struct cfm_common_header_t *cfm_common_header;
const struct cfm_tlv_header_t *cfm_tlv_header;
const uint8_t *tptr, *tlv_ptr;
const uint8_t *namesp;
u_int names_data_remaining;
uint8_t md_name... | cwe | CWE-125 | C/C++ |
/*
* Unsquash a squashfs filesystem. This is a highly compressed read only
* filesystem.
*
* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2019, 2021
* Phillip Lougher <phillip@squashfs.org.uk>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public... | cwe | CWE-22 | C/C++ |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2005-2012
* All rights reserved
*
* This file is part of GPAC / command-line client
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General ... | cwe | CWE-119 | C/C++ |
"""
This module handles loading and using lookatme_contriba modules
Contrib modules are directly used
"""
import contextlib
from lookatme.exceptions import IgnoredByContrib
from . import terminal
from . import file_loader
CONTRIB_MODULES = [
terminal,
file_loader,
]
def load_contribs(contrib_names):
... | cwe | CWE-78 | Python |
DecodeNumberField(int len, char *str, int fmask,
int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits)
{
char *cp;
/*
* Have a decimal point? Then this is a date or something with a seconds
* field...
*/
if ((cp = strchr(str, '.')) != NULL)
{
#ifdef HAVE_INT64_TIMESTAMP
char fstr[MAXDATELE... | cwe | CWE-119 | C/C++ |
private static Stream<Arguments> provideFilesAndExpectedExceptionType() {
return Stream.of(
Arguments.of("abnormal/corrupt-header.rar", CorruptHeaderException.class),
Arguments.of("abnormal/mainHeaderNull.rar", BadRarArchiveException.class)
);
} | cwe | CWE-835 | Java |
int snd_card_disconnect(struct snd_card *card)
{
struct snd_monitor_file *mfile;
if (!card)
return -EINVAL;
spin_lock(&card->files_lock);
if (card->shutdown) {
spin_unlock(&card->files_lock);
return 0;
}
card->shutdown = 1;
spin_unlock(&card->files_lock);
/* phase 1: disable fops (user space) operation... | cwe | CWE-416 | C/C++ |
def login(self, username, password):
select_query = """
SELECT client_id, username, balance, message
FROM Clients
WHERE username = '{}' AND password = '{}'
LIMIT 1
""".format(username, password)
cursor = self.__conn.cursor()
cursor.execut... | cwe | CWE-89 | Python |
bool samba_private_attr_name(const char *unix_ea_name)
{
static const char * const prohibited_ea_names[] = {
SAMBA_POSIX_INHERITANCE_EA_NAME,
SAMBA_XATTR_DOS_ATTRIB,
SAMBA_XATTR_MARKER,
XATTR_NTACL_NAME,
NULL
};
int i;
for (i = 0; prohibited_ea_names[i]; i++) {
if (strequal( prohibited_ea_names[i], un... | cwe | CWE-787 | Unknown |
static void SFS_AddString(ScriptParser *parser, char *str)
{
char *new_str;
if (!str) return;
if (strlen(parser->string) + strlen(str) >= parser->length) {
parser->length += PARSER_STEP_ALLOC;
new_str = (char *)gf_malloc(sizeof(char)*parser->length);
strcpy(new_str, parser->string);
gf_free(parser->string);
... | cwe | CWE-94 | Unknown |
static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pcu)
{
const struct usb_cdc_union_desc *union_desc;
struct usb_host_interface *alt;
union_desc = ims_pcu_get_cdc_union_desc(intf);
if (!union_desc)
return -EINVAL;
pcu->ctrl_intf = usb_ifnum_to_if(pcu->udev,
union_desc->bMaster... | cwe | CWE-703 | Unknown |
/**
* Copyright (c) 2006-2012, JGraph Ltd
*/
// Workaround for handling named HTML entities in mxUtils.parseXml
// LATER: How to configure DOMParser to just ignore all entities?
(function()
{
var entities = [
['nbsp', '160'],
['shy', '173']
];
var parseXml = mxUtils.parseXml;
mxUtils.parseXml = function... | cwe | CWE-79 | JavaScript |
buflist_getfile(
int n,
linenr_T lnum,
int options,
int forceit)
{
buf_T *buf;
win_T *wp = NULL;
pos_T *fpos;
colnr_T col;
buf = buflist_findnr(n);
if (buf == NULL)
{
if ((options & GETF_ALT) && n == 0)
emsg(_(e_no_alternate_file));
else
semsg(_(e_buffer_nr_no... | cwe | CWE-787 | Unknown |
// Copyright (C) 2016 University of Dundee & Open Microscopy Environment.
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// ... | cwe | CWE-116 | Python |
"""
Copyright 2006-2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail>
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 option) any late... | cwe | CWE-863 | Python |
void libxsmm_sparse_csr_reader( libxsmm_generated_code* io_generated_code,
const char* i_csr_file_in,
unsigned int** o_row_idx,
unsigned int** o_column_idx,
doubl... | cwe | CWE-119 | Unknown |
static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base)
{
const char *baseptr = (char *)base->data;
const char *hostptr = (char *)uri->data;
const char *p = strchr(hostptr, ':');
int hostlen;
/* Check for foo:// and skip past it */
if (!p || (p[1] != '/') || (p[2] != '/'))
return X5... | cwe | CWE-125 | Unknown |
match_at(regex_t* reg, const UChar* str, const UChar* end,
#ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE
const UChar* right_range,
#endif
const UChar* sstart, UChar* sprev, OnigMatchArg* msa)
{
static UChar FinishCode[] = { OP_FINISH };
int i, n, num_mem, best_len, pop_level;
LengthType tlen, tlen... | cwe | CWE-125 | Unknown |
def _marshal(val, options)
yield marshal?(options) ? Marshal.dump(val) : val
end | cwe | CWE-502 | Ruby |
/**
* This file is part of alf.io.
*
* alf.io 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
* (at your option) any later version.
*
* alf.io is distributed in the ... | cwe | CWE-94 | Java |
/*
* Copyright 2020 ThoughtWorks, 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 agr... | cwe | CWE-668 | Java |
_get_children (hive_h *h, hive_node_h blkoff,
offset_list *children, offset_list *blocks,
int flags)
{
/* Add this intermediate block. */
if (_hivex_add_to_offset_list (blocks, blkoff) == -1)
return -1;
struct ntreg_hbin_block *block =
(struct ntreg_hbin_block *) ((char *) h... | cwe | CWE-400 | C/C++ |
public void handle(HttpServletRequest request, final HttpServletResponse response)
throws Exception
{
// We're sending an XML response, so set the response content type to text/xml
response.setContentType("text/xml");
// Parse the incoming request as XML
SAXReader xmlReader = new SAXReader();
... | cwe | CWE-200 | Java |
telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print)
{
int i, x;
u_int c;
const u_char *osp, *p;
#define FETCH(c, sp, length) \
do { \
if (length < 1) \
goto pktend; \
ND_TCHECK(*sp); \
c = *sp++; \
length--; \
} while (0)
osp = sp;
FETCH(c, sp, length);
if (c != IAC)
... | cwe | CWE-125 | C/C++ |
// SPDX-License-Identifier: GPL-2.0-only
/*
* linux/kernel/fork.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
/*
* 'fork.c' contains the help-routines for the 'fork' system call
* (see also entry.S and others).
* Fork is rather simple, once you get the hang of it, but the memory
* management can be a bi... | cwe | CWE-362 | C/C++ |
/* Copyright 2017 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 | C/C++ |
var mxClient={VERSION:"18.0.3",IS_IE:null!=navigator.userAgent&&0<=navigator.userAgent.indexOf("MSIE"),IS_IE11:null!=navigator.userAgent&&!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:null!=navigator.userAgent&&!!navigator.userAgent.match(/Edge\//),IS_EM:"spellcheck"in document.createElement("textarea")&&8==docum... | cwe | CWE-20 | JavaScript |
/*
* Copyright 2017-2019 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | cwe | CWE-400 | Java |
// Copyright 2020 Google LLC
//
// 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-287 | Go |
/*
* Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
*
* 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 any later version.
*
* This progr... | cwe | CWE-284 | C/C++ |
static void put_prev_task(struct rq *rq, struct task_struct *prev)
{
if (prev->se.on_rq)
update_rq_clock(rq);
rq->skip_clock_update = 0;
prev->sched_class->put_prev_task(rq, prev);
} | cwe | CWE-703 | Unknown |
/*
* Routines having to do with the 'struct sk_buff' memory handlers.
*
* Authors: Alan Cox <alan@lxorguk.ukuu.org.uk>
* Florian La Roche <rzsfl@rz.uni-sb.de>
*
* Fixes:
* Alan Cox : Fixed the worst of the load
* balancer bugs.
* Dave Platt : Interrupt stacking fix.
* Richard Kooijman : Timestamp fixe... | cwe | CWE-125 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteRNNParams*>(node->builtin_data);
auto* op_data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const TfLiteTensor* input_weights = GetInput(context... | cwe | CWE-125 | C/C++ |
def generate_node_config(certname):
"""Generates a YAML document describing the configuration of a particular
node given as 'certname'."""
# Get a cursor to the database
curd = g.db.cursor(mysql.cursors.DictCursor)
# Get the Puppet node from the database
curd.execute("SELECT `id`, `classes`, `variables`, `env`,... | cwe | CWE-502 | Python |
gss_delete_sec_context (minor_status,
context_handle,
output_token)
OM_uint32 * minor_status;
gss_ctx_id_t * context_handle;
gss_buffer_t output_token;
{
OM_uint32 status;
gss_union_ctx_id_t ctx;
status = val_del_sec_ctx_args(minor_status, context_handl... | cwe | CWE-415 | C/C++ |
static void xen_free_irq(unsigned irq)
{
struct irq_info *info = info_for_irq(irq);
unsigned long flags;
if (WARN_ON(!info))
return;
write_lock_irqsave(&evtchn_rwlock, flags);
list_del(&info->list);
set_info_for_irq(irq, NULL);
WARN_ON(info->refcnt > 0);
write_unlock_irqrestore(&evtchn_rwlock, flags);
... | cwe | CWE-703 | Unknown |
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2012-2021 rdiffweb contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... | cwe | CWE-770 | Python |
static char* allocFromUTF32(const char32_t* in, size_t len)
{
if (len == 0) {
return getEmptyString();
}
const ssize_t bytes = utf32_to_utf8_length(in, len);
if (bytes < 0) {
return getEmptyString();
}
SharedBuffer* buf = SharedBuffer::alloc(bytes+1);
ALOG_ASSERT(buf, ... | cwe | CWE-264 | C/C++ |
import datetime
import re
import time
import urllib2
from email import encoders
from email.mime.base import MIMEBase
import mailpile.security as security
from mailpile.conn_brokers import Master as ConnBroker
from mailpile.i18n import gettext as _
from mailpile.i18n import ngettext as _n
from mailpile.commands import ... | cwe | CWE-310 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.