code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok)
{
hm_fragment *frag = NULL;
pitem *item = NULL;
int i = -1, is_complete;
unsigned char seq64be[8];
unsigned long frag_len = msg_hdr->frag_len, max_len;
if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len)
goto err;
/* Determine maximum... | cwe | CWE-119 | Unknown |
package com.salesmanager.shop.admin.controller.content;
import java.io.ByteArrayInputStream;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.htt... | cwe | CWE-639 | Java |
bool AudioRendererAlgorithm::OutputFasterPlayback(uint8* dest) {
DCHECK_LT(index_into_window_, window_size_);
DCHECK_GT(playback_rate_, 1.0);
if (audio_buffer_.forward_bytes() < bytes_per_frame_)
return false;
int input_step = window_size_;
int output_step = ceil(window_size_ / playback_rate_);
Ali... | cwe | CWE-119 | C/C++ |
int dmarc_process() {
int sr, origin; /* used in SPF section */
int dmarc_spf_result = 0; /* stores spf into dmarc conn ctx */
pdkim_signature *sig = NULL;
BOOL has_dmarc_record = TRUE;
u_char **ruf; /* forensic report addressees, if called for */
/* ACLs have "control=dmarc_disabl... | cwe | CWE-20 | Unknown |
void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
int i, j;
Guchar *inp, *tmp_line;
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
tmp_line = (Guchar *) gmalloc (length * nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++... | cwe | CWE-189 | C/C++ |
$event = mysqli_fetch_assoc($result);
if($queue == "active"){
$ged_command = "-drop -type $ged_type_nbr -queue $queue ";
foreach ($array_ged_packets as $key => $value) {
if($value["key"] == true){
$ged_command .= "\"".$event[$key]."\" ";
}
}
$ged_command = trim($ged_command, " ");
shell_... | cwe | CWE-78 | PHP |
/*
* Copyright (c) 2007 innoSysTec (R) GmbH, Germany. All rights reserved.
* Original author: Edmund Wagner
* Creation date: 22.05.2007
*
* Source: $HeadURL$
* Last changed: $LastChangedDate$
*
* the unrar licence applies to all junrar source and binary distributions
* you are not allowed to use this source to... | cwe | CWE-399 | Java |
read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id,
uint32_t offset, uint32_t length, uint8_t *frubuf)
{
uint32_t off = offset, tmp, finish;
struct ipmi_rs * rsp;
struct ipmi_rq req;
uint8_t msg_data[4];
if (offset > fru->size) {
lprintf(LOG_ERR, "Read FRU Area offset incorrect: %d > %d"... | cwe | CWE-120 | C/C++ |
function insertRequirement(name, description, achievementID, reqElec, connection)
{
var strQuery = "INSERT INTO requirement VALUES('"+name+"', '" + description +
"', '" + achievementID+"', '"+reqElec+ "', 'NULL')";
connection.query( strQuery, function(err, rows)
{if(err) {
throw err;
}else{
if(debug)... | cwe | CWE-89 | JavaScript |
ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
const struct isakmp_gen *ext, u_int item_len,
const u_char *ep _U_, uint32_t phase, uint32_t doi _U_,
uint32_t proto _U_, int depth _U_)
{
#define USE_IPSECDOI_IN_PHASE1 1
const struct ikev1_pl_id *p;
struct ikev1_pl_id id;
static const... | cwe | CWE-125 | C/C++ |
static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen,
const unsigned char *sess_id, int sesslen,
SSL_SESSION **psess)
{
SSL_SESSION *sess;
unsigned char *sdec;
const unsigned char *p;
int slen, mlen, renew_ticket = 0;
unsigned char tick_hmac[EVP_MAX_MD_SIZE];
HMAC_CTX hctx;
EVP... | cwe | CWE-20 | Unknown |
/*
===========================================================================
Copyright (C) 2005 - 2015, ioquake3 contributors
Copyright (C) 2013 - 2015, OpenJK contributors
This file is part of the OpenJK source code.
OpenJK is free software; you can redistribute it and/or modify it
under the terms of the GNU Gener... | cwe | CWE-269 | C/C++ |
import io
import json
import mimetypes
import re
import uuid
from collections import OrderedDict
import requests
from PIL import UnidentifiedImageError
from annoying.decorators import ajax_request
from annoying.functions import get_object_or_None
from django.contrib import messages
from django.contrib.auth.models impo... | cwe | CWE-918 | Python |
jas_stream_t *jas_stream_memopen(char *buf, int bufsize)
{
jas_stream_t *stream;
jas_stream_memobj_t *obj;
JAS_DBGLOG(100, ("jas_stream_memopen(%p, %d)\n", buf, bufsize));
if (!(stream = jas_stream_create())) {
return 0;
}
/* A stream associated with a memory buffer is always opened
for both reading and wri... | cwe | CWE-369 | Unknown |
static inline void net_tx_pkt_sendv(struct NetTxPkt *pkt,
NetClientState *nc, const struct iovec *iov, int iov_cnt)
{
if (pkt->is_loopback) {
nc->info->receive_iov(nc, iov, iov_cnt);
} else {
qemu_sendv_packet(nc, iov, iov_cnt);
}
} | cwe | CWE-835 | Unknown |
package server
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/pkg/errors"
"github.com/usememos/memos/api"
metric "github.com/usememos/memos/plugin/metrics"
"github.com/usememos/memos/server/profile"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store/db"
"github.com/gorilla/ses... | cwe | CWE-79 | Go |
/*
* Copyright 2013-2020 the original author or 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 a... | cwe | CWE-863 | Java |
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-617 | Python |
ast2obj_type_ignore(void* _o)
{
type_ignore_ty o = (type_ignore_ty)_o;
PyObject *result = NULL, *value = NULL;
if (!o) {
Py_INCREF(Py_None);
return Py_None;
}
switch (o->kind) {
case TypeIgnore_kind:
result = PyType_GenericNew(TypeIgnore_type, NULL, NULL);
if (!r... | cwe | CWE-125 | C/C++ |
$.fn.badge = function ( text, inline ) {
var div, $badge = this.find( '.mw-badge' );
if ( text ) {
// If a badge already exists, reuse it
if ( $badge.length ) {
$badge.find( '.mw-badge-content' ).text( text );
} else {
// Otherwise, create a new badge with the specified text and style
div = do... | cwe | CWE-79 | JavaScript |
gdm_session_worker_finalize (GObject *object)
{
GdmSessionWorker *worker;
g_return_if_fail (object != NULL);
g_return_if_fail (GDM_IS_SESSION_WORKER (object));
worker = GDM_SESSION_WORKER (object);
g_return_if_fail (worker->priv != NULL);
gdm_session_worker_unwatch_ch... | cwe | CWE-362 | Unknown |
void setPaths(final String s) {
try {
final ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(s.getBytes("8859_1")));
this.paths = (WorkBundle) ois.readObject();
} catch (Exception e) {
logger.error("Cannot deserialize WorkBund... | cwe | CWE-502 | Java |
/*
* random.c -- A strong random number generator
*
* Copyright (C) 2017 Jason A. Donenfeld <Jason@zx2c4.com>. All
* Rights Reserved.
*
* Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005
*
* Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All
* rights reserved.
*
* Redistribution and ... | cwe | CWE-200 | C/C++ |
package com.fit2cloud.provider.impl.huawei.api;
import com.aliyun.tea.TeaException;
import com.fit2cloud.common.exception.Fit2cloudException;
import com.fit2cloud.common.log.utils.LogUtil;
import com.fit2cloud.common.provider.entity.F2CEntityType;
import com.fit2cloud.common.provider.entity.F2CPerfMetricMonitorData;
i... | cwe | CWE-284 | Java |
void DevToolsSession::ReceivedBadMessage() {
MojoConnectionDestroyed();
if (process_) {
bad_message::ReceivedBadMessage(
process_, bad_message::RFH_INCONSISTENT_DEVTOOLS_MESSAGE);
}
} | cwe | CWE-20 | C/C++ |
ps_parser_skip_PS_token( PS_Parser parser )
{
/* Note: PostScript allows any non-delimiting, non-whitespace */
/* character in a name (PS Ref Manual, 3rd ed, p31). */
/* PostScript delimiters are (, ), <, >, [, ], {, }, /, and %. */
FT_Byte* cur = parser->cursor;
... | cwe | CWE-125 | C/C++ |
gss_inquire_context(
OM_uint32 *minor_status,
gss_ctx_id_t context_handle,
gss_name_t *src_name,
gss_name_t *targ_name,
OM_uint32 *lifetime_rec,
gss_OID *mech_type,
OM_uint32 *ctx_flags,
int *locally_initiated,
int *opened)
{
gss_union_ctx_id_t ctx;
gss_mechanism mec... | cwe | CWE-415 | C/C++ |
static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel TSRMLS_DC)
{
size_t idex;
void *vptr;
image_info_value *info_value;
image_info_data *info_data;
image_info_data *list;
if (length < 0) {
return;
}
lis... | cwe | CWE-125 | C/C++ |
# -*- 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-613 | Python |
int main(int argc, char **argv)
{
int i, n_valid, do_write, do_scrub;
char *c, *dname, *name;
DIR *dir;
FILE *fp;
pdf_t *pdf;
pdf_flag_t flags;
if (argc < 2)
usage();
/* Args */
do_write = do_scrub = flags = 0;
name = NULL;
for (i=1; i... | cwe | CWE-787 | Unknown |
/*
* Copyright (c) 2018. Abstrium SAS <team (at) pydio.com>
* This file is part of Pydio Cells.
*
* Pydio Cells 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 License, or
... | cwe | CWE-200 | Go |
PHP_FUNCTION(imagegammacorrect)
{
zval *IM;
gdImagePtr im;
int i;
double input, output;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rdd", &IM, &input, &output) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
if (gdImageTrueColor(im)) {
int x, y, c;
for (... | cwe | CWE-787 | Unknown |
def listAllUsers(usernamePrefix: String): Action[Unit] = GetAction { request =>
// Authorization check: Is a member? Add MemberGetAction?
request.theMember
val json = listAllUsersImpl(usernamePrefix, request)
OkSafeJson(json)
}
SECURITY // user listing disabled? [8FKU2A4] | cwe | CWE-613 | Scala |
int rtp_packetize_xiph_config( sout_stream_id_sys_t *id, const char *fmtp,
int64_t i_pts )
{
if (fmtp == NULL)
return VLC_EGENERIC;
/* extract base64 configuration from fmtp */
char *start = strstr(fmtp, "configuration=");
assert(start != NULL);
start += sizeo... | cwe | CWE-787 | C/C++ |
#ifndef JSI_LITE_ONLY
#ifndef JSI_AMALGAMATION
#include "jsiInt.h"
#endif
#define ChkString(_this, funcPtr, dest, lenPtr, bytePtr) \
int skip __attribute__((unused)); skip = 0; \
if (_this->vt != JSI_VT_OBJECT || _this->d.obj->ot != JSI_OT_STRING) { \
Jsi_LogError("apply String.%s to a non-string o... | cwe | CWE-120 | C/C++ |
void WT_VoiceGain (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)
{
EAS_I32 *pMixBuffer;
EAS_PCM *pInputBuffer;
EAS_I32 gain;
EAS_I32 gainIncrement;
EAS_I32 tmp0;
EAS_I32 tmp1;
EAS_I32 tmp2;
EAS_I32 numSamples;
#if (NUM_OUTPUT_CHANNELS == 2)
EAS_I32 gainLeft, gainRight;
#endif
... | cwe | CWE-119 | C/C++ |
void swiotlb_sync_single_for_device(struct device *dev, phys_addr_t tlb_addr,
size_t size, enum dma_data_direction dir)
{
if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)
swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE);
else
BUG_ON(dir != DMA_FROM_DEVICE);
} | cwe | CWE-200 | Unknown |
bool PermissionsRequestFunction::RunImpl() {
if (!user_gesture() && !ignore_user_gesture_for_tests) {
error_ = kUserGestureRequiredError;
return false;
}
scoped_ptr<Request::Params> params(Request::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
requested_permissions_ =
... | cwe | CWE-264 | C/C++ |
static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
format[MaxTextExtent],
keyword[MaxTextExtent],
tag[MaxTextExtent],
value[MaxTextExtent];
double
gamma;
Image
*image;
int
c;
MagickBooleanType
status,
value_expected;
register Pixe... | cwe | CWE-120 | C/C++ |
spnego_gss_import_sec_context(
OM_uint32 *minor_status,
const gss_buffer_t interprocess_token,
gss_ctx_id_t *context_handle)
{
OM_uint32 ret;
ret = gss_import_sec_context(minor_status,
interprocess_token,
context_handle);
return (ret);
} | cwe | CWE-763 | Unknown |
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const name = ctx.params.name ?? 'i';
const limit = ctx.query.limit ? parseInt(ctx.query.limit) : '50';
const rootUrl = `${name}.lofter.com`;
const response = await got({
... | cwe | CWE-918 | JavaScript |
OME.WellBirdsEye = function(opts) {
var $tree_details = $("#tree_details");
var $well_details = $("#well_details");
var $well_birds_eye = $("#well_birds_eye");
function selectionChanged() {
var imageIds = [];
$('.ui-selected', $well_birds_eye).each(function(ws){... | cwe | CWE-116 | JavaScript |
Init_ossl_cipher(void)
{
#if 0
mOSSL = rb_define_module("OpenSSL");
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
#endif
/* Document-class: OpenSSL::Cipher
*
* Provides symmetric algorithms for encryption and decryption. The
* algorithms that are available dep... | cwe | CWE-703 | Unknown |
MONGO_EXPORT void *bson_malloc( int size ) {
void *p;
p = bson_malloc_func( size );
bson_fatal_msg( !!p, "malloc() failed" );
return p;
} | cwe | CWE-190 | C/C++ |
bool PM_io_parser<PMDEC>::read_hedge(Halfedge_handle e)
{ // syntax: index { opposite, prev, next, vertex, face, mark }
int n, eo, epr, ene, v, f; bool m;
if ( !(in >> n) ||
!check_sep("{") ||
!(in >> eo) || !check_sep(",") ||
!(in >> epr) || !check_sep(",") ||
!(in >> ene) || !check_sep... | cwe | CWE-269 | Unknown |
void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
Stream *str, int width, int height,
GfxImageColorMap *colorMap,
Stream *maskStr, int maskWidth,
int maskHeight, GBool maskInvert) {
GfxImageColorMap *maskColorMap;
Object maskDecode, decodeLow, decodeHigh;
... | cwe | CWE-189 | C/C++ |
var iter = function(value, prefix) {
if (!prefix) prefix = [];
if (Array.isArray(value)) {
value.forEach(function(arrValue, idx) {
iter(arrValue, prefix.concat(idx));
});
} else if (isPlainObject(value)) {
Object.keys(value).forEach(function(key) {
iter(val... | cwe | CWE-1321 | JavaScript |
/* Copyright (C) 2001-2019 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license ... | cwe | CWE-787 | C/C++ |
void edge_sparse_csr_reader_double( const char* i_csr_file_in,
unsigned int** o_row_idx,
unsigned int** o_column_idx,
double** o_values,
un... | cwe | CWE-787 | C/C++ |
package com.salesmanager.shop.model.catalog.product;
import java.io.Serializable;
/**
* Lightweight version of Persistable product
* @author carlsamson
*
*/
public class LightPersistableProduct implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String price;
... | cwe | CWE-79 | Java |
sendDigest(username, lastSeenAt, email) {
return ajax("/admin/email/send-digest.json", {
data: { last_seen_at: lastSeenAt || oneWeekAgo(), username, email },
});
} | cwe | CWE-200 | JavaScript |
static int load_elf_binary(struct linux_binprm *bprm)
{
struct file *interpreter = NULL; /* to shut gcc up */
unsigned long load_addr = 0, load_bias = 0;
int load_addr_set = 0;
char * elf_interpreter = NULL;
unsigned long error;
struct elf_phdr *elf_ppnt, *elf_phdata, *interp_elf_phdata = NULL;
unsigned long el... | cwe | CWE-362 | C/C++ |
// mkerrors.sh -Wall -Werror -static -I/tmp/include
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mips,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
package unix
import "syscall"
const (
B1000000 ... | cwe | CWE-287 | Go |
private static boolean unzip(InputStream in, VFSContainer targetDir, Identity identity, boolean versioning) {
VFSRepositoryService vfsRepositoryService = CoreSpringFactory.getImpl(VFSRepositoryService.class);
try(ZipInputStream oZip = new ZipInputStream(in)) {
// unzip files
ZipEntry oEntr = oZip.getNex... | cwe | CWE-22 | Java |
static void atusb_disconnect(struct usb_interface *interface)
{
struct atusb *atusb = usb_get_intfdata(interface);
dev_dbg(&atusb->usb_dev->dev, "%s\n", __func__);
atusb->shutdown = 1;
cancel_delayed_work_sync(&atusb->work);
usb_kill_anchored_urbs(&atusb->rx_urbs);
atusb_free_urbs(atusb);
usb_kill_urb(atusb->... | cwe | CWE-416 | C/C++ |
static jpc_enc_cp_t *cp_create(const char *optstr, jas_image_t *image)
{
jpc_enc_cp_t *cp;
jas_tvparser_t *tvp;
int ret;
int numilyrrates;
double *ilyrrates;
int i;
int tagid;
jpc_enc_tcp_t *tcp;
jpc_enc_tccp_t *tccp;
jpc_enc_ccp_t *ccp;
uint_fast16_t rlvlno;
uint_fast16_t prcwidthexpn;
uint_fast16_t prche... | cwe | CWE-20 | C/C++ |
/**
* @file tree_data.c
* @author Radek Krejci <rkrejci@cesnet.cz>
* @brief Manipulation with libyang data structures
*
* Copyright (c) 2015 - 2018 CESNET, z.s.p.o.
*
* This source code is licensed under BSD 3-Clause License (the "License").
* You may not use this file except in compliance with the License.
* ... | cwe | CWE-119 | C/C++ |
text: text({ url, host }),
html: html({ url, host, email }),
})
},
options,
}
} | cwe | CWE-79 | JavaScript |
static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags)
{
struct frag *f;
struct list_head *item;
int rec, num, group;
BUG_ON (!data || !frags);
if (size < 2 * VBLK_SIZE_HEAD) {
ldm_error("Value of size is to small.");
return false;
}
group = get_unaligned_be32(data + 0x08);
rec = ... | cwe | CWE-119 | C/C++ |
pathParams: match.slice(1),
req,
res
});
}
catch (e) {
log.error(`Custom handler ${note.noteId} failed with ${e.message}`);
res.status(500).send(e.message);
}
}
else if (attr.name... | cwe | CWE-79 | JavaScript |
PHP_METHOD(Phar, loadPhar)
{
char *fname, *alias = NULL, *error;
size_t fname_len, alias_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
return;
}
phar_request_initialize();
RETVAL_BOOL(phar_open_from... | cwe | CWE-20 | C/C++ |
void show_opcodes(u8 *rip, const char *loglvl)
{
#define PROLOGUE_SIZE 42
#define EPILOGUE_SIZE 21
#define OPCODE_BUFSIZE (PROLOGUE_SIZE + 1 + EPILOGUE_SIZE)
u8 opcodes[OPCODE_BUFSIZE];
if (probe_kernel_read(opcodes, rip - PROLOGUE_SIZE, OPCODE_BUFSIZE)) {
printk("%sCode: Bad RIP value.\n", loglvl);
} else {
pr... | cwe | CWE-20 | C/C++ |
InputSource::readLine(size_t max_line_length)
{
// Return at most max_line_length characters from the next line.
// Lines are terminated by one or more \r or \n characters.
// Consume the trailing newline characters but don't return them.
// After this is called, the file will be positioned after a line... | cwe | CWE-787 | Unknown |
ctcompare(const char *a, /* I - First string */
const char *b) /* I - Second string */
{
int result = 0; /* Result */
while (*a && *b)
{
result |= *a ^ *b;
a ++;
b ++;
}
return (result);
} | cwe | CWE-697 | C/C++ |
MONGO_EXPORT int mongo_insert_batch( mongo *conn, const char *ns,
const bson **bsons, int count, mongo_write_concern *custom_write_concern,
int flags ) {
mongo_message *mm;
mongo_write_concern *write_concern = NULL;
int i;
char *... | cwe | CWE-190 | Unknown |
void rose_stop_heartbeat(struct sock *sk)
{
del_timer(&sk->sk_timer);
} | cwe | CWE-416 | Unknown |
void ExtensionViewGuest::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
if (attached() && (params.url.GetOrigin() != url_.GetOrigin())) {
bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(),
... | cwe | CWE-200 | C/C++ |
void snd_info_free_entry(struct snd_info_entry * entry)
{
struct snd_info_entry *p, *n;
if (!entry)
return;
if (entry->p) {
mutex_lock(&info_mutex);
snd_info_disconnect(entry);
mutex_unlock(&info_mutex);
}
/* free all children at first */
list_for_each_entry_safe(p, n, &entry->children, list)
snd_info... | cwe | CWE-416 | Unknown |
package server
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/pkg/errors"
"github.com/usememos/memos/api"
metric "github.com/usememos/memos/plugin/metrics"
"github.com/usememos/memos/server/profile"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store/db"
"github.com/gorilla/ses... | cwe | CWE-79 | Go |
ssize_t __weak cpu_show_tsx_async_abort(struct device *dev,
struct device_attribute *attr,
char *buf)
{
return sprintf(buf, "Not affected\n");
} | cwe | CWE-787 | Unknown |
void process_packet_tail(struct msg_digest *md)
{
struct state *st = md->st;
enum state_kind from_state = md->v1_from_state;
const struct state_v1_microcode *smc = md->smc;
bool new_iv_set = md->new_iv_set;
bool self_delete = FALSE;
if (md->hdr.isa_flags & ISAKMP_FLAGS_v1_ENCRYPTION) {
endpoint_buf b;
dbg("r... | cwe | CWE-125 | C/C++ |
process_open(u_int32_t id)
{
u_int32_t pflags;
Attrib a;
char *name;
int r, handle, fd, flags, mode, status = SSH2_FX_FAILURE;
if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0 ||
(r = sshbuf_get_u32(iqueue, &pflags)) != 0 || /* portable flags */
(r = decode_attrib(iqueue, &a)) != 0)
fatal("%s: b... | cwe | CWE-732 | C/C++ |
BufferInputSource::seek(qpdf_offset_t offset, int whence)
{
switch (whence)
{
case SEEK_SET:
this->cur_offset = offset;
break;
case SEEK_END:
this->cur_offset = this->buf->getSize() + offset;
break;
case SEEK_CUR:
this->cur_offset += offset;
break;
default:
throw std::logic_err... | cwe | CWE-787 | Unknown |
IDNSpoofChecker::IDNSpoofChecker() {
UErrorCode status = U_ZERO_ERROR;
checker_ = uspoof_open(&status);
if (U_FAILURE(status)) {
checker_ = nullptr;
return;
}
uspoof_setRestrictionLevel(checker_, USPOOF_HIGHLY_RESTRICTIVE);
SetAllowedUnicodeSet(&status);
int32_t checks = uspoof_getChecks(check... | cwe | CWE-20 | C/C++ |
utf32be_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
{
return (OnigCodePoint )(((p[0] * 256 + p[1]) * 256 + p[2]) * 256 + p[3]);
} | cwe | CWE-125 | Unknown |
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-120 | Python |
function Se(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}} | cwe | CWE-79 | JavaScript |
jbig2_image_new(Jbig2Ctx *ctx, int width, int height)
{
Jbig2Image *image;
int stride;
int64_t check;
image = jbig2_new(ctx, Jbig2Image, 1);
if (image == NULL) {
jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "could not allocate image structure in jbig2_image_new");
return NULL;
... | cwe | CWE-190 | C/C++ |
/* The MIT License (MIT)
*
* Copyright (c) 2015 Main Street Softworks, Inc.
*
* 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 rig... | cwe | CWE-732 | C/C++ |
int tls1_enc(SSL *s, int send)
{
SSL3_RECORD *rec;
EVP_CIPHER_CTX *ds;
unsigned long l;
int bs,i,j,k,pad=0,ret,mac_size=0;
const EVP_CIPHER *enc;
if (send)
{
ds=s->enc_write_ctx;
rec= &(s->s3->wrec);
if (s->enc_write_ctx == NULL)
enc=NULL;
else
enc=EVP_CIPHER_CTX_cipher(s->enc_write_ctx);
}
e... | cwe | CWE-310 | Unknown |
libxlDomainDestroyInternal(libxlDriverPrivate *driver,
virDomainObj *vm)
{
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
libxlDomainObjPrivate *priv = vm->privateData;
int ret = -1;
/* Ignore next LIBXL_EVENT_TYPE_DOMAIN_DEATH as the caller will handle
... | cwe | CWE-667 | Unknown |
Graph.prototype.createTagsDialog = function(isEnabled, invert, addFn)
{
var graph = this;
var allTags = graph.hiddenTags.slice();
var div = document.createElement('div');
div.style.userSelect = 'none';
div.style.overflow = 'hidden';
div.style.padding = '10px';
div.style.height = '100%';
var tagCl... | cwe | CWE-94 | JavaScript |
it "returns true" do
Moped::BSON::ObjectId.new(bytes).should == Moped::BSON::ObjectId.new(bytes)
end | cwe | CWE-20 | Ruby |
module.exports = function (src, file) {
if (typeof src !== 'string') src = String(src);
try {
Function(src);
return;
}
catch (err) {
if (err.constructor.name !== 'SyntaxError') throw err;
return errorInfo(src, file);
}
}; | cwe | CWE-94 | JavaScript |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-119 | C/C++ |
package com.salesmanager.shop.model.catalog.product.product.definition;
import java.util.ArrayList;
import java.util.List;
import com.salesmanager.shop.model.catalog.category.ReadableCategory;
import com.salesmanager.shop.model.catalog.manufacturer.ReadableManufacturer;
import com.salesmanager.shop.model.catalog.prod... | cwe | CWE-639 | Java |
gaussian_blur_surface (cairo_surface_t *in,
cairo_surface_t *out,
gdouble sx,
gdouble sy)
{
gboolean use_box_blur;
gint width, height;
cairo_format_t in_format, out_format;
gint in_stride;
gint out_stride;
guchar *in_data, *out... | cwe | CWE-369 | Unknown |
@staticmethod
def get_last_active_users(limit):
"""
Get from the database a tuple of users who have been recently using
the bot
:param limit: integer that specifies how much users to get
:return: tuple of tuples with users info
"""
log.info('Evaluating last ac... | cwe | CWE-89 | Python |
static ssize_t runtime_usage_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", atomic_read(&dev->power.usage_count));
} | cwe | CWE-787 | Unknown |
static const char* ConvertOneFloat(PyObject* v, T* out) {
if (PyErr_Occurred()) {
return nullptr;
}
if (TF_PREDICT_TRUE(PyFloat_Check(v))) {
const double as_double = PyFloat_AS_DOUBLE(v);
*out = static_cast<T>(as_double);
// Check for overflow
if (TF_PREDICT_FALSE(sizeof(T) < sizeof(double) &&... | cwe | CWE-20 | C/C++ |
putCookie(cookie, cb) {
if (!this.idx[cookie.domain]) {
this.idx[cookie.domain] = {};
}
if (!this.idx[cookie.domain][cookie.path]) {
this.idx[cookie.domain][cookie.path] = {};
}
this.idx[cookie.domain][cookie.path][cookie.key] = cookie;
cb(null);
} | cwe | CWE-1321 | JavaScript |
/**
* Utility functions for web applications.
*
* @author Dave Longley
*
* Copyright (c) 2010-2018 Digital Bazaar, Inc.
*/
var forge = require('./forge');
var baseN = require('./baseN');
/* Utilities API */
var util = module.exports = forge.util = forge.util || {};
// define setImmediate and nextTick
(function(... | cwe | CWE-601 | JavaScript |
/*
* Description:
* History: yang@haipo.me, 2017/04/26, create
*/
# include <stdbool.h>
# include <openssl/sha.h>
# include "ut_log.h"
# include "ut_misc.h"
# include "ut_base64.h"
# include "ut_ws_svr.h"
struct ws_frame {
uint8_t fin;
uint8_t opcode;
uint64_t payload_len;
void ... | cwe | CWE-190 | C/C++ |
func checkAuth(ctx context.Context, config Config, auth string) (context.Context, bool) {
const basicPrefix = "Basic "
const bearerPrefix = "Bearer "
if strings.HasPrefix(auth, basicPrefix) {
// Basic authentication.
username, password, ok := parseBasicAuth(auth)
if !ok {
return ctx, false
}
if userna... | cwe | CWE-613 | Go |
function tt(t){ye.isVisible()&&nt!==t.target.value&&ye.resetValidationMessage(),nt=t.target.value} | cwe | CWE-1236 | JavaScript |
NIAddSpell(IspellDict *Conf, const char *word, const char *flag)
{
if (Conf->nspell >= Conf->mspell)
{
if (Conf->mspell)
{
Conf->mspell *= 2;
Conf->Spell = (SPELL **) repalloc(Conf->Spell, Conf->mspell * sizeof(SPELL *));
}
else
{
Conf->mspell = 1024 * 20;
Conf->Spell = (SPELL **) tmpalloc(Conf-... | cwe | CWE-119 | Unknown |
evtchn_port_t evtchn_from_irq(unsigned irq)
{
if (WARN(irq >= nr_irqs, "Invalid irq %d!\n", irq))
return 0;
return info_for_irq(irq)->evtchn;
} | cwe | CWE-476 | 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-400 | Java |
static int ia5ncasecmp(const char *s1, const char *s2, size_t n)
{
for (; n > 0; n--, s1++, s2++) {
if (*s1 != *s2) {
unsigned char c1 = (unsigned char)*s1, c2 = (unsigned char)*s2;
/* Convert to lower case */
if (c1 >= 0x41 /* A */ && c1 <= 0x5A /* Z */)
... | cwe | CWE-125 | Unknown |
static Image *ReadTIFFImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
const char
*option;
float
*chromaticity,
x_position,
y_position,
x_resolution,
y_resolution;
Image
*image;
int
tiff_status;
MagickBooleanType
status;
MagickSizeType
number_pixe... | cwe | CWE-787 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.