code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static int get_client_hello(SSL *s)
{
int i, n;
unsigned long len;
unsigned char *p;
STACK_OF(SSL_CIPHER) *cs; /* a stack of SSL_CIPHERS */
STACK_OF(SSL_CIPHER) *cl; /* the ones we want to use */
STACK_OF(SSL_CIPHER) *prio, *allow;
int z;
/*
* This is a bit of a hack to check f... | cwe | CWE-310 | Unknown |
LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
{
LogLuvState* sp = EncoderState(tif);
int shft;
tmsize_t i;
tmsize_t j;
tmsize_t npixels;
uint8* op;
uint32* tp;
uint32 b;
tmsize_t occ;
int rc=0, mask;
tmsize_t beg;
assert(s == 0);
assert(sp != NULL);
npixels = cc / sp->pixel_size;
if (sp-... | cwe | CWE-787 | Unknown |
gss_wrap_size_limit(OM_uint32 *minor_status,
gss_ctx_id_t context_handle,
int conf_req_flag,
gss_qop_t qop_req, OM_uint32 req_output_size, OM_uint32 *max_input_size)
{
gss_union_ctx_id_t ctx;
gss_mechanism mech;
OM_uint32 major_st... | cwe | CWE-415 | Unknown |
- (GCDWebServerResponse*)performCOPY:(GCDWebServerRequest*)request isMove:(BOOL)isMove {
if (!isMove) {
NSString* depthHeader = [request.headers objectForKey:@"Depth"]; // TODO: Support "Depth: 0"
if (depthHeader && ![depthHeader isEqualToString:@"infinity"]) {
return [GCDWebServerErrorResponse respons... | cwe | CWE-863 | Objective-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-617 | Python |
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing... | cwe | CWE-400 | Java |
int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,
const unsigned char *limit, SSL_SESSION **ret)
{
/* Point after session ID in client hello */
const unsigned char *p = session_id + len;
unsigned short i;
*ret = NULL;
s->tlsext_ticket_expected = 0;
/*
... | cwe | CWE-190 | C/C++ |
pci_emul_add_msicap(struct pci_vdev *dev, int msgnum)
{
struct msicap msicap;
pci_populate_msicap(&msicap, msgnum, 0);
return pci_emul_add_capability(dev, (u_char *)&msicap, sizeof(msicap));
} | cwe | CWE-617 | C/C++ |
private function checkAuthenticationTag() {
if ($this->authentication_tag === $this->calculateAuthenticationTag()) {
return true;
} else {
throw new JOSE_Exception_UnexpectedAlgorithm('Invalid authentication tag');
}
} | cwe | CWE-200 | PHP |
MagickExport MagickBooleanType SetQuantumDepth(const Image *image,
QuantumInfo *quantum_info,const size_t depth)
{
size_t
extent,
quantum;
/*
Allocate the quantum pixel buffer.
*/
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
... | cwe | CWE-369 | Unknown |
bool MediaStreamDevicesController::IsRequestAllowedByDefault() const {
if (ShouldAlwaysAllowOrigin())
return true;
struct {
bool has_capability;
const char* policy_name;
const char* list_policy_name;
ContentSettingsType settings_type;
} device_checks[] = {
{ microphone_requested_, prefs::... | cwe | CWE-264 | C/C++ |
// Copyright 2019 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 |
static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSRMLS_DC)
{
zval *env_vars = NULL;
ALLOC_ZVAL(env_vars);
array_init(env_vars);
INIT_PZVAL(env_vars);
if (PG(http_globals)[TRACK_VARS_ENV]) {
zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]);
}
PG(http_globals)[TRACK_VARS_ENV] = env_v... | cwe | CWE-601 | Unknown |
def spree_current_user
@spree_current_user ||= Spree.user_class.find_by(id: doorkeeper_token.resource_owner_id) if doorkeeper_token
end | cwe | CWE-613 | Ruby |
// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum 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 3 of the License... | cwe | CWE-190 | Go |
GF_RTPHinter *gf_hinter_track_new(GF_ISOFile *file, u32 TrackNum,
u32 Path_MTU, u32 max_ptime, u32 default_rtp_rate, u32 flags, u8 PayloadID,
Bool copy_media, u32 InterleaveGroupID, u8 InterleaveGroupPriority, GF_Err *e)
{
GF_SLConfig my_sl;
u32 des... | cwe | CWE-476 | Unknown |
verify_client_san(krb5_context context,
pkinit_kdc_context plgctx,
pkinit_kdc_req_context reqctx,
krb5_kdcpreauth_callbacks cb,
krb5_kdcpreauth_rock rock,
krb5_const_principal client,
int *valid_san)
{
krb5_e... | cwe | CWE-295 | C/C++ |
char *FLTGetIsLikeComparisonCommonExpression(FilterEncodingNode *psFilterNode)
{
const size_t bufferSize = 1024;
char szBuffer[1024];
char szTmp[256];
char *pszValue = NULL;
const char *pszWild = NULL;
const char *pszSingle = NULL;
const char *pszEscape = NULL;
int bCaseInsensitive = 0;
FEPropertyIs... | cwe | CWE-119 | C/C++ |
void TLSOutStream::flush()
{
U8* sentUpTo = start;
while (sentUpTo < ptr) {
int n = writeTLS(sentUpTo, ptr - sentUpTo);
sentUpTo += n;
offset += n;
}
ptr = start;
out->flush();
} | cwe | CWE-122 | C/C++ |
init: function() {
// Load saved config
var _self = this,
fields = [
'html', 'xhtmlOut', 'breaks', 'langPrefix', 'linkify', 'typographer'
],
defaults = {
'html': false,
'xhtmlOut': true,
'breaks': true,
'langPrefix': 'language-',
'linkify': true,
'typogra... | cwe | CWE-79 | JavaScript |
/* linenoise.c -- guerrilla line editing library against the idea that a
*
* Copyright (c) 2010, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
*... | cwe | CWE-200 | C/C++ |
static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
const uint8_t *buf, int buf_size,
int first_field)
{
int i, cid, ret;
int old_bit_depth = ctx->bit_depth, bitdepth;
uint64_t header_prefix;
if (buf_size < 0x280) {
av_l... | cwe | CWE-125 | C/C++ |
static bool authenticated(conn *c) {
assert(settings.sasl);
bool rv = false;
switch (c->cmd) {
case PROTOCOL_BINARY_CMD_SASL_LIST_MECHS: /* FALLTHROUGH */
case PROTOCOL_BINARY_CMD_SASL_AUTH: /* FALLTHROUGH */
case PROTOCOL_BINARY_CMD_SASL_STEP: /* FALLTHROUGH */
case PROTOCOL_BI... | cwe | CWE-287 | Unknown |
init_connection_options(MYSQL *mysql)
{
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
if (opt_use_ssl)
{
mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
mysql_options(mysql, MYS... | cwe | CWE-284 | Unknown |
uint32 TIFF_WriteOverview( TIFF *hTIFF, uint32 nXSize, uint32 nYSize,
int nBitsPerPixel, int nPlanarConfig, int nSamples,
int nBlockXSize, int nBlockYSize,
int bTiled, int nCompressFlag, int nPhotometric,
int nS... | cwe | CWE-400 | C/C++ |
main(int argc, char *argv[])
{
int cnt,rc,cc;
char cmnd[255];
strcpy(cmnd, CMD);
if (argc > 1)
{
for (cnt = 1; cnt < argc; cnt++)
{
strcat(cmnd, " ");
strcat(cmnd, argv[cnt]);
}
}
else
{
fprintf(stderr, "__ %s: failed %d %d\n", argv[0], rc, cc);
return 255;
}
cc ... | cwe | CWE-74 | C/C++ |
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
String secret = getSecret();
Key key = new SecretKeySpec(Decoders.BASE64.decode(secret), getSignatureAlgorithm().getJcaName());
Jwt jwt = Jwts.parser().
... | cwe | CWE-347 | Java |
static bool tcp_shifted_skb(struct sock *sk, struct sk_buff *prev,
struct sk_buff *skb,
struct tcp_sacktag_state *state,
unsigned int pcount, int shifted, int mss,
bool dup_sack)
{
struct tcp_sock *tp = tcp_sk(sk);
u32 start_seq = TCP_SKB_CB(skb)->seq; /* start of newly-SACKed */
u32 end_... | cwe | CWE-190 | Unknown |
// A Config object provides information about how a specific app is
// configured.
// mount is the URL for the root of the API; includes http, domain, etc.
import AppCache from './cache';
import SchemaCache from './Controllers/SchemaCache';
import DatabaseController from './Controllers/DatabaseController';
import net ... | cwe | CWE-74 | JavaScript |
void MSG_WriteBits( msg_t *msg, int value, int bits ) {
int i;
oldsize += bits;
if ( msg->maxsize - msg->cursize < 4 ) {
msg->overflowed = qtrue;
return;
}
if ( bits == 0 || bits < -31 || bits > 32 ) {
Com_Error( ERR_DROP, "MSG_WriteBits: bad bits %i", bits );
}
if ( bits < 0 ) {
bits = -bits;
... | cwe | CWE-119 | C/C++ |
static int sisusb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *dev = interface_to_usbdev(intf);
struct sisusb_usb_data *sisusb;
int retval = 0, i;
dev_info(&dev->dev, "USB2VGA dongle found at address %d\n",
dev->devnum);
/* Allocate memory for our private */
sisusb... | cwe | CWE-476 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-772 | C/C++ |
function finishView (view) {
// todo list
const lis = view.find('li.raw').removeClass('raw').sortByDepth().toArray()
for (let li of lis) {
let html = $(li).clone()[0].innerHTML
const p = $(li).children('p')
if (p.length === 1) {
html = p.html()
li = p[0]
}
html = replaceExtraTags(... | cwe | CWE-74 | JavaScript |
/*
* Copyright (c) 2014,2015 DeNA Co., Ltd., Kazuho Oku, Masahiro Nagano
*
* 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... | cwe | CWE-824 | C/C++ |
/*
* This file is part of Cockpit.
*
* Copyright (C) 2013 Red Hat, Inc.
*
* Cockpit 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-909 | C/C++ |
/* exif-mnote-data-fuji.c
*
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
*
* 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 of the License, or (... | cwe | CWE-416 | C/C++ |
bool Utility::UnZip(const QString &zippath, const QString &destpath)
{
int res = 0;
QDir dir(destpath);
if (!cp437) {
cp437 = new QCodePage437Codec();
}
#ifdef Q_OS_WIN32
zlib_filefunc64_def ffunc;
fill_win32_filefunc64W(&ffunc);
unzFile zfile = unzOpen2_64(Utility::QStringToStdWStri... | cwe | CWE-22 | C/C++ |
static void ConvertLoopSlice(ModSample &src, ModSample &dest, SmpLength start, SmpLength len, bool loop)
{
if(!src.HasSampleData()) return;
dest.FreeSample();
dest = src;
dest.nLength = len;
dest.pSample = nullptr;
if(!dest.AllocateSample())
{
return;
}
// only preserve cue points if the target sample len... | cwe | CWE-125 | Unknown |
constructor() {
this.ldapjs = ldapjs;
this.connected = false;
this.options = {
host : this.constructor.settings_get('LDAP_HOST'),
port : this.constructor.settings_get('LDAP_PORT'),
Reconnect : this.const... | cwe | CWE-295 | JavaScript |
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
| Copyrigh... | cwe | CWE-125 | Java |
void resetPasswordUnexistingUser() throws Exception
{
when(this.userReference.toString()).thenReturn("user:Foobar");
when(this.userManager.exists(this.userReference)).thenReturn(false);
String exceptionMessage = "User [user:Foobar] doesn't exist";
when(this.localizationManager.getTra... | cwe | CWE-200 | Java |
static char *print_string_ptr( const char *str )
{
const char *ptr;
char *ptr2, *out;
int len = 0;
unsigned char token;
if ( ! str )
return cJSON_strdup( "" );
ptr = str;
while ( ( token = *ptr ) && ++len ) {
if ( strchr( "\"\\\b\f\n\r\t", token ) )
++len;
else if ( token < 32 )
len += 5;
++ptr... | cwe | CWE-120 | C/C++ |
/*
* gd_gd2.c
*
* Implements the I/O and support for the GD2 format.
*
* Changing the definition of GD2_DBG (below) will cause copious messages
* to be displayed while it processes requests.
*
* Designed, Written & Copyright 1999, Philip Warner.
*
*/
/**
* File: GD2 IO
*
* Read and write... | cwe | CWE-190 | C/C++ |
static int ssl_decrypt_buf( ssl_context *ssl )
{
size_t i, padlen = 0, correct = 1;
unsigned char tmp[POLARSSL_SSL_MAX_MAC_SIZE];
SSL_DEBUG_MSG( 2, ( "=> decrypt buf" ) );
if( ssl->in_msglen < ssl->transform_in->minlen )
{
SSL_DEBUG_MSG( 1, ( "in_msglen (%d) < minlen (%d)",
... | cwe | CWE-310 | C/C++ |
int jpc_enc_encpkt(jpc_enc_t *enc, jas_stream_t *out, int compno, int lvlno, int prcno, int lyrno)
{
jpc_enc_tcmpt_t *comp;
jpc_enc_rlvl_t *lvl;
jpc_enc_band_t *band;
jpc_enc_band_t *endbands;
jpc_enc_cblk_t *cblk;
jpc_enc_cblk_t *endcblks;
jpc_bitstream_t *outb;
jpc_enc_pass_t *pass;
jpc_enc_pass_t *startpass... | cwe | CWE-617 | Unknown |
static int test_alt_chains_cert_forgery(void)
{
int ret = 0;
int i;
X509 *x = NULL;
STACK_OF(X509) *untrusted = NULL;
BIO *bio = NULL;
X509_STORE_CTX *sctx = NULL;
X509_STORE *store = NULL;
X509_LOOKUP *lookup = NULL;
store = X509_STORE_new();
if (store == NULL)
goto err... | cwe | CWE-295 | Unknown |
/*
* Copyright (c) 2014-2015 Hisilicon Limited.
*
* 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 later version.
*/
#include <l... | cwe | CWE-119 | C/C++ |
int cJSON_GetArraySize( cJSON *array )
{
cJSON *c = array->child;
int i = 0;
while ( c ) {
++i;
c = c->next;
}
return i;
} | cwe | CWE-120 | C/C++ |
static void mcf_fec_do_tx(mcf_fec_state *s)
{
uint32_t addr;
uint32_t addr;
mcf_fec_bd bd;
int frame_size;
int len;
uint8_t frame[FEC_MAX_FRAME_SIZE];
uint8_t *ptr;
ptr = frame;
ptr = frame;
frame_size = 0;
addr = s->tx_descriptor;
while (1) {
mcf_fec_r... | cwe | CWE-835 | C/C++ |
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.... | cwe | CWE-611 | Java |
static struct tevent_req *dns_process_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct dns_server *dns,
DATA_BLOB *in)
{
struct tevent_req *req, *subreq;
struct dns_process_state *state;
enum ndr_err_code ndr_err;
WERROR ret;
const char *forwarder = lpcfg_dns_forwarder(dns->task-... | cwe | CWE-20 | Unknown |
result.set(value: .urlEncoded(value), forPath: [])
case 2:
let key = kv[0]
let value = String(kv[1])
result.set(value: .urlEncoded(value), forPath: try parseKey(key: Substring(key)))
default:
//Empty `&&`
continue
... | cwe | CWE-674 | Swift |
char* parseValue( char* ptr, FileNode& node )
{
if (!ptr)
CV_PARSE_ERROR_CPP("Invalid value input");
ptr = skipSpaces( ptr );
if( !ptr || !*ptr )
CV_PARSE_ERROR_CPP( "Unexpected End-Of-File" );
if( *ptr == '"' )
{ /* must be string or Base64 string... | cwe | CWE-787 | Unknown |
void AbstractSqlStorage::addConnectionToPool()
{
QMutexLocker locker(&_connectionPoolMutex);
// we have to recheck if the connection pool already contains a connection for
// this thread. Since now (after the lock) we can only tell for sure
if (_connectionPool.contains(QThread::currentThread()))
... | cwe | CWE-89 | Unknown |
free_buf_options(
buf_T *buf,
int free_p_ff)
{
if (free_p_ff)
{
clear_string_option(&buf->b_p_fenc);
clear_string_option(&buf->b_p_ff);
clear_string_option(&buf->b_p_bh);
clear_string_option(&buf->b_p_bt);
}
#ifdef FEAT_FIND_ID
clear_string_option(&buf->b_p_def);
clear_string_option(&bu... | cwe | CWE-416 | C/C++ |
void CoordinatorImpl::RequestGlobalMemoryDumpAndAppendToTrace(
MemoryDumpType dump_type,
MemoryDumpLevelOfDetail level_of_detail,
const RequestGlobalMemoryDumpAndAppendToTraceCallback& callback) {
auto adapter =
[](const RequestGlobalMemoryDumpAndAppendToTraceCallback& callback,
bool s... | cwe | CWE-269 | C/C++ |
static void cmd_help(void)
{
prot_printf(nntp_out, "100 Supported commands:\r\n");
if ((nntp_capa & MODE_READ) && (nntp_userid || allowanonymous)) {
prot_printf(nntp_out, "\tARTICLE [ message-id | number ]\r\n"
"\t\tRetrieve entirety of the specified article.\r\n");
}
if (!nntp_authstate) {
if ... | cwe | CWE-287 | Unknown |
/*
* Copyright (C) 2015 Red Hat, Inc.
* 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, including
* without limitation the rights to use, co... | cwe | CWE-399 | C/C++ |
int dtls1_accept(SSL *s)
{
BUF_MEM *buf;
unsigned long l,Time=(unsigned long)time(NULL);
void (*cb)(const SSL *ssl,int type,int val)=NULL;
int ret= -1;
int new_state,state,skip=0;
int listen;
RAND_add(&Time,sizeof(Time),0);
ERR_clear_error();
clear_sys_error();
if (s->info_callback != NULL)
cb=s->info_ca... | cwe | CWE-310 | Unknown |
/*!
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.
*/
/* global filesList */
// 文件
const __DEFAULT_ALL = 'ALL'
let __FolderData ... | cwe | CWE-89 | Java |
static Image *ReadPSImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define BoundingBox "BoundingBox:"
#define BeginDocument "BeginDocument:"
#define BeginXMPPacket "<?xpacket begin="
#define EndXMPPacket "<?xpacket end="
#define ICCProfile "BeginICCProfile:"
#define CMYKCustomColor "CMYKCustomColor:... | cwe | CWE-703 | C/C++ |
static int fetch_uidl(char *line, void *data)
{
int i, index;
struct Context *ctx = (struct Context *) data;
struct PopData *pop_data = (struct PopData *) ctx->data;
char *endp = NULL;
errno = 0;
index = strtol(line, &endp, 10);
if (errno)
return -1;
while (*endp == ' ')
endp++;
memmove(lin... | cwe | CWE-824 | C/C++ |
njs_vmcode_interpreter(njs_vm_t *vm, u_char *pc, void *promise_cap,
void *async_ctx)
{
u_char *catch;
double num, exponent;
int32_t i32;
uint32_t u32;
njs_str_t string;
njs_uint_t ... | cwe | CWE-125 | Unknown |
#include "common/http/conn_manager_impl.h"
#include <cstdint>
#include <functional>
#include <list>
#include <memory>
#include <string>
#include <vector>
#include "envoy/buffer/buffer.h"
#include "envoy/common/time.h"
#include "envoy/event/dispatcher.h"
#include "envoy/event/scaled_range_timer_manager.h"
#include "en... | cwe | CWE-22 | C/C++ |
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from typing import Optional, Tuple
from onefuzztypes.events import EventInstanceConfigUpdated
from onefuzztypes.models import InstanceConfig as BASE_CONFIG
from pydantic import Field
from .azure.creds import get_instance... | cwe | CWE-863 | Python |
status_t BnHDCP::onTransact(
uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
switch (code) {
case HDCP_SET_OBSERVER:
{
CHECK_INTERFACE(IHDCP, data, reply);
sp<IHDCPObserver> observer =
interface_cast<IHDCPObserver>(data.readStrongBinder());
r... | cwe | CWE-200 | C/C++ |
@mod.route('/edit/<int:cmt_id>', methods=['GET', 'POST'])
def edit(cmt_id):
m = None
if request.method == 'GET':
sql = "SELECT * FROM comment where cmt_id = %d;" % (cmt_id)
cursor.execute(sql)
m = cursor.fetchone()
return render_template('comment/edit.html', m=m, cmt_id=cmt_id)
... | cwe | CWE-89 | Python |
rsCStrExtendBuf(cstr_t *pThis, size_t iMinNeeded)
{
uchar *pNewBuf;
unsigned short iNewSize;
DEFiRet;
/* first compute the new size needed */
if(iMinNeeded > RS_STRINGBUF_ALLOC_INCREMENT) {
/* we allocate "n" ALLOC_INCREMENTs. Usually, that should
* leave some room after the absolutely needed one. It also
... | cwe | CWE-189 | C/C++ |
static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
struct sg_io_hdr *hdr, fmode_t mode)
{
if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len))
return -EFAULT;
if (blk_verify_command(&q->cmd_filter, rq->cmd, mode & FMODE_WRITE))
return -EPERM;
/*
* fill in request structure
*/... | cwe | CWE-399 | Unknown |
status_handler (void *opaque, int fd)
{
struct io_cb_data *data = (struct io_cb_data *) opaque;
engine_uiserver_t uiserver = (engine_uiserver_t) data->handler_value;
gpgme_error_t err = 0;
char *line;
size_t linelen;
do
{
err = assuan_read_line (uiserver->assuan_ctx, &line, &linelen);
if (e... | cwe | CWE-119 | Unknown |
enum ImapAuthRes imap_auth_login(struct ImapData *idata, const char *method)
{
char q_user[SHORT_STRING], q_pass[SHORT_STRING];
char buf[STRING];
int rc;
if (mutt_bit_isset(idata->capabilities, LOGINDISABLED))
{
mutt_message(_("LOGIN disabled on this server."));
return IMAP_AUTH_UNAVAIL;
}
if (m... | cwe | CWE-77 | Unknown |
protected function _mkdir($path, $name)
{
$path = $this->_joinPath($path, $name);
if ($this->connect->mkdir($path) === false) {
return false;
}
$this->options['dirMode'] && $this->connect->chmod($this->options['dirMode'], $path);
return $path;
} | cwe | CWE-78 | PHP |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2021
* All rights reserved
*
* This file is part of GPAC / MPEG-4 visual p2 xvid decoder filter
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GN... | cwe | CWE-416 | C/C++ |
get_address(
exarg_T *eap UNUSED,
char_u **ptr,
cmd_addr_T addr_type,
int skip, // only skip the address, don't use it
int silent, // no errors or side effects
int to_other_file, // flag: may jump to other file
int address_count UNUSED) // 1 for first address, >1 after comma
{
int... | cwe | CWE-787 | C/C++ |
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available... | cwe | CWE-20 | Java |
int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
{
int al,i,j,ret;
unsigned int n;
SSL3_RECORD *rr;
void (*cb)(const SSL *ssl,int type2,int val)=NULL;
if (s->s3->rbuf.buf == NULL) /* Not initialized yet */
if (!ssl3_setup_buffers(s))
return(-1);
if ((type && (type != SSL3_RT_A... | cwe | CWE-119 | Unknown |
lookup_bytestring(netdissect_options *ndo, register const u_char *bs,
const unsigned int nlen)
{
struct enamemem *tp;
register u_int i, j, k;
if (nlen >= 6) {
k = (bs[0] << 8) | bs[1];
j = (bs[2] << 8) | bs[3];
i = (bs[4] << 8) | bs[5];
} else if (nlen >= 4) {
k = (bs[0] << 8) | bs[1];
j = (bs[2] << ... | cwe | CWE-125 | C/C++ |
# -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
# Copyright 2018 New Vector Ltd
# Copyright 2019 Matrix.org Federation C.I.C
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | cwe | CWE-400 | Python |
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let r=Promise.resolve();return i[e]||(r=new Promise((async r=>{if("document"in self){const i=document.createElement("script");i.src=e,document.head.appendChild(i),i.onload=r}else importScripts(e),r()}))),r.then((()=>{if(!i[e])throw new Error(`Module ${e} didn’t reg... | cwe | CWE-79 | JavaScript |
write_vector_vector(BitWriter& w,
int nitems1, std::vector<T>& vec1, int T::*nitems2,
int bits, std::vector<int> T::*vec2)
{
// nitems1 times, write nitems2 (from the ith element of vec1) items
// from the vec2 vector field of the ith item of vec1.
for (int i1 = 0; i1 < nitems1; ++i1)
{
for... | cwe | CWE-787 | Unknown |
/*
etterfilter -- the actual compiler
Copyright (C) ALoR & NaGA
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 later... | cwe | CWE-125 | C/C++ |
int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r,
const BIGNUM *scalar, const EC_POINT *point,
BN_CTX *ctx)
{
int i, cardinality_bits, group_top, kbit, pbit, Z_is_one;
EC_POINT *p = NULL;
EC_POINT *s = NULL;
BIGNUM *k = NULL;
BIGNUM *lambd... | cwe | CWE-320 | Unknown |
/* Listpack -- A lists of strings serialization format
*
* This file implements the specification you can find at:
*
* https://github.com/antirez/listpack
*
* Copyright (c) 2017, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with ... | cwe | CWE-680 | C/C++ |
static int decode_avp(struct l2tp_avp_t *avp, const struct l2tp_attr_t *RV,
const char *secret, size_t secret_len)
{
MD5_CTX md5_ctx;
uint8_t md5[MD5_DIGEST_LENGTH];
uint8_t p1[MD5_DIGEST_LENGTH];
uint8_t *prev_block = NULL;
uint16_t attr_len;
uint16_t orig_attr_len;
uint16_t bytes_left;
uint16_t blocks... | cwe | CWE-119 | C/C++ |
//
// Common support functions for pdfio.
//
// Copyright © 2021 by Michael R Sweet.
//
// Licensed under Apache License v2.0. See the file "LICENSE" for more
// information.
//
//
// Include necessary headers...
//
#include "pdfio-private.h"
//
// Local functions...
//
static bool fill_buffer(pdfio_file_t *pdf);... | cwe | CWE-835 | C/C++ |
void vrend_renderer_context_destroy(uint32_t handle)
{
struct vrend_decode_ctx *ctx;
bool ret;
if (handle >= VREND_MAX_CTX)
return;
ctx = dec_ctx[handle];
if (!ctx)
return;
vrend_hw_switch_context(dec_ctx[0]->grctx, true);
} | cwe | CWE-476 | Unknown |
mxResources.get("dragImagesHere"));l.appendChild(x);var A={},z=null,L=null,M=null;f=function(F){"true"!=mxEvent.getSource(F).getAttribute("contentEditable")&&null!=M&&(M(),M=null,mxEvent.consume(F))};mxEvent.addListener(v,"mousedown",f);mxEvent.addListener(v,"pointerdown",f);mxEvent.addListener(v,"touchstart",f);var n=... | cwe | CWE-20 | JavaScript |
static inline int xrstor_state_booting(struct xsave_struct *fx, u64 mask)
{
u32 lmask = mask;
u32 hmask = mask >> 32;
int err = 0;
WARN_ON(system_state != SYSTEM_BOOTING);
if (boot_cpu_has(X86_FEATURE_XSAVES))
asm volatile("1:"XRSTORS"\n\t"
"2:\n\t"
: : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
: ... | cwe | CWE-20 | Unknown |
bool ParseState::do_string(CephContext* cct, const char* s, size_t l) {
auto k = pp->tokens.lookup(s, l);
Policy& p = pp->policy;
bool is_action = false;
bool is_validaction = false;
Statement* t = p.statements.empty() ? nullptr : &(p.statements.back());
// Top level!
if ((w->id == TokenID::Version) && k... | cwe | CWE-617 | C/C++ |
package archiver
import (
"fmt"
"io"
"log"
"os"
"path/filepath"
"runtime"
)
// Archiver represent a archive format
type Archiver interface {
// Match checks supported files
Match(filename string) bool
// Make makes an archive file on disk.
Make(destination string, sources []string) error
// Open extracts a... | cwe | CWE-22 | Go |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
auto* params =
reinterpret_cast<TfLiteSpaceToDepthParams*>(node->builtin_data);
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input;
TF_LITE_ENSURE_OK(context, GetInp... | cwe | CWE-369 | Unknown |
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
function getKeysRecursive(dic, key, attr, array) {
Object.values(dic).forEach((v) => {
if (v[key] !== undefined) {
getKeysRecursive(v[key], key, attr, array);
} e... | cwe | CWE-918 | JavaScript |
def set_multi(self, mapping, server_key, serialize=True, timeout=0):
"""
Sets multiple key/value pairs in memcache.
:param mapping: dictonary of keys and values to be set in memcache
:param servery_key: key to use in determining which server in the ring
is us... | cwe | CWE-502 | Python |
/*
* 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 |
asocket* find_local_socket(unsigned local_id, unsigned peer_id) {
asocket* s;
asocket* result = NULL;
adb_mutex_lock(&socket_list_lock);
for (s = local_socket_list.next; s != &local_socket_list; s = s->next) {
if (s->id != local_id) {
continue;
}
if (peer_id == 0 || (s->pee... | cwe | CWE-264 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% CCC U U TTTTT ... | cwe | CWE-908 | C/C++ |
void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer)
{
usb_kill_urb(mixer->urb);
usb_kill_urb(mixer->rc_urb);
} | cwe | CWE-787 | Unknown |
void FilterManager::maybeEndDecode(bool end_stream) {
ASSERT(!state_.remote_decode_complete_);
state_.remote_decode_complete_ = end_stream;
if (end_stream) {
stream_info_.downstreamTiming().onLastDownstreamRxByteReceived(dispatcher().timeSource());
ENVOY_STREAM_LOG(debug, "request end stream", *this);
}... | cwe | CWE-416 | Unknown |
/*
Copyright The containerd 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... | cwe | CWE-770 | Go |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-772 | C/C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.