code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
/* * Copyright (c) 2018-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include <fizz/record/PlaintextRecordLayer.h> #include <folly/String.h> namespace fizz { using Conte...
cwe
CWE-835
C/C++
@Override public void callSessionMergeFailed(ImsReasonInfo reasonInfo) { TelephonyUtils.runWithCleanCallingIdentity(()-> { if (mListener != null) { mListener.callSessionMergeFailed(ImsCallSession.this, reasonInfo); } }, mListenerExecuto...
vuln
Safe
Java
exsltCryptoPopString (xmlXPathParserContextPtr ctxt, int nargs, xmlChar ** str) { int str_len = 0; if ((nargs < 1) || (nargs > 2)) { xmlXPathSetArityError (ctxt); return 0; } *str = xmlXPathPopString (ctxt); str_len = xmlUTF8Strlen (*str); if (str_len == 0) { xmlXPathReturnE...
cwe
CWE-119
C/C++
gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd) /* {{{ */ { int BitPixel; #if 0 int ColorResolution; int Background; int AspectRatio; #endif int Transparent = (-1); unsigned char buf[16]; unsigned char c; unsigned char ColorMap[3][MAXCOLORMAPSIZE]; unsigned char localColorMap[3][MAXCOLORMAPSIZE]; in...
cwe
CWE-681
C/C++
/* JSON_parser.c */ /* 2005-12-30 */ /* Copyright (c) 2005 JSON.org 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, copy, mod...
vuln
Safe
C/C++
static void umount_tree(struct mount *mnt, enum umount_tree_flags how) { LIST_HEAD(tmp_list); struct mount *p; if (how & UMOUNT_PROPAGATE) propagate_mount_unlock(mnt); /* Gather the mounts to umount */ for (p = mnt; p; p = next_mnt(p, mnt)) { p->mnt.mnt_flags |= MNT_UMOUNT; list_move(&p->mnt_list, &tmp_lis...
cwe
CWE-200
Unknown
protected Beacon fromScanData(byte[] bytesToProcess, int rssi, BluetoothDevice device, long timestampMs, Beacon beacon) { BleAdvertisement advert = new BleAdvertisement(bytesToProcess); boolean parseSucceeded = false; ArrayList<Pdu> pdusToParse = new ArrayList<Pdu>(); int startByte = 0; ...
vuln
Vulnerable
Java
def safe_paths dir = params[:order] # GOOD: barrier guard prevents taint flow if dir == "ASC" User.order("name #{dir}") else dir = "DESC" User.order("name #{dir}") end # TODO: a more idiomatic form of this guard is the following: # dir = "DESC" unless dir == "ASC" #...
vuln
Safe
Ruby
"geCommentActionLnk";mxUtils.write(da,P);Y.appendChild(da);mxEvent.addListener(da,"click",function(ha){O(ha,J);ha.preventDefault();mxEvent.consume(ha)});T.appendChild(Y);R&&(Y.style.display="none")}function W(){function P(Y){O.push(R);if(null!=Y.replies)for(var da=0;da<Y.replies.length;da++)R=R.nextSibling,P(Y.replies[...
cwe
CWE-20
JavaScript
bool read(ReadonlyBytes buffer) { auto fields_size = sizeof(EndOfCentralDirectory) - sizeof(u8*); if (buffer.size() < fields_size) return false; if (memcmp(buffer.data(), end_of_central_directory_signature, sizeof(end_of_central_directory_signature)) != 0) return fals...
vuln
Vulnerable
C/C++
static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) { MOVMuxContext *mov = s->priv_data; MOVTrack *trk = &mov->tracks[pkt->stream_index]; AVCodecParameters *par = trk->par; int64_t frag_duration = 0; int size = pkt->size; int ret = check_pkt(s, pkt); ...
vuln
Safe
C/C++
@Override public void onResult (final TdApi.Object object) { if (contextId != currentContextId) { Log.i(Log.TAG_MESSAGES_LOADER, "Ignoring messages result, because contextId has changed"); return; } if (lastHandler != this) { Log.i(Log.TAG_MESSAGES_LOADER, "Ig...
vuln
Vulnerable
Java
static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define RMT_EQUAL_RGB 1 #define RMT_NONE 0 #define RMT_RAW 2 #define RT_STANDARD 1 #define RT_ENCODED 2 #define RT_FORMAT_RGB 3 typedef struct _SUNInfo { unsigned int magic, width, height, depth, ...
cwe
CWE-119
C/C++
static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx, int *is_branch) { int rx, ry; int sa; int op, cnvt_op, op1, offset; int funct; int n_bytes; op = (ctx->opcode >> 11) & 0x1f; sa = (ctx->opcode >> 2) & 0x7; sa = sa == 0 ? 8 : sa; rx = xl...
vuln
Vulnerable
C/C++
static int mptctl_eventenable (MPT_ADAPTER *ioc, unsigned long arg) { struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg; struct mpt_ioctl_eventenable karg; if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - " "Unable to rea...
vuln
Safe
C/C++
validate_group(struct perf_event *event) { struct perf_event *sibling, *leader = event->group_leader; struct pmu_hw_events fake_pmu; DECLARE_BITMAP(fake_used_mask, ARMPMU_MAX_HWEVENTS); /* * Initialise the fake PMU. We only need to populate the * used_mask for the purposes of validation. */ memset(fake_used...
vuln
Vulnerable
C/C++
xsltShallowCopyElem(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr insert, int isLRE) { xmlNodePtr copy; if ((node->type == XML_DTD_NODE) || (insert == NULL)) return(NULL); if ((node->type == XML_TEXT_NODE) || (node->type == XML_CDATA_SECTION_NODE)) return(xsltCopyText(ctxt, insert, nod...
cwe
CWE-119
C/C++
static int php_iconv_stream_filter_append_bucket( php_iconv_stream_filter *self, php_stream *stream, php_stream_filter *filter, php_stream_bucket_brigade *buckets_out, const char *ps, size_t buf_len, size_t *consumed, int persistent TSRMLS_DC) { php_stream_bucket *new_bucket; char *out_buf = NULL; size_t o...
vuln
Safe
C/C++
/* * Copyright (c) 2004, PostgreSQL Global Development Group * See the LICENSE file in the project root for more information. */ // Copyright (c) 2004, Open Cloud Limited. package org.postgresql.util; import static org.postgresql.util.internal.Nullness.castNonNull; import org.checkerframework.checker.nullness.qua...
vuln
Safe
Java
BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) { /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */ BIGNUM *u; unsigned char cu[SHA_DIGEST_LENGTH]; unsigned char *cAB; EVP_MD_CTX ctxt; int longN; if ((A == NULL) ||(B == NULL) || (N == NULL)) return NULL; longN= BN_num_bytes(N); if ((cAB = OPENS...
cwe
CWE-119
Unknown
void isis_notif_authentication_type_failure(const struct isis_circuit *circuit, const char *raw_pdu, size_t raw_pdu_len) { const char *xpath = "/frr-isisd:authentication-type-failure"; struct list *arguments = yang_data_list_new(); char xpath_arg[XPATH_MAXLEN]; struct yang_data *data; struct isis...
cwe
CWE-119
Unknown
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String archivePath, String charset) { String filename = "checklist_" + StringHelper.transformDisplayNameToFileSystemName(getShortName()) + "_" + Formatter.formatDatetimeFilesystemSave(new Dat...
cwe
CWE-91
Java
static Image *ReadAAIImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image; MagickBooleanType status; register ssize_t x; register PixelPacket *q; register unsigned char *p; size_t height, length, width; ssize_t count, y; unsigned char ...
cwe
CWE-401
Unknown
amgtar_estimate( application_argument_t *argument) { char *incrname = NULL; GPtrArray *argv_ptr; int nullfd = -1; int pipefd = -1; FILE *dumpout = NULL; off_t size = -1; char line[32768]; char *errmsg = NULL; char *qerrmsg = NULL; ...
vuln
Safe
Unknown
'use strict'; // Load modules const Assert = require('assert'); const Crypto = require('crypto'); const Path = require('path'); const Util = require('util'); const Escape = require('./escape'); // Declare internals const internals = {}; // Clone object or array exports.clone = function (obj, seen) { if (t...
vuln
Safe
JavaScript
private void startFinishAnimation() { View rootView = findRootView(); rootView.startAnimation(new FinishAnimation(this, rootView)); }
vuln
Vulnerable
Java
struct Address * new_address(const char *hostname_or_ip) { union { struct sockaddr a; struct sockaddr_in in; struct sockaddr_in6 in6; struct sockaddr_un un; struct sockaddr_storage s; } s; char ip_buf[ADDRESS_BUFFER_SIZE]; char *port; size_t len; if (host...
vuln
Vulnerable
C/C++
void arch_pick_mmap_layout(struct mm_struct *mm) { unsigned long random_factor = 0UL; if (current->flags & PF_RANDOMIZE) random_factor = arch_mmap_rnd(); mm->mmap_legacy_base = mmap_legacy_base(random_factor); if (mmap_is_legacy()) { mm->mmap_base = mm->mmap_legacy_base; mm->get_unmapped_area = arch_get_un...
cwe
CWE-254
Unknown
/* * Copyright (c) 2012-2019 Belledonne Communications SARL. * * This file is part of belle-sip. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (...
vuln
Safe
C/C++
// Copyright 2014 The Macaron 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 agree...
cwe
CWE-601
Go
package org.jolokia.http; import java.io.*; import java.net.*; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.*; import javax.management.RuntimeMBeanException; import javax.security.auth.Subject; import javax.servlet.*; import javax.servlet.http.*; im...
cwe
CWE-79
Java
static av_cold int dnxhd_init_rc(DNXHDEncContext *ctx) { FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail); if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD) FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail); ctx->frame_b...
cwe
CWE-703
Unknown
function setStageHeadline(title) { if (getUtility().isUndefinedOrNull(title)) { title = buildTitleByFormElement().text(); } $(getHelper().getDomElementDataIdentifierSelector('stageHeadline')).text(title); }
vuln
Safe
JavaScript
var fillTable = function(chart_data) { var tableRows = [], rowData, rowId; for(i=0; i<chart_data.length; i++) { rowData = chart_data[i]; rowId = typeof rowData.userId != 'undefined' ? rowData.userId : rowData.groupId; ...
vuln
Vulnerable
JavaScript
@WorkerThread private @NonNull MessageDetails getRecipientDeliveryStatusesInternal(@NonNull MessageRecord messageRecord) { List<RecipientDeliveryStatus> recipients = new LinkedList<>(); if (!messageRecord.getRecipient().isGroup() && !messageRecord.getRecipient().isDistributionList()) { recipients.add(n...
vuln
Safe
Java
_asn1_extract_der_octet (asn1_node node, const unsigned char *der, int der_len, unsigned flags) { int len2, len3; int counter, counter_end; int result; len2 = asn1_get_length_der (der, der_len, &len3); if (len2 < -1) return ASN1_DER_ERROR; counter = len3 + 1; DECR_LEN(der_len, len3); if (len2...
vuln
Safe
C/C++
static int __mincore_unmapped_range(unsigned long addr, unsigned long end,
vuln
Safe
C/C++
bool is_secure_file_path(char *path) { char buff1[FN_REFLEN], buff2[FN_REFLEN]; size_t opt_secure_file_priv_len; /* All paths are secure if opt_secure_file_priv is 0 */ if (!opt_secure_file_priv[0]) return TRUE; opt_secure_file_priv_len= strlen(opt_secure_file_priv); if (strlen(path) >= FN_REFLE...
vuln
Safe
Unknown
// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. * All Rights Reserved. */ #include "xfs.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" #include "xfs_shared.h" #include "xfs_trans_resv.h" #include "xfs_bit.h" #include "xfs_sb.h" #include "xfs_mo...
cwe
CWE-400
C/C++
static void fpm_worker_pool_cleanup(int which, void *arg) /* {{{ */ { struct fpm_worker_pool_s *wp, *wp_next; for (wp = fpm_worker_all_pools; wp; wp = wp_next) { wp_next = wp->next; fpm_worker_pool_config_free(wp->config); fpm_children_free(wp->children); if ((which & FPM_CLEANUP_CHILD) == 0 && fpm_globals.p...
cwe
CWE-787
Unknown
void scsi_req_unref(SCSIRequest *req) { if (--req->refcount == 0) { if (req->dev->info->free_req) { req->dev->info->free_req(req); } qemu_free(req); } }
vuln
Safe
C/C++
/* * card-tcos.c: Support for TCOS cards * * Copyright (C) 2011 Peter Koch <pk@opensc-project.org> * Copyright (C) 2002 g10 Code GmbH * Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General P...
vuln
Vulnerable
C/C++
package api type Resource struct { ID int `json:"id"` // Standard fields CreatorID int `json:"creatorId"` CreatedTs int64 `json:"createdTs"` UpdatedTs int64 `json:"updatedTs"` // Domain specific fields Filename string `json:"filename"` Blob []byte `json:"-"` Type string `json:"type"` Size int...
cwe
CWE-285
Go
function toString(stringify) { if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify; var query , url = this , protocol = url.protocol; if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':'; var result = protocol + ((url.protocol && url.slashes) |...
cwe
CWE-639
JavaScript
/* * Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above co...
cwe
CWE-190
C/C++
public static void switchDimension(GeyserSession session, String javaDimension) { int bedrockDimension = javaToBedrock(javaDimension); int previousDimension = javaToBedrock(session.getDimension()); Entity player = session.getPlayerEntity(); session.getChunkCache().clear(); sess...
vuln
Safe
Java
ProcessUDPHeader(tTcpIpPacketParsingResult _res, PVOID pIpHeader, ULONG len, USHORT ipHeaderSize) { tTcpIpPacketParsingResult res = _res; ULONG udpDataStart = ipHeaderSize + sizeof(UDPHeader); res.xxpStatus = ppresXxpIncomplete; res.TcpUdp = ppresIsUDP; res.XxpIpHeaderSize = udpDataStart; if (le...
cwe
CWE-20
C/C++
App.Actions.DB.update_db_username_hint = function(elm, hint) { if (hint.trim() == '') { $(elm).parent().find('.hint').text(''); } $(elm).parent().find('.hint').text(GLOBAL.DB_USER_PREFIX + hint); }
vuln
Safe
JavaScript
/* $Id$ */ /* tiffcrop.c -- a port of tiffcp.c extended to include manipulations of * the image data through additional options listed below * * Original code: * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * Additions (c) Richard Nolde 2006-2010 * * Permission to use, ...
vuln
Vulnerable
C/C++
static Image *ReadWPGImage(const ImageInfo *image_info, ExceptionInfo *exception) { typedef struct { size_t FileId; MagickOffsetType DataOffset; unsigned int ProductType; unsigned int FileType; unsigned char MajorVersion; unsigned char MinorVersion; unsigned int EncryptKey; unsigne...
vuln
Vulnerable
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 applicable law or a...
vuln
Vulnerable
Python
#include "queue.ih" void queue_push(register Queue *qp, size_t extra_length, char const *info) { register char *cp; size_t memory_length; size_t available_length; size_t begin_length; size_t n_begin; size_t q_length; if (!extra_length) return; memory_length = qp->d_memory_e...
vuln
Vulnerable
C/C++
void initialize(const string &path, bool owner) { TRACE_POINT(); this->path = path; this->owner = owner; /* Create the server instance directory. We only need to write to this * directory for these reasons: * 1. Initial population of structure files (structure_version.txt, instance.pid). * 2. Creat...
vuln
Safe
C/C++
static inline void phar_set_inode(phar_entry_info *entry TSRMLS_DC) /* {{{ */ { char tmp[MAXPATHLEN]; int tmp_len; size_t len; tmp_len = MIN(MAXPATHLEN, entry->filename_len + entry->phar->fname_len); len = MIN(entry->phar->fname_len, tmp_len); memcpy(tmp, entry->phar->fname, len); len = MIN(tmp_len - len, entry...
vuln
Safe
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...
vuln
Safe
Python
static int toneport_init(struct usb_line6 *line6, const struct usb_device_id *id) { int err; struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6; toneport->type = id->driver_info; line6->disconnect = line6_toneport_disconnect; line6->startup = toneport_startup; /* initialize PCM subs...
vuln
Safe
Unknown
int32_t FASTCALL get_word (WavpackStream *wps, int chan, int32_t *correction) { register struct entropy_data *c = wps->w.c + chan; uint32_t ones_count, low, mid, high; int32_t value; int sign; if (!wps->wvbits.ptr) return WORD_EOF; if (correction) *correction = 0; if (!(wp...
cwe
CWE-125
C/C++
static int l2cap_parse_conf_rsp(struct l2cap_chan *chan, void *rsp, int len, void *data, size_t size, u16 *result) { struct l2cap_conf_req *req = data; void *ptr = req->data; void *endptr = data + size; int type, olen; unsigned long val; struct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC }; struct l2cap_...
vuln
Safe
Unknown
void dd_close(struct dump_dir *dd) { if (!dd) return; dd_unlock(dd); close(dd->dd_fd); if (dd->next_dir) { closedir(dd->next_dir); /* free(dd->next_dir); - WRONG! */ } free(dd->dd_type); free(dd->dd_dirname); free(dd); }
vuln
Safe
Unknown
static int read_2004_compressed_section (Bit_Chain *dat, Dwg_Data *restrict dwg, Bit_Chain *sec_dat, Dwg_Section_Type type) { uint32_t address, sec_mask, initial_address; uint32_t max_decomp_size; long bytes_left; Dwg_Section_Info *info = NULL; encrypted_section_header es; BITC...
vuln
Safe
C/C++
gs_main_init1(gs_main_instance * minst) { if (minst->init_done < 1) { gs_dual_memory_t idmem; int code = ialloc_init(&idmem, minst->heap, minst->memory_clump_size, gs_have_level2()); if (code < 0) return code; code = gs_lib_init1((gs_m...
cwe
CWE-20
C/C++
private CallbackHandler getCallbackHandler( @UnderInitialization(WrappedFactory.class) LibPQFactory this, Properties info) throws PSQLException { // Determine the callback handler CallbackHandler cbh; String sslpasswordcallback = PGProperty.SSL_PASSWORD_CALLBACK.get(info); if (sslpasswordcal...
cwe
CWE-665
Java
pci_emul_mem_handler(struct vmctx *ctx, int vcpu, int dir, uint64_t addr, int size, uint64_t *val, void *arg1, long arg2) { struct pci_vdev *pdi = arg1; struct pci_vdev_ops *ops = pdi->dev_ops; uint64_t offset; int bidx = (int) arg2; assert(bidx <= PCI_BARMAX); assert(pdi->bar[bidx].type == PCIBAR_MEM32 |...
cwe
CWE-617
Unknown
// SPDX-License-Identifier: GPL-2.0-only /* * net/sched/sch_qfq.c Quick Fair Queueing Plus Scheduler. * * Copyright (c) 2009 Fabio Checconi, Luigi Rizzo, and Paolo Valente. * Copyright (c) 2012 Paolo Valente. */ #include <linux/module.h> #include <linux/init.h> #include <linux/bitops.h> #include <linux/er...
vuln
Vulnerable
C/C++
int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, u64 devid) { struct btrfs_device *device; struct btrfs_fs_devices *cur_devices; struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; u64 num_devices; int ret = 0; mutex_lock(&uuid_mutex); num_devices = btrfs_num_devices(fs_...
cwe
CWE-703
C/C++
MediaGalleriesCustomBindings::MediaGalleriesCustomBindings( ScriptContext* context) : ObjectBackedNativeHandler(context) { RouteFunction( "GetMediaFileSystemObject", base::Bind(&MediaGalleriesCustomBindings::GetMediaFileSystemObject, base::Unretained(this))); }
vuln
Vulnerable
C/C++
static int webvtt_event_to_ass(AVBPrint *buf, const char *p) { int i, again, skip = 0; while (*p) { for (i = 0; i < FF_ARRAY_ELEMS(webvtt_tag_replace); i++) { const char *from = webvtt_tag_replace[i].from; const size_t len = strlen(from); if (!strncmp(p, from, len)) {...
vuln
Vulnerable
C/C++
static void pcx_palette(GetByteContext *gb, uint32_t *dst, unsigned int pallen) { unsigned int i; for (i = 0; i < pallen; i++) *dst++ = bytestream2_get_be24(gb); if (pallen < 256) memset(dst, 0, (256 - pallen) * sizeof(*dst)); }
vuln
Safe
C/C++
TfLiteStatus ExpandTensorDim(TfLiteContext* context, const TfLiteTensor& input, int axis, TfLiteTensor* output) { const TfLiteIntArray& input_dims = *input.dims; if (axis < 0) { axis = input_dims.size + 1 + axis; } TF_LITE_ENSURE(context, axis <= input_dims.size); TfLiteIntAr...
cwe
CWE-125
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
/* * INET An implementation of the TCP/IP protocol suite for the LINUX * operating system. INET is implemented using the BSD Socket * interface as the means of communication with the user level. * * Implementation of the Transmission Control Protocol(TCP). * * Authors: Ross Biro * Fred N. van Kempen, <wa...
cwe
CWE-400
C/C++
def registerPlayer(name): """Adds a player to the tournament database. The database assigns a unique serial id number for the player. (This should be handled by your SQL database schema, not in your Python code.) Args: name: the player's full name (need not be unique). """ conn = connec...
cwe
CWE-89
Python
"use strict" // Dependencies import parsePath from "parse-path"; import normalizeUrl from "normalize-url"; /** * parseUrl * Parses the input url. * * **Note**: This *throws* if invalid urls are provided. * * @name parseUrl * @function * @param {String} url The input url. * @param {Boolean|Object} normalize W...
vuln
Safe
JavaScript
int qeth_snmp_command(struct qeth_card *card, char __user *udata) { struct qeth_cmd_buffer *iob; struct qeth_ipa_cmd *cmd; struct qeth_snmp_ureq *ureq; int req_len; struct qeth_arp_query_info qinfo = {0, }; int rc = 0; QETH_CARD_TEXT(card, 3, "snmpcmd"); if (card->info.guestlan) return -EOPNOTSUPP; ...
cwe
CWE-119
C/C++
find_file_in_path_option( char_u *ptr, // file name int len, // length of file name int options, int first, // use count'th matching file name char_u *path_option, // p_path or p_cdpath int find_what, // FINDFILE_FILE, _DIR or _BOTH char_u *rel_fname, // file name we are looking relat...
vuln
Safe
Unknown
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package zip import ( "bufio" "encoding/binary" "errors" "hash" "hash/crc32" "io" "io/fs" "os" "path" "sort" "strings" "sync" "time" ) var ( ErrF...
cwe
CWE-20
Go
static struct rmap_item *scan_get_next_rmap_item(struct page **page) { struct mm_struct *mm; struct mm_slot *slot; struct vm_area_struct *vma; struct rmap_item *rmap_item; if (list_empty(&ksm_mm_head.mm_list)) return NULL; slot = ksm_scan.mm_slot; if (slot == &ksm_mm_head) { /* * A number of pages can h...
cwe
CWE-362
C/C++
int ssl3_send_client_key_exchange(SSL *s) { unsigned char *p,*d; int n; unsigned long alg_k; #ifndef OPENSSL_NO_RSA unsigned char *q; EVP_PKEY *pkey=NULL; #endif #ifndef OPENSSL_NO_KRB5 KSSL_ERR kssl_err; #endif /* OPENSSL_NO_KRB5 */ #ifndef OPENSSL_NO_ECDH EC_KEY *clnt_ecdh = NULL; const EC_POINT *srvr_ecpoin...
vuln
Safe
Unknown
int __dns_lookup(const char *name, int type, unsigned char **outpacket, struct resolv_answer *a) { /* Protected by __resolv_lock: */ static int last_ns_num = 0; static uint16_t last_id = 1; int i, j, fd, rc; int packet_len; int name_len; #ifdef USE_SELECT struct timeval tv; fd_set fds; #else struct poll...
vuln
Vulnerable
Unknown
def initialize(*configs) @config = configs.each_with_object(default_config) do |path, obj| new = YAML.load(File.read(path)) next unless new obj.deep_merge! Cymbal.symbolize(new) end @paths = @config[:paths] end
cwe
CWE-502
Ruby
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-79
Java
jpc_pi_t *jpc_enc_pi_create(jpc_enc_cp_t *cp, jpc_enc_tile_t *tile) { jpc_pi_t *pi; int compno; jpc_picomp_t *picomp; jpc_pirlvl_t *pirlvl; jpc_enc_tcmpt_t *tcomp; int rlvlno; jpc_enc_rlvl_t *rlvl; int prcno; int *prclyrno; if (!(pi = jpc_pi_create0())) { return 0; } pi->pktno = -1; pi->numcomps = cp->n...
cwe
CWE-189
Unknown
static int send_jpeg_rect(VncState *vs, int x, int y, int w, int h, int quality) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; struct jpeg_destination_mgr manager; pixman_image_t *linebuf; JSAMPROW row[1]; uint8_t *buf; int dy; if (surface_bytes_per_pixel(vs->vd->ds) ...
vuln
Safe
Unknown
/* * Copyright (c) by Jaroslav Kysela <perex@perex.cz> * Copyright (c) 2009 by Krzysztof Helt * Routines for control of MPU-401 in UART mode * * MPU-401 supports UART mode which is not capable generate transmit * interrupts thus output is done via polling. Also, if irq < 0, then * input is done also via po...
cwe
CWE-125
C/C++
int qemu_pipe(int pipefd[2]) { int ret; #ifdef CONFIG_PIPE2 ret = pipe2(pipefd, O_CLOEXEC); if (ret != -1 || errno != ENOSYS) { return ret; } #endif ret = pipe(pipefd); if (ret == 0) { qemu_set_cloexec(pipefd[0]); qemu_set_cloexec(pipefd[1]); } return ret; }
vuln
Safe
C/C++
/* Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distrib...
cwe
CWE-74
Go
// Copyright 2016 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package db import ( "fmt" "io" "io/ioutil" "mime/multipart" "os" "os/exec" "path" "path/filepath" "strings" "time" gouuid "github.com/satori/go.u...
cwe
CWE-434
Go
stringprep_utf8_nfkc_normalize (const char *str, ssize_t len) { return g_utf8_normalize (str, len, G_NORMALIZE_NFKC); }
cwe
CWE-125
Unknown
void DeepScanLineInputFile::initialize(const Header& header) { try { if (header.type() != DEEPSCANLINE) throw IEX_NAMESPACE::ArgExc("Can't build a DeepScanLineInputFile from " "a type-mismatched part."); if(header.version()!=1) { THROW(IEX_NAM...
cwe
CWE-125
Unknown
TPMA_NV_Unmarshal(TPMA_NV *target, BYTE **buffer, INT32 *size) { TPM_RC rc = TPM_RC_SUCCESS; TPMA_NV orig_target = *target; // libtpms added if (rc == TPM_RC_SUCCESS) { rc = UINT32_Unmarshal((UINT32 *)target, buffer, size); /* libtpms changed */ } if (rc == TPM_RC_SUCCESS) { if (*target & TPMA_N...
vuln
Safe
Unknown
$otherPublisherName = MAX_buildName($aOtherPublisher['publisher_id'], $aOtherPublisher['name']); if ($aOtherPublisher['publisher_id'] != $affiliateid) { $form .= "<option value='" . $aOtherPublisher['publisher_id'] . "'>" . htmlspecialchars($otherPublisherName) . "</option>"; } ...
cwe
CWE-352
PHP
int dtls1_process_buffered_records(SSL *s) { pitem *item; SSL3_BUFFER *rb; SSL3_RECORD *rr; DTLS1_BITMAP *bitmap; unsigned int is_next_epoch; int replayok = 1; item = pqueue_peek(s->rlayer.d->unprocessed_rcds.q); if (item) { /* Check if epoch is current. */ if (s...
vuln
Safe
Unknown
cockpit_auth_empty_cookie_value (const gchar *path, gboolean secure) { gchar *application = cockpit_auth_parse_application (path, NULL); gchar *cookie = application_cookie_name (application); /* this is completely security irrelevant, but security scanners complain * about the lack of Secure (rhbz#1677767) */...
vuln
Vulnerable
Unknown
package com.salesmanager.shop.admin.model.reference; import java.io.Serializable; public class Size implements Serializable { /** * */ private static final long serialVersionUID = -4737272153685816396L; private String code; private String name; public String getCode() { return code; } public void se...
cwe
CWE-79
Java
public static File[] convertPdf2Png(File inputPdfFile) throws IOException { if (PDFBOX.equals(System.getProperty(PDF_LIBRARY))) { return PdfBoxUtilities.convertPdf2Png(inputPdfFile); } else { try { return PdfGsUtilities.convertPdf2Png(inputPdfFile); } ...
vuln
Vulnerable
Java
xmlBufferResize(xmlBufferPtr buf, unsigned int size) { unsigned int newSize; xmlChar* rebuf = NULL; size_t start_buf; if (buf == NULL) return(0); if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0); /* Don't resize if we don't have to */ if (size < buf->size) return 1;...
vuln
Safe
Unknown
do_uncompress( compress_filter_context_t *zfx, z_stream *zs, IOBUF a, size_t *ret_len ) { int zrc; int rc=0; size_t n; int nread, count; int refill = !zs->avail_in; if( DBG_FILTER ) log_debug("begin inflate: avail_in=%u, avail_out=%u, inbuf=%u\n", (unsigned)zs->avail_in, (unsigned)zs...
cwe
CWE-20
Unknown
function validateBaseUrl(url: string) { // from this MIT-licensed gist: https://gist.github.com/dperini/729294 return /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-...
cwe
CWE-697
JavaScript
/***************************************************************** | | Platinum - HTTP Server | | Copyright (c) 2004-2010, Plutinosoft, LLC. | All rights reserved. | http://www.plutinosoft.com | | This program is free software; you can redistribute it and/or | modify it under the terms of the GNU General Public Licen...
cwe
CWE-22
C/C++
int dtls1_read_bytes(SSL *s, int type, int *recvd_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 (!SSL3_BUFFER_is_initialised(&s->rlayer.rbuf)) { /* Not initia...
cwe
CWE-400
Unknown