code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* dims = GetInput(context, node, kDimsTensor);
const TfLiteTensor* value = GetInput(context, node, kValueTensor);
// Make sure t... | cwe | CWE-787 | C/C++ |
static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num,
int nb_sectors)
{
return bdrv_check_byte_request(bs, sector_num * BDRV_SECTOR_SIZE,
nb_sectors * BDRV_SECTOR_SIZE);
} | cwe | CWE-190 | C/C++ |
wrap_lines_smart(ASS_Renderer *render_priv, double max_text_width)
{
int i;
GlyphInfo *cur, *s1, *e1, *s2, *s3;
int last_space;
int break_type;
int exit;
double pen_shift_x;
double pen_shift_y;
int cur_line;
int run_offset;
TextInfo *text_info = &render_priv->text_info;
last... | cwe | CWE-125 | C/C++ |
static bool msr_mtrr_valid(unsigned msr)
{
switch (msr) {
case 0x200 ... 0x200 + 2 * KVM_NR_VAR_MTRR - 1:
case MSR_MTRRfix64K_00000:
case MSR_MTRRfix16K_80000:
case MSR_MTRRfix16K_A0000:
case MSR_MTRRfix4K_C0000:
case MSR_MTRRfix4K_C8000:
case MSR_MTRRfix4K_D0000:
case MSR_MTRRfix4K_D8000:
case MSR_MTRRfix4K_... | cwe | CWE-284 | C/C++ |
// SPDX-License-Identifier: GPL-2.0-or-later
/* DVB USB compliant Linux driver for the Afatech 9005
* USB1.1 DVB-T receiver.
*
* Copyright (C) 2007 Luca Olivetti (luca@ventoso.org)
*
* Thanks to Afatech who kindly provided information.
*
* see Documentation/media/dvb-drivers/dvb-usb.rst for more information
*/
... | cwe | CWE-401 | C/C++ |
package com.salesmanager.shop.admin.model.permission;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPrope... | cwe | CWE-639 | Java |
static int __init unittest_data_add(void)
{
void *unittest_data;
struct device_node *unittest_data_node, *np;
/*
* __dtb_testcases_begin[] and __dtb_testcases_end[] are magically
* created by cmd_dt_S_dtb in scripts/Makefile.lib
*/
extern uint8_t __dtb_testcases_begin[];
extern uint8_t __dtb_testcases_end[];... | cwe | CWE-401 | C/C++ |
package verify
import (
"encoding/json"
"strings"
"time"
"github.com/secure-systems-lab/go-securesystemslib/cjson"
"github.com/theupdateframework/go-tuf/data"
"github.com/theupdateframework/go-tuf/internal/roles"
)
type signedMeta struct {
Type string `json:"_type"`
Expires time.Time `json:"expires"`
... | cwe | CWE-354 | Go |
import { AuthenticationError, UserInputError } from 'apollo-server';
import { camelCase, mapKeys } from 'lodash';
import RockApolloDataSource from '@apollosproject/rock-apollo-data-source';
import moment from 'moment';
import { fieldsAsObject } from '../utils';
const RockGenderMap = {
Unknown: 0,
Male: 1,
Female... | cwe | CWE-287 | JavaScript |
do_ssh2_kex(void)
{
char *myproposal[PROPOSAL_MAX] = { KEX_SERVER };
struct kex *kex;
int r;
myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
options.kex_algorithms);
myproposal[PROPOSAL_ENC_ALGS_CTOS] = compat_cipher_proposal(
options.ciphers);
myproposal[PROPOSAL_ENC_ALGS_STOC] = compat_cipher_pr... | cwe | CWE-119 | C/C++ |
bgp_handle_message(struct bgp_proto *p, byte *data, uint len, byte **bp)
{
byte *msg = data + 1;
uint msg_len = data[0];
uint i;
/* Handle zero length message */
if (msg_len == 0)
return 1;
/* Handle proper message */
if ((msg_len > 255) && (msg_len + 1 > len))
return 0;
/* Some elementary cl... | cwe | CWE-787 | Unknown |
rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent)
{
const rpki_rtr_pdu *pdu_header;
u_int pdu_type, pdu_len, hexdump;
const u_char *msg;
pdu_header = (const rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
pdu_len = EXTRACT_32BITS(pdu_header->length);
... | cwe | CWE-125 | C/C++ |
static UINT printer_process_irp_write(PRINTER_DEVICE* printer_dev, IRP* irp)
{
UINT32 Length;
UINT64 Offset;
rdpPrintJob* printjob = NULL;
UINT error = CHANNEL_RC_OK;
Stream_Read_UINT32(irp->input, Length);
Stream_Read_UINT64(irp->input, Offset);
Stream_Seek(irp->input, 20); /* Padding */
if (printer_dev->prin... | cwe | CWE-125 | Unknown |
void test_base64_lengths(void)
{
const char *in = "FuseMuse";
char out1[32];
char out2[32];
size_t enclen;
int declen;
/* Encoding a zero-length string should fail */
enclen = mutt_b64_encode(out1, in, 0, 32);
if (!TEST_CHECK(enclen == 0))
{
TEST_MSG("Expected: %zu", 0);
TEST_MSG("Actual : %... | cwe | CWE-787 | Unknown |
set_lenIV(char *line)
{
char *p = strstr(line, "/lenIV ");
/* Allow lenIV to be negative. Thanks to Tom Kacvinsky <tjk@ams.org> */
if (p && (isdigit(p[7]) || p[7] == '+' || p[7] == '-')) {
lenIV = atoi(p + 7);
}
} | cwe | CWE-119 | C/C++ |
void nsc_encode(NSC_CONTEXT* context, const BYTE* bmpdata, UINT32 rowstride)
{
nsc_encode_argb_to_aycocg(context, bmpdata, rowstride);
if (context->ChromaSubsamplingLevel)
{
nsc_encode_subsampling(context);
}
} | cwe | CWE-787 | C/C++ |
@app.route('/puppet/default', methods=['GET', 'POST'])
@cortex.lib.user.login_required
def puppet_enc_default():
"""Handles the Puppet ENC Default Classes page"""
# Check user permissions
if not does_user_have_permission("puppet.default_classes.view"):
abort(403)
# Get the default YAML out of the kv table
curd... | cwe | CWE-502 | Python |
/* JAI-Ext - OpenSource Java Advanced Image Extensions Library
* http://www.geo-solutions.it/
* Copyright 2018 GeoSolutions
*
* 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-94 | Java |
XLookupColor (
register Display *dpy,
Colormap cmap,
_Xconst char *spec,
XColor *def,
XColor *scr)
{
register int n;
xLookupColorReply reply;
register xLookupColorReq *req;
XcmsCCC ccc;
XcmsColor cmsColor_exact;
#ifdef XCMS
/*
* Let's Attempt to use Xcms and i18n approach to Parse Color
*/
if ((... | cwe | CWE-120 | C/C++ |
const exec = require('./exec');
const listProcessesOnPort = module.exports.listProcessesOnPort = async port => {
try {
const result = (await exec(`lsof -i :${port}`)).output.split('\n');
const headers = result.shift().split(' ').filter(item => !!item.trim() && item.trim() !== "").map(item => item.toLowerCase());
... | cwe | CWE-77 | JavaScript |
static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
unsigned char
attributes,
tag[3];
Image
*image;
IndexPacket
index;
MagickBooleanType
status;
PDBImage
pdb_image;
PDBInfo
pdb_info;
register IndexPacket
*indexes;
register ssize_t
... | cwe | CWE-125 | C/C++ |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
#include <openssl/rand.h>
#include <stdint.h>
#include "lsquic_crand.h"
#define OFF_MASK(crand_) ((sizeof((crand_)->rand_buf) * 2) - 1)
uint8_t
lsquic_crand_get_nybble (struct crand *crand)
{
uint8_t byte;
if (crand->nybble_off == 0... | cwe | CWE-476 | C/C++ |
void red_channel_pipes_add_empty_msg(RedChannel *channel, int msg_type)
{
RingItem *link;
RING_FOREACH(link, &channel->clients) {
red_channel_client_pipe_add_empty_msg(
SPICE_CONTAINEROF(link, RedChannelClient, channel_link),
msg_type);
}
} | cwe | CWE-399 | C/C++ |
def render(self, name, value, attrs=None):
html = super(AdminURLFieldWidget, self).render(name, value, attrs)
if value:
value = force_text(self._format_value(value))
final_attrs = {'href': mark_safe(smart_urlquote(value))}
html = format_html(
'<p class... | cwe | CWE-79 | Python |
package org.airsonic.player.controller;
import de.triology.recaptchav2java.ReCaptcha;
import org.airsonic.player.domain.User;
import org.airsonic.player.service.SecurityService;
import org.airsonic.player.service.SettingsService;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUt... | cwe | CWE-310 | Java |
rsvg_state_inherit_run (RsvgState * dst, const RsvgState * src,
const InheritanceFunction function, const gboolean inherituninheritables)
{
gint i;
if (function (dst->has_current_color, src->has_current_color))
dst->current_color = src->current_color;
if (function (dst->has_... | cwe | CWE-20 | Unknown |
void ComputeAsync(OpKernelContext* context, DoneCallback done) override {
// The shape of 'image' is [batch_size, image_height, image_width,
// channels].
const Tensor& image = context->input(0);
// The shape of 'boxes' is [num_boxes, 4].
const Tensor& boxes = context->input(1);
// The shape of ... | cwe | CWE-190 | Unknown |
package profile
import (
"bufio"
"bytes"
"context"
"crypto"
"crypto/hmac"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"crypto/sha512"
"crypto/subtle"
"crypto/tls"
"crypto/x509"
"encoding/base64"
"encoding/json"
"encoding/pem"
"fmt"
"io"
"io/ioutil"
mathrand "math/rand"
"net"
"net/http"
"net/url"
... | cwe | CWE-269 | Go |
def getCommentsLike(self,commentid):
sqlText="select userid from comment_like where commentid=%d"%(commentid)
result=sql.queryDB(self.conn,sqlText)
return result; | cwe | CWE-89 | Python |
int main(int argc, char *argv[])
{
char *p, *q, *r;
Clp_Parser *clp =
Clp_NewParser(argc, (const char * const *)argv, sizeof(options) / sizeof(options[0]), options);
program_name = Clp_ProgramName(clp);
/* interpret command line arguments using CLP */
while (1) {
int opt = Clp_Next(clp);
switch ... | cwe | CWE-119 | Unknown |
static void process_constructors (RBinFile *bf, RList *ret, int bits) {
RList *secs = sections (bf);
RListIter *iter;
RBinSection *sec;
int i, type;
r_list_foreach (secs, iter, sec) {
type = -1;
if (!strcmp (sec->name, ".fini_array")) {
type = R_BIN_ENTRY_TYPE_FINI;
} else if (!strcmp (sec->name, ".init_a... | cwe | CWE-125 | Unknown |
PUBLIC void httpSetCredentials(HttpConn *conn, cchar *username, cchar *password, cchar *authType)
{
char *ptok;
httpResetCredentials(conn);
if (password == NULL && strchr(username, ':') != 0) {
conn->username = stok(sclone(username), ":", &ptok);
conn->password = sclone(ptok);
} else... | cwe | CWE-476 | C/C++ |
mark_context_stack(mrb_state *mrb, struct mrb_context *c)
{
size_t i;
size_t e;
if (c->stack == NULL) return;
e = c->stack - c->stbase;
if (c->ci) e += c->ci->nregs;
if (c->stbase + e > c->stend) e = c->stend - c->stbase;
for (i=0; i<e; i++) {
mrb_value v = c->stbase[i];
if (!mrb_immedi... | cwe | CWE-416 | C/C++ |
function onRequest(request, response) {
var frontUrl = '';
if(request.url === '/favicon.ico') return;
for(var key in conf.serv) {
if(request.headers.host.indexOf(key) !== -1) {
host = conf.serv[key];
}
}
var nowTemp = host.frondend + (request.url.replace('/', '') || host.bas... | cwe | CWE-22 | JavaScript |
/* 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-843 | Python |
create_watching_parent (void)
{
pid_t child;
sigset_t ourset;
struct sigaction oldact[3];
int status = 0;
int retval;
retval = pam_open_session (pamh, 0);
if (is_pam_failure(retval))
{
cleanup_pam (retval);
errx (EXIT_FAILURE, _("cannot open session: %s"),
pam_strerror (pamh, retval... | cwe | CWE-362 | C/C++ |
private def authenticateWebSocket(site: SiteBrief, request: RequestHeader)
: AuthnReqHeaderImpl Or Result = {
import tyCtx.security
val dao = globals.siteDao(site.id)
val requestOrigin = request.headers.get(play.api.http.HeaderNames.ORIGIN)
val siteCanonicalOrigin = globals.originOfSiteId(site.... | cwe | CWE-613 | Scala |
function html_operation_successful( $p_redirect_url, $p_message = '' ) {
echo '<div class="success-msg">';
if( !is_blank( $p_message ) ) {
echo $p_message . '<br />';
}
echo lang_get( 'operation_successful' ).'<br />';
print_bracket_link( $p_redirect_url, lang_get( 'proceed' ) );
echo '</div>';
} | cwe | CWE-79 | PHP |
static int init_items(struct MACH0_(obj_t)* bin) {
struct load_command lc = {0, 0};
ut8 loadc[sizeof (struct load_command)] = {0};
bool is_first_thread = true;
ut64 off = 0LL;
int i, len;
bin->uuidn = 0;
bin->os = 0;
bin->has_crypto = 0;
if (bin->hdr.sizeofcmds > bin->size) {
bprintf ("Warning: chopping hdr... | cwe | CWE-416 | Unknown |
QUInt16() {} | cwe | CWE-908 | 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 |
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const { domain = '91porn.com' } = ctx.query;
const siteUrl = `https://${domain}... | cwe | CWE-918 | JavaScript |
// mkerrors.sh -Wall -Werror -static -I/tmp/include
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mips64le,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 |
rsvg_css_parse_xml_attribute_string (const char *attribute_string)
{
xmlSAXHandler handler;
xmlParserCtxtPtr parser;
xmlDocPtr doc;
xmlNodePtr node;
xmlAttrPtr attr;
char *tag;
GPtrArray *attributes;
char **retval = NULL;
tag = g_strdup_printf ("<rsvg-hack %s />\n", attribute_string... | cwe | CWE-20 | Unknown |
def set_inboxes
@inbox_ids = if params[:inbox_id]
current_account.inboxes.where(id: params[:inbox_id])
else
@current_user.assigned_inboxes.pluck(:id)
end | cwe | CWE-639 | Ruby |
void get_cmdln_options(int argc, char *argv[]) {
int o;
#if CONFIG_FILE && HAVE_GETPWUID
static struct passwd *pwd_entry;
char *str;
#endif
#ifdef LONG_OPTIONS
int option_index = 0;
static struct option long_options[] = {
{"timeout", 1, 0, 't'},
#ifdef PROC_NET_DEV
{"procfile",1,0,'f'},... | cwe | CWE-476 | C/C++ |
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
'''
from multiprocessing import Process
import threading
import functools
import time
import os
import sys
import requests
import zmq
from keylime import config
from keylime import crypto
from keylime import json
from keyli... | cwe | CWE-668 | Python |
/*
* 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 ... | cwe | CWE-200 | Java |
// SPDX-License-Identifier: GPL-3.0-or-later
#include "web_api_v1.h"
static struct {
const char *name;
uint32_t hash;
RRDR_OPTIONS value;
} api_v1_data_options[] = {
{ "nonzero" , 0 , RRDR_OPTION_NONZERO}
, {"flip" , 0 , RRDR_OPTION_REVERSED}
, {"reversed"... | cwe | CWE-200 | C/C++ |
html: this.editor.body.html(),
caret: this.editor.undoManager.caretPosition()
};
this._pasteBin.focus();
return setTimeout((function(_this) {
return function() {
var pasteContent;
_this.editor.hidePopover();
_this.editor.body.get(0).innerHTML = state.html;
_this.e... | cwe | CWE-79 | JavaScript |
constructor (GType type,
guint n_construct_params,
GObjectConstructParam *construct_params)
{
GObject *object;
NMAGConfConnectionPrivate *priv;
NMConnection *connection;
GError *error = NULL;
object = G_OBJECT_CLASS (nma_gconf_connection_parent_class)->constructor (type, n_construct_params, construct_pa... | cwe | CWE-310 | Unknown |
m.getIndexableText()+" "}else f=d.getIndexableText();this.editor.graph.setEnabled(!0);return f};EditorUi.prototype.showRemotelyStoredLibrary=function(d){var f={},g=document.createElement("div");g.style.whiteSpace="nowrap";var m=document.createElement("h3");mxUtils.write(m,mxUtils.htmlEntities(d));m.style.cssText="width... | cwe | CWE-94 | JavaScript |
static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
{
struct pid *pgrp;
pid_t pgrp_nr;
int retval = tty_check_change(real_tty);
if (retval == -EIO)
return -ENOTTY;
if (retval)
return retval;
if (!current->signal->tty ||
(current->signal->tty != real_tty) ||
(r... | cwe | CWE-416 | Unknown |
function(la,ra){"1"==urlParams.sketch?(O.insertTemplateEnabled&&!O.isOffline()&&O.menus.addMenuItems(la,["insertTemplate"],ra),O.menus.addMenuItems(la,["insertImage","insertLink","-"],ra),O.menus.addSubmenu("insertLayout",la,ra,mxResources.get("layout")),O.menus.addSubmenu("insertAdvanced",la,ra,mxResources.get("advanc... | cwe | CWE-20 | JavaScript |
TfLiteStatus ComparisonPrepareCommon(TfLiteContext* context, TfLiteNode* node,
bool is_string_allowed) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
con... | cwe | CWE-787 | C/C++ |
static void scsi_dma_restart_bh(void *opaque)
{
SCSIDiskState *s = opaque;
SCSIRequest *req;
SCSIDiskReq *r;
qemu_bh_delete(s->bh);
s->bh = NULL;
QTAILQ_FOREACH(req, &s->qdev.requests, next) {
r = DO_UPCAST(SCSIDiskReq, req, req);
if (r->status & SCSI_REQ_STATUS_RETRY) {
... | cwe | CWE-119 | C/C++ |
public function popupnewsitem($id)
{
$query = 'SELECT *
FROM ' . TABLE_PREFIX .'news
WHERE id=' . $id . ' ';
return DB::get_row($query);
} | cwe | CWE-89 | PHP |
function factory (type, config, load, typed) {
var register = load(require('./compile')).register;
var compile = load(require('./compile')).compile;
var Node = load(require('./Node'));
/**
* @constructor ObjectNode
* @extends {Node}
* Holds an object with keys/values
* @param {Object.<string, Node>... | cwe | CWE-20 | JavaScript |
static inline void ModulateHSI(const double percent_hue,
const double percent_saturation,const double percent_intensity,double *red,
double *green,double *blue)
{
double
intensity,
hue,
saturation;
/*
Increase or decrease color intensity, saturation, or hue.
*/
ConvertRGBToHSI(*red,*green,*... | cwe | CWE-835 | Unknown |
"""Miscellaneous utility functions and classes.
This module is used internally by Tornado. It is not necessarily expected
that the functions and classes defined here will be useful to other
applications, but they are documented here in case they are.
The one public-facing part of this module is the `Configurable` cl... | cwe | CWE-203 | Python |
/*
* Copyright (c) 1999-2013 Petko Manolov (petkan@nucleusys.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ChangeLog:
* .... Most of the time spent on reading so... | cwe | CWE-119 | C/C++ |
void unix_gc(void)
{
static bool gc_in_progress = false;
struct unix_sock *u;
struct unix_sock *next;
struct sk_buff_head hitlist;
struct list_head cursor;
LIST_HEAD(not_cycle_list);
spin_lock(&unix_gc_lock);
/* Avoid a recursive GC. */
if (gc_in_progress)
goto out;
gc_in_progress = true;
/*
* First,... | cwe | CWE-399 | Unknown |
/*-
* Copyright (c) 2013 Chris Torek <torek @ torek net>
* Copyright (c) 2015 xhyve developers
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must r... | cwe | CWE-476 | C/C++ |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 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 Foun... | cwe | CWE-601 | Python |
static function getRSSFeed($url, $cache_duration = DAY_TIMESTAMP) {
global $CFG_GLPI;
$feed = new SimplePie();
$feed->set_cache_location(GLPI_RSS_DIR);
$feed->set_cache_duration($cache_duration);
// proxy support
if (!empty($CFG_GLPI["proxy_name"])) {
$prx_opt = [];
... | cwe | CWE-327 | PHP |
static int decode_font(ASS_Track *track)
{
unsigned char *p;
unsigned char *q;
size_t i;
size_t size; // original size
size_t dsize; // decoded size
unsigned char *buf = 0;
ass_msg(track->library, MSGL_V, "Font: %d bytes encoded data",
track->p... | cwe | CWE-369 | C/C++ |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2005-2022
* All rights reserved
*
* This file is part of GPAC / LASeR codec sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser Gene... | cwe | CWE-401 | C/C++ |
function insertServiceCategorieInDB(){
global $pearDB, $centreon;
if (testServiceCategorieExistence($_POST["sc_name"])){
$DBRESULT = $pearDB->query("INSERT INTO `service_categories` (`sc_name`, `sc_description`, `level`, `icon_id`, `sc_activate` )
VALUES ('".$_POST["sc_name"]."... | cwe | CWE-89 | PHP |
(W.removeAttribute("disabled"),W.checked=!u.pageVisible):(W.setAttribute("disabled","disabled"),W.checked=!1)};K=200;var F=1,G=null;if(d.pdfPageExport&&!n){var N=function(){U.value=Math.max(1,Math.min(F,Math.max(parseInt(U.value),parseInt(H.value))));H.value=Math.max(1,Math.min(F,Math.min(parseInt(U.value),parseInt(H.v... | cwe | CWE-20 | JavaScript |
static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
struct p9_qid *qid,
struct p9_fid *fid,
struct p9_stat_dotl *st,
int new)
{
int retval;
unsigned long i_ino;
struct inode *inode;
struct v9fs_session_info *v9ses = sb->s_fs_info;
int (*test)(struct inode *, void *);
if (new)
te... | cwe | CWE-835 | Unknown |
def add_month_data_row(self, inverter_serial, ts, etoday, etotal):
y = datetime.fromtimestamp(ts) - timedelta(days=1)
y_ts = int(datetime(y.year, y.month, y.day, 23, tzinfo=pytz.utc).timestamp())
query = '''
INSERT INTO MonthData (
TimeStamp,
Serial,... | cwe | CWE-89 | Python |
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-119 | C/C++ |
public Template getTemplate(
String templateId, String templateContent, String errorTemplateId,
String errorTemplateContent, TemplateContextType templateContextType) {
if (templateContextType.equals(TemplateContextType.EMPTY)) {
return new VelocityTemplate(
templateId, templateContent, errorTemplateId,
... | cwe | CWE-264 | Java |
TPMI_SH_HMAC_Unmarshal(TPMI_SH_HMAC *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_HANDLE_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
BOOL isNotHmacSession = (*target < HMAC_SESSION_FIRST ) || (*target > HMAC_SESSION_LA... | cwe | CWE-787 | Unknown |
/*
* Copyright 2000-2020 Vaadin Ltd.
*
* 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-668 | Java |
async function getPackageInfo(packageName, { useYarn } = {}) {
// Use yarn if possible because it's faster
if (useYarn) {
const { stdout } = await execa.command(`yarn info ${packageName} --json`);
const yarnInfo = JSON.parse(stdout);
return {
name: yarnInfo.data.name,
version: yarnInfo.data.... | cwe | CWE-78 | JavaScript |
virSecuritySELinuxMCSFind(virSecurityManager *mgr,
const char *sens,
int catMin,
int catMax)
{
virSecuritySELinuxData *data = virSecurityManagerGetPrivateData(mgr);
int catRange;
char *mcs = NULL;
/* +1 since virRandomInt ran... | cwe | CWE-732 | Unknown |
pci_emul_capwrite(struct pci_vdev *dev, int offset, int bytes, uint32_t val)
{
int capid;
uint8_t capoff, nextoff;
/* Do not allow un-aligned writes */
if ((offset & (bytes - 1)) != 0)
return;
/* Find the capability that we want to update */
capoff = CAP_START_OFFSET;
while (1) {
nextoff = pci_get_cfgdata8... | cwe | CWE-703 | Unknown |
const bootbox = require('bootbox');
require('./Requisitions');
/**
* @author Alejandro Galue <agalue@opennms.org>
* @copyright 2014 The OpenNMS Group, Inc.
*/
(function() {
'use strict';
angular.module('onms-requisitions')
/**
* @ngdoc service
* @name SynchronizeService
* @module onms-requisitions
*... | cwe | CWE-79 | Java |
def uploadimage():
# print(request.json)
if not request.json or "image" not in request.json:
print("No data sent or no image provided. Aborting with 400.")
abort(400)
im_b64 = request.json["image"]
img_bytes = base64.b64decode(im_b64.encode("utf-8"))
img_bytes, valid = allowed_file(... | cwe | CWE-22 | Python |
void Init(void)
{
for(int i = 0;i < 19;i++) {
#ifdef DEBUG_QMCODER
char string[5] = "X0 ";
string[1] = (i / 10) + '0';
string[2] = (i % 10) + '0';
X[i].Init(string);
string[0] = 'M';
M[i].Init(string);
#else
X[i].Init();
M[i]... | cwe | CWE-617 | C/C++ |
PJ_DEF(pj_status_t) pjmedia_sdp_neg_modify_local_offer2(
pj_pool_t *pool,
pjmedia_sdp_neg *neg,
unsigned flags,
const pjmedia_sdp_session *local)
{
pjmedia_sdp_session *new_offer;
pjmedia_sdp_session *old_offer;
char med... | cwe | CWE-200 | Unknown |
function load(page, devices) {
const localeWithSuffix = getLocaleWithSuffix();
let html = '';
html += devices.map(function (device) {
let deviceHtml = '';
deviceHtml += "<div data-id='" + device.Id + "' class='card backdropCard'>";
deviceHtml += '<div class="... | cwe | CWE-79 | JavaScript |
MagickExport MagickBooleanType DrawPrimitive(Image *image,
const DrawInfo *draw_info,const PrimitiveInfo *primitive_info,
ExceptionInfo *exception)
{
CacheView
*image_view;
MagickStatusType
status;
ssize_t
i,
x;
ssize_t
y;
if (image->debug != MagickFalse)
{
(void) LogMagi... | cwe | CWE-703 | Unknown |
static void kvm_steal_time_set_preempted(struct kvm_vcpu *vcpu)
{
struct gfn_to_hva_cache *ghc = &vcpu->arch.st.cache;
struct kvm_steal_time __user *st;
struct kvm_memslots *slots;
static const u8 preempted = KVM_VCPU_PREEMPTED;
if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED))
return;
if (vcpu->arch.st.preempt... | cwe | CWE-703 | Unknown |
static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long address, pte_t *page_table, pmd_t *pmd,
unsigned int flags)
{
struct mem_cgroup *memcg;
struct page *page;
spinlock_t *ptl;
pte_t entry;
pte_unmap(page_table);
/* Check if we need to add a guard page to the stac... | cwe | CWE-20 | C/C++ |
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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 Licen... | cwe | CWE-668 | Java |
pxa3xx_gcu_write(struct file *file, const char *buff,
size_t count, loff_t *offp)
{
int ret;
unsigned long flags;
struct pxa3xx_gcu_batch *buffer;
struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file);
int words = count / 4;
/* Does not need to be atomic. There's a lock in user space,
* but anyhow, this ... | cwe | CWE-703 | C/C++ |
//
// Copyright (C) 2013 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
// Licen... | cwe | CWE-116 | Python |
/**
* Tags plugin.
*
* - Set tags via dialog
* - Toggle hidden tags
* - Stateless filter
*
* TODO:
*
* - Add hiddenTags to viewState of page
* - Export to PDF ignores current tags
* - Sync hiddenTags with removed tags
*/
Draw.loadPlugin(function(editorUi)
{
var div = document.createElement('div');
//... | cwe | CWE-79 | JavaScript |
static void Ins_JMPR( INS_ARG )
{
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
if(CUR.IP > CUR.codeSize ||
(CUR.code[CUR.IP] != 0x2D && CUR.code[CUR.IP - 1] == 0x2D))
/* The JPMR is meant to stop at the ENDF instruction to finish
* the function. However the programmer made a mist... | cwe | CWE-125 | Unknown |
static void k_fn(struct vc_data *vc, unsigned char value, char up_flag)
{
if (up_flag)
return;
if ((unsigned)value < ARRAY_SIZE(func_table)) {
if (func_table[value])
puts_queue(vc, func_table[value]);
} else
pr_err("k_fn called with value=%d\n", value);
} | cwe | CWE-416 | Unknown |
uint32_t GetPayloadTime(size_t handle, uint32_t index, float *in, float *out)
{
mp4object *mp4 = (mp4object *)handle;
if (mp4 == NULL) return 0;
if (mp4->metaoffsets == 0 || mp4->basemetadataduration == 0 || mp4->meta_clockdemon == 0 || in == NULL || out == NULL) return 1;
*in = (float)((double)index * (doubl... | cwe | CWE-787 | C/C++ |
void hashTypeTryConversion(robj *o, robj **argv, int start, int end) {
int i;
if (o->encoding != OBJ_ENCODING_ZIPLIST) return;
for (i = start; i <= end; i++) {
if (sdsEncodedObject(argv[i]) &&
sdslen(argv[i]->ptr) > server.hash_max_ziplist_value)
{
hashTypeConvert(o... | cwe | CWE-190 | Unknown |
async def verify_credentials(self, login, password):
""" verify login and password """
try:
async with aiopg.create_pool(self.dsn) as pool:
async with pool.acquire() as conn:
async with conn.cursor() as cur:
query = f"""
... | cwe | CWE-89 | Python |
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath TSRMLS_DC) /* {{{ */
{
int path_length = strlen(path);
char resolved_path[MAXPATHLEN];
int start = 1;
int ll = 0;
time_t t;
int ret;
int add_slash;
void *tmp;
if (path_length == 0 || path_length >= M... | cwe | CWE-190 | Unknown |
static void sasl_success(IRC_SERVER_REC *server, const char *data, const char *from)
{
if (server->sasl_timeout != 0) {
g_source_remove(server->sasl_timeout);
server->sasl_timeout = 0;
}
server->sasl_success = TRUE;
signal_emit("server sasl success", 1, server);
/* The authentication succeeded, time to fini... | cwe | CWE-416 | Unknown |
int ldb_kv_search_dn1(struct ldb_module *module,
struct ldb_dn *dn,
struct ldb_message *msg,
unsigned int unpack_flags)
{
void *data = ldb_module_get_private(module);
struct ldb_kv_private *ldb_kv =
talloc_get_type(data, struct ldb_kv_private);
int ret;
uint8_t guid_key[LDB_KV_GUID_KEY_... | cwe | CWE-20 | Unknown |
ssize_t AsyncConnection::_process_connection()
{
ssize_t r = 0;
switch(state) {
case STATE_WAIT_SEND:
{
std::lock_guard<std::mutex> l(write_lock);
if (!outcoming_bl.length()) {
assert(state_after_send);
state = state_after_send;
state_after_send = STATE_NONE;... | cwe | CWE-284 | Unknown |
static MagickBooleanType TIFFWritePhotoshopLayers(Image* image,
const ImageInfo *image_info,EndianType endian,ExceptionInfo *exception)
{
BlobInfo
*blob;
CustomStreamInfo
*custom_stream;
Image
*base_image,
*next;
ImageInfo
*clone_info;
MagickBooleanType
status;
PhotoshopProfil... | 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.