code stringlengths 12 2.05k | label_name stringlengths 6 8 | label int64 0 95 |
|---|---|---|
void options_defaults() {
SERVICE_OPTIONS *service;
/* initialize globals *before* opening the config file */
memset(&new_global_options, 0, sizeof(GLOBAL_OPTIONS));
memset(&new_service_options, 0, sizeof(SERVICE_OPTIONS));
new_service_options.next=NULL;
parse_global_option(CMD_SET_DEFAULTS, N... | CWE-295 | 52 |
static int getStrrtokenPos(char* str, int savedPos)
{
int result =-1;
int i;
for(i=savedPos-1; i>=0; i--) {
if(isIDSeparator(*(str+i)) ){
/* delimiter found; check for singleton */
if(i>=2 && isIDSeparator(*(str+i-2)) ){
/* a singleton; so send the position of token before the singleton */
result =... | CWE-125 | 47 |
BOOL rdp_read_share_control_header(wStream* s, UINT16* length, UINT16* type, UINT16* channel_id)
{
if (Stream_GetRemainingLength(s) < 2)
return FALSE;
/* Share Control Header */
Stream_Read_UINT16(s, *length); /* totalLength */
/* If length is 0x8000 then we actually got a flow control PDU that we should ignore... | CWE-125 | 47 |
create_spnego_ctx(void)
{
spnego_gss_ctx_id_t spnego_ctx = NULL;
spnego_ctx = (spnego_gss_ctx_id_t)
malloc(sizeof (spnego_gss_ctx_id_rec));
if (spnego_ctx == NULL) {
return (NULL);
}
spnego_ctx->magic_num = SPNEGO_MAGIC_ID;
spnego_ctx->ctx_handle = GSS_C_NO_CONTEXT;
spnego_ctx->mech_set = NULL;
spnego_ctx... | CWE-763 | 61 |
key_ref_t keyring_search(key_ref_t keyring,
struct key_type *type,
const char *description)
{
struct keyring_search_context ctx = {
.index_key.type = type,
.index_key.description = description,
.cred = current_cred(),
.match_data.cmp = type->match,
.match_data.raw_data = description,
.match_dat... | CWE-476 | 46 |
GF_Box *mp4s_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_MPEGSampleEntryBox, GF_ISOM_BOX_TYPE_MP4S);
gf_isom_sample_entry_init((GF_SampleEntryBox*)tmp);
tmp->internal_type = GF_ISOM_SAMPLE_ENTRY_MP4S;
return (GF_Box *)tmp;
} | CWE-476 | 46 |
show_tree(tree_t *t, /* I - Parent node */
int indent) /* I - Indentation */
{
while (t)
{
if (t->markup == MARKUP_NONE)
printf("%*s\"%s\"\n", indent, "", t->data);
else
printf("%*s%s\n", indent, "", _htmlMarkups[t->markup]);
if (t->child)
... | CWE-787 | 24 |
void gtkui_conf_read(void) {
FILE *fd;
const char *path;
char line[100], name[30];
short value;
#ifdef OS_WINDOWS
path = ec_win_get_user_dir();
#else
/* TODO: get the dopped privs home dir instead of "/root" */
/* path = g_get_home_dir(); */
path = g_get_tmp_dir();
#endif
filename = g_build... | CWE-120 | 44 |
spnego_gss_get_mic_iov(OM_uint32 *minor_status, gss_ctx_id_t context_handle,
gss_qop_t qop_req, gss_iov_buffer_desc *iov,
int iov_count)
{
return gss_get_mic_iov(minor_status, context_handle, qop_req, iov,
iov_count);
} | CWE-763 | 61 |
int imap_subscribe (char *path, int subscribe)
{
IMAP_DATA *idata;
char buf[LONG_STRING];
char mbox[LONG_STRING];
char errstr[STRING];
BUFFER err, token;
IMAP_MBOX mx;
if (!mx_is_imap (path) || imap_parse_path (path, &mx) || !mx.mbox)
{
mutt_error (_("Bad mailbox name"));
return -1;
}
if (!... | CWE-78 | 6 |
MOBI_RET mobi_trie_insert_infl(MOBITrie **root, const MOBIIndx *indx, size_t i) {
MOBIIndexEntry e = indx->entries[i];
char *inflected = e.label;
for (size_t j = 0; j < e.tags_count; j++) {
MOBIIndexTag t = e.tags[j];
if (t.tagid == INDX_TAGARR_INFL_PARTS_V1) {
for (size_t k = 0;... | CWE-476 | 46 |
Ta3Tokenizer_FindEncodingFilename(int fd, PyObject *filename)
{
struct tok_state *tok;
FILE *fp;
char *p_start =NULL , *p_end =NULL , *encoding = NULL;
#ifndef PGEN
#if PY_MINOR_VERSION >= 4
fd = _Py_dup(fd);
#endif
#else
fd = dup(fd);
#endif
if (fd < 0) {
return NULL;
}
fp = f... | CWE-125 | 47 |
static int __get_data_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh, int create, int flag,
pgoff_t *next_pgofs)
{
struct f2fs_map_blocks map;
int err;
map.m_lblk = iblock;
map.m_len = bh->b_size >> inode->i_blkbits;
map.m_next_pgofs = next_pgofs;
err = f2fs_map_blocks(inode, &map, cre... | CWE-190 | 19 |
process_plane(uint8 * in, int width, int height, uint8 * out, int size)
{
UNUSED(size);
int indexw;
int indexh;
int code;
int collen;
int replen;
int color;
int x;
int revcode;
uint8 * last_line;
uint8 * this_line;
uint8 * org_in;
uint8 * org_out;
org_in = in;
org_out = out;
last_line = 0;
indexh = 0;... | CWE-190 | 19 |
static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
unsigned int keylen)
{
return -ENOSYS;
} | CWE-787 | 24 |
int Jsi_ObjArraySizer(Jsi_Interp *interp, Jsi_Obj *obj, uint len)
{
int nsiz = len + 1, mod = ALLOC_MOD_SIZE;
assert(obj->isarrlist);
if (mod>1)
nsiz = nsiz + ((mod-1) - (nsiz + mod - 1)%mod);
if (nsiz > MAX_ARRAY_LIST) {
Jsi_LogError("array size too large");
return 0;
}
... | CWE-190 | 19 |
static int on_header_value(
multipart_parser *parser, const char *at, size_t length)
{
multipart_parser_data_t *data = NULL;
ogs_assert(parser);
data = multipart_parser_get_data(parser);
ogs_assert(data);
if (at && length) {
SWITCH(data->header_field)
CASE(OGS_SBI_CONTENT_T... | CWE-476 | 46 |
acc_ctx_hints(OM_uint32 *minor_status,
gss_ctx_id_t *ctx,
spnego_gss_cred_id_t spcred,
gss_buffer_t *mechListMIC,
OM_uint32 *negState,
send_token_flag *return_token)
{
OM_uint32 tmpmin, ret;
gss_OID_set supported_mechSet;
spnego_gss_ctx_id_t sc = NULL;
*mechListMIC = GSS_C_NO_BUF... | CWE-763 | 61 |
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) {
if(!p || !g) /* q is optional */
return 0;
BN_free(dh->p);
BN_free(dh->q);
BN_free(dh->g);
dh->p = p;
dh->q = q;
dh->g = g;
if(q)
dh->length = BN_num_bits(q);
return 1;
} | CWE-295 | 52 |
jp2_box_t *jp2_box_get(jas_stream_t *in)
{
jp2_box_t *box;
jp2_boxinfo_t *boxinfo;
jas_stream_t *tmpstream;
uint_fast32_t len;
uint_fast64_t extlen;
bool dataflag;
box = 0;
tmpstream = 0;
if (!(box = jas_malloc(sizeof(jp2_box_t)))) {
goto error;
}
// Mark the box data as never having been constructed
/... | CWE-476 | 46 |
int main(int argc, char *argv[])
{
libettercap_init();
ef_globals_alloc();
select_text_interface();
libettercap_ui_init();
/* etterfilter copyright */
fprintf(stdout, "\n" EC_COLOR_BOLD "%s %s" EC_COLOR_END " copyright %s %s\n\n",
PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS);
... | CWE-125 | 47 |
static irqreturn_t snd_msnd_interrupt(int irq, void *dev_id)
{
struct snd_msnd *chip = dev_id;
void *pwDSPQData = chip->mappedbase + DSPQ_DATA_BUFF;
/* Send ack to DSP */
/* inb(chip->io + HP_RXL); */
/* Evaluate queued DSP messages */
while (readw(chip->DSPQ + JQS_wTail) != readw(chip->DSPQ + JQS_wHead)) {
u... | CWE-125 | 47 |
mcs_parse_domain_params(STREAM s)
{
int length;
ber_parse_header(s, MCS_TAG_DOMAIN_PARAMS, &length);
in_uint8s(s, length);
return s_check(s);
} | CWE-125 | 47 |
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
const char* cstring, Py_ssize_t start, Py_ssize_t stop,
const char* encoding, const char* errors,
PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
Py_ssize_t length;
if (unlikely((start < 0) | (stop <... | CWE-120 | 44 |
void posixtimer_rearm(struct siginfo *info)
{
struct k_itimer *timr;
unsigned long flags;
timr = lock_timer(info->si_tid, &flags);
if (!timr)
return;
if (timr->it_requeue_pending == info->si_sys_private) {
timr->kclock->timer_rearm(timr);
timr->it_active = 1;
timr->it_overrun_last = timr->it_overrun;
... | CWE-190 | 19 |
local void init_block(s)
deflate_state *s;
{
int n; /* iterates over tree elements */
/* Initialize the trees. */
for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
s->dyn_... | CWE-787 | 24 |
modify_policy_2_svc(mpol_arg *arg, struct svc_req *rqstp)
{
static generic_ret ret;
char *prime_arg;
gss_buffer_desc client_name,
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
cons... | CWE-772 | 53 |
char *string_crypt(const char *key, const char *salt) {
assert(key);
assert(salt);
char random_salt[12];
if (!*salt) {
memcpy(random_salt,"$1$",3);
ito64(random_salt+3,rand(),8);
random_salt[11] = '\0';
return string_crypt(key, random_salt);
}
if ((strlen(salt) > sizeof("$2X$00$")) &&
... | CWE-787 | 24 |
process_plane(uint8 * in, int width, int height, uint8 * out, int size)
{
UNUSED(size);
int indexw;
int indexh;
int code;
int collen;
int replen;
int color;
int x;
int revcode;
uint8 * last_line;
uint8 * this_line;
uint8 * org_in;
uint8 * org_out;
org_in = in;
org_out = out;
last_line = 0;
indexh = 0;... | CWE-125 | 47 |
decode_bytes_with_escapes(struct compiling *c, const node *n, const char *s,
size_t len)
{
return PyBytes_DecodeEscape(s, len, NULL, 0, NULL);
} | CWE-125 | 47 |
static SDL_Surface* Create_Surface_Solid(int width, int height, SDL_Color fg, Uint32 *color)
{
const int alignment = Get_Alignement() - 1;
SDL_Surface *textbuf;
Sint64 size;
/* Create a surface with memory:
* - pitch is rounded to alignment
* - adress is aligned
*/
void *pixels, *pt... | CWE-787 | 24 |
static int getSingletonPos(const char* str)
{
int result =-1;
int i=0;
int len = 0;
if( str && ((len=strlen(str))>0) ){
for( i=0; i<len ; i++){
if( isIDSeparator(*(str+i)) ){
if( i==1){
/* string is of the form x-avy or a-prv1 */
result =0;
break;
} else {
/* delimiter found; chec... | CWE-125 | 47 |
spnego_gss_delete_sec_context(
OM_uint32 *minor_status,
gss_ctx_id_t *context_handle,
gss_buffer_t output_token)
{
OM_uint32 ret = GSS_S_COMPLETE;
spnego_gss_ctx_id_t *ctx =
(spnego_gss_ctx_id_t *)context_handle;
*minor_status = 0;
if (context_handle == NULL)
return (GSS_S_FAILURE);
... | CWE-763 | 61 |
mcs_parse_domain_params(STREAM s)
{
int length;
ber_parse_header(s, MCS_TAG_DOMAIN_PARAMS, &length);
in_uint8s(s, length);
return s_check(s);
} | CWE-190 | 19 |
static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)
{
VirtQueueElement elem;
VirtQueue *vq;
vq = vser->c_ivq;
if (!virtio_queue_ready(vq)) {
return 0;
}
if (!virtqueue_pop(vq, &elem)) {
return 0;
}
memcpy(elem.in_sg[0].iov_base, buf, len);
vir... | CWE-120 | 44 |
static void cmd_parse_lsub (IMAP_DATA* idata, char* s)
{
char buf[STRING];
char errstr[STRING];
BUFFER err, token;
ciss_url_t url;
IMAP_LIST list;
if (idata->cmddata && idata->cmdtype == IMAP_CT_LIST)
{
/* caller will handle response itself */
cmd_parse_list (idata, s);
return;
}
if (!op... | CWE-78 | 6 |
static void ptirq_free_irte(const struct ptirq_remapping_info *entry)
{
struct intr_source intr_src;
if (entry->irte_idx < CONFIG_MAX_IR_ENTRIES) {
if (entry->intr_type == PTDEV_INTR_MSI) {
intr_src.is_msi = true;
intr_src.src.msi.value = entry->phys_sid.msi_id.bdf;
} else {
intr_src.is_msi = false;
... | CWE-120 | 44 |
static char *rfc2047_decode_word(const char *s, size_t len, enum ContentEncoding enc)
{
const char *it = s;
const char *end = s + len;
if (enc == ENCQUOTEDPRINTABLE)
{
struct Buffer buf = { 0 };
for (; it < end; ++it)
{
if (*it == '_')
{
mutt_buffer_addch(&buf, ' ');
}
... | CWE-120 | 44 |
snmp_engine_get(snmp_header_t *header, snmp_varbind_t *varbinds, uint32_t varbinds_length)
{
snmp_mib_resource_t *resource;
uint32_t i;
for(i = 0; i < varbinds_length; i++) {
resource = snmp_mib_find(varbinds[i].oid);
if(!resource) {
switch(header->version) {
case SNMP_VERSION_1:
head... | CWE-125 | 47 |
static int jp2_pclr_putdata(jp2_box_t *box, jas_stream_t *out)
{
#if 0
jp2_pclr_t *pclr = &box->data.pclr;
#endif
/* Eliminate warning about unused variable. */
box = 0;
out = 0;
return -1;
} | CWE-476 | 46 |
l2tp_result_code_print(netdissect_options *ndo, const u_char *dat, u_int length)
{
const uint16_t *ptr = (const uint16_t *)dat;
ND_PRINT((ndo, "%u", EXTRACT_16BITS(ptr))); ptr++; /* Result Code */
if (length > 2) { /* Error Code (opt) */
ND_PRINT((ndo, "/%u", EXTRACT_16BITS(ptr))); ptr++;
}
if (length... | CWE-125 | 47 |
static int setup_dev_console(const struct lxc_rootfs *rootfs,
const struct lxc_console *console)
{
char path[MAXPATHLEN];
struct stat s;
int ret;
ret = snprintf(path, sizeof(path), "%s/dev/console", rootfs->mount);
if (ret >= sizeof(path)) {
ERROR("console path too long");
return -1;
}
if (access(path,... | CWE-59 | 36 |
static Jsi_RC jsi_ArrayUnshiftCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
Jsi_Obj *obj = _this->d.obj;
int argc = Jsi_ValueGetLe... | CWE-190 | 19 |
process_plane(uint8 * in, int width, int height, uint8 * out, int size)
{
UNUSED(size);
int indexw;
int indexh;
int code;
int collen;
int replen;
int color;
int x;
int revcode;
uint8 * last_line;
uint8 * this_line;
uint8 * org_in;
uint8 * org_out;
org_in = in;
org_out = out;
last_line = 0;
indexh = 0;... | CWE-190 | 19 |
static Jsi_RC DebugInfoCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
if (!interp->breakpointHash) {
Jsi_ValueMakeArrayObject(interp, ret, NULL);
return JSI_OK;
}
int argc = Jsi_ValueGetLength(interp, args);
if (argc == 0)
ret... | CWE-120 | 44 |
void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting)
{
const struct k_clock *kc = timr->kclock;
ktime_t now, remaining, iv;
struct timespec64 ts64;
bool sig_none;
sig_none = timr->it_sigev_notify == SIGEV_NONE;
iv = timr->it_interval;
/* interval timer ? */
if (iv) {
cur_setting->i... | CWE-190 | 19 |
diff_buf_delete(buf_T *buf)
{
int i;
tabpage_T *tp;
FOR_ALL_TABPAGES(tp)
{
i = diff_buf_idx_tp(buf, tp);
if (i != DB_COUNT)
{
tp->tp_diffbuf[i] = NULL;
tp->tp_diff_invalid = TRUE;
if (tp == curtab)
diff_redraw(TRUE);
}
}
} | CWE-476 | 46 |
ber_parse_header(STREAM s, int tagval, int *length)
{
int tag, len;
if (tagval > 0xff)
{
in_uint16_be(s, tag);
}
else
{
in_uint8(s, tag);
}
if (tag != tagval)
{
logger(Core, Error, "ber_parse_header(), expected tag %d, got %d", tagval, tag);
return False;
}
in_uint8(s, len);
if (len & 0x80)
{
... | CWE-191 | 55 |
CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
{
bool ok;
XkbFile *files[LAST_KEYMAP_FILE_TYPE + 1] = { NULL };
enum xkb_file_type type;
struct xkb_context *ctx = keymap->ctx;
/* Collect section files and check for duplicates. */
for (file = (XkbFile *) file->def... | CWE-476 | 46 |
void init_xml_relax_ng()
{
VALUE nokogiri = rb_define_module("Nokogiri");
VALUE xml = rb_define_module_under(nokogiri, "XML");
VALUE klass = rb_define_class_under(xml, "RelaxNG", cNokogiriXmlSchema);
cNokogiriXmlRelaxNG = klass;
rb_define_singleton_method(klass, "read_memory", read_memory, 1);
rb_define_s... | CWE-611 | 13 |
PJ_DEF(pj_status_t) pjmedia_rtcp_fb_build_nack(
pjmedia_rtcp_session *session,
void *buf,
pj_size_t *length,
unsigned nack_cnt,
const pjmedia_rtcp_fb_nack nack[])
{
pjmedia_rtcp_common *hdr;
pj_uint8_t *p;
unsigned len, i;
PJ_ASSERT_RETURN(session && buf && length && nack_cnt &... | CWE-787 | 24 |
int jpc_ppxstab_insert(jpc_ppxstab_t *tab, jpc_ppxstabent_t *ent)
{
int inspt;
int i;
for (i = 0; i < tab->numents; ++i) {
if (tab->ents[i]->ind > ent->ind) {
break;
}
}
inspt = i;
if (tab->numents >= tab->maxents) {
if (jpc_ppxstab_grow(tab, tab->maxents + 128)) {
return -1;
}
}
for (i = tab->... | CWE-770 | 37 |
MONGO_EXPORT int mongo_run_command( mongo *conn, const char *db, const bson *command,
bson *out ) {
int ret = MONGO_OK;
bson response = {NULL, 0};
bson fields;
int sl = strlen( db );
char *ns = bson_malloc( sl + 5 + 1 ); /* ".$cmd" + nul */
int res, success = ... | CWE-190 | 19 |
PyMemoTable_Copy(PyMemoTable *self)
{
Py_ssize_t i;
PyMemoTable *new = PyMemoTable_New();
if (new == NULL)
return NULL;
new->mt_used = self->mt_used;
new->mt_allocated = self->mt_allocated;
new->mt_mask = self->mt_mask;
/* The table we get from _New() is probably smaller than we wan... | CWE-190 | 19 |
void cJSON_ReplaceItemInObject( cJSON *object, const char *string, cJSON *newitem )
{
int i = 0;
cJSON *c = object->child;
while ( c && cJSON_strcasecmp( c->string, string ) ) {
++i;
c = c->next;
}
if ( c ) {
newitem->string = cJSON_strdup( string );
cJSON_ReplaceItemInArray( object, i, newitem );
}
} | CWE-120 | 44 |
pthread_mutex_lock(pthread_mutex_t *mutex)
{
EnterCriticalSection(mutex);
return 0;
} | CWE-125 | 47 |
create_policy_2_svc(cpol_arg *arg, struct svc_req *rqstp)
{
static generic_ret ret;
char *prime_arg;
gss_buffer_desc client_name,
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
cons... | CWE-772 | 53 |
ber_parse_header(STREAM s, int tagval, int *length)
{
int tag, len;
if (tagval > 0xff)
{
in_uint16_be(s, tag);
}
else
{
in_uint8(s, tag);
}
if (tag != tagval)
{
logger(Core, Error, "ber_parse_header(), expected tag %d, got %d", tagval, tag);
return False;
}
in_uint8(s, len);
if (len & 0x80)
{
... | CWE-191 | 55 |
GPMF_ERR IsValidSize(GPMF_stream *ms, uint32_t size) // size is in longs not bytes.
{
if (ms)
{
int32_t nestsize = (int32_t)ms->nest_size[ms->nest_level];
if (nestsize == 0 && ms->nest_level == 0)
nestsize = ms->buffer_size_longs;
if (size + 2 <= nestsize) return GPMF_OK;
}
return GPMF_ERROR_BAD_STRUCTURE... | CWE-125 | 47 |
int input_set_keycode(struct input_dev *dev,
const struct input_keymap_entry *ke)
{
unsigned long flags;
unsigned int old_keycode;
int retval;
if (ke->keycode > KEY_MAX)
return -EINVAL;
spin_lock_irqsave(&dev->event_lock, flags);
retval = dev->setkeycode(dev, ke, &old_keycode);
if (retval)
goto ou... | CWE-787 | 24 |
mcs_parse_domain_params(STREAM s)
{
int length;
ber_parse_header(s, MCS_TAG_DOMAIN_PARAMS, &length);
in_uint8s(s, length);
return s_check(s);
} | CWE-787 | 24 |
write_stacktrace(const char *file_name, const char *str)
{
int fd;
void *buffer[100];
int nptrs;
int i;
char **strs;
nptrs = backtrace(buffer, 100);
if (file_name) {
fd = open(file_name, O_WRONLY | O_APPEND | O_CREAT, 0644);
if (str)
dprintf(fd, "%s\n", str);
backtrace_symbols_fd(buffer, nptrs, fd);
... | CWE-59 | 36 |
skip_string(char_u *p)
{
int i;
// We loop, because strings may be concatenated: "date""time".
for ( ; ; ++p)
{
if (p[0] == '\'') // 'c' or '\n' or '\000'
{
if (p[1] == NUL) // ' at end of line
break;
i = 2;
if (p[1] == '\\' && p[2] != NUL) // '\n' or '\000'
{
... | CWE-787 | 24 |
update_bar_address(struct vmctx *ctx, struct pci_vdev *dev, uint64_t addr,
int idx, int type, bool ignore_reg_unreg)
{
bool decode = false;
uint64_t orig_addr = dev->bar[idx].addr;
if (!ignore_reg_unreg) {
if (dev->bar[idx].type == PCIBAR_IO)
decode = porten(dev);
else
decode = memen(dev);
}
if (decod... | CWE-617 | 51 |
mcs_parse_domain_params(STREAM s)
{
int length;
ber_parse_header(s, MCS_TAG_DOMAIN_PARAMS, &length);
in_uint8s(s, length);
return s_check(s);
} | CWE-125 | 47 |
void print_cfs_stats(struct seq_file *m, int cpu)
{
struct cfs_rq *cfs_rq, *pos;
rcu_read_lock();
for_each_leaf_cfs_rq_safe(cpu_rq(cpu), cfs_rq, pos)
print_cfs_rq(m, cpu, cfs_rq);
rcu_read_unlock();
} | CWE-835 | 42 |
void handle_debug_usb_rx(const void *msg, size_t len)
{
if (msg_tiny_flag) {
uint8_t buf[64];
memcpy(buf, msg, sizeof(buf));
uint16_t msgId = buf[4] | ((uint16_t)buf[3]) << 8;
uint32_t msgSize = buf[8] |
((uint32_t)buf[7]) << 8 |
((uint32_t)bu... | CWE-787 | 24 |
SPL_METHOD(SplFileObject, setMaxLineLen)
{
long max_len;
spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &max_len) == FAILURE) {
return;
}
if (max_len < 0) {
zend_throw_exception_ex(spl_ce_Do... | CWE-190 | 19 |
pci_get_cfgdata16(struct pci_vdev *dev, int offset)
{
assert(offset <= (PCI_REGMAX - 1) && (offset & 1) == 0);
return (*(uint16_t *)(dev->cfgdata + offset));
} | CWE-617 | 51 |
TEE_Result tee_mmu_check_access_rights(const struct user_ta_ctx *utc,
uint32_t flags, uaddr_t uaddr,
size_t len)
{
uaddr_t a;
size_t addr_incr = MIN(CORE_MMU_USER_CODE_SIZE,
CORE_MMU_USER_PARAM_SIZE);
if (ADD_OVERFLOW(uaddr, len, &a))
return TEE_ERROR_ACCESS_DENIED;
if ((flags & ... | CWE-787 | 24 |
int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info,
struct btrfs_ioctl_get_dev_stats *stats)
{
struct btrfs_device *dev;
struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
int i;
mutex_lock(&fs_devices->device_list_mutex);
dev = btrfs_find_device(fs_info->fs_devices, stats->devid, NULL, NULL);
mute... | CWE-476 | 46 |
GF_Err hdlr_dump(GF_Box *a, FILE * trace)
{
GF_HandlerBox *p = (GF_HandlerBox *)a;
gf_isom_box_dump_start(a, "HandlerBox", trace);
if (p->nameUTF8 && (u32) p->nameUTF8[0] == strlen(p->nameUTF8+1)) {
fprintf(trace, "hdlrType=\"%s\" Name=\"%s\" ", gf_4cc_to_str(p->handlerType), p->nameUTF8+1);
} else {
fprintf(tr... | CWE-125 | 47 |
DECLAREreadFunc(readContigTilesIntoBuffer)
{
int status = 1;
tsize_t tilesize = TIFFTileSize(in);
tdata_t tilebuf;
uint32 imagew = TIFFScanlineSize(in);
uint32 tilew = TIFFTileRowSize(in);
int iskew = imagew - tilew;
uint8* bufp = (uint8*) buf;
uint32 tw, tl;
uint32 row;
(void) spp;
tilebuf = _TIFFmalloc(t... | CWE-190 | 19 |
static int msg_parse_fetch(struct ImapHeader *h, char *s)
{
char tmp[SHORT_STRING];
char *ptmp = NULL;
if (!s)
return -1;
while (*s)
{
SKIPWS(s);
if (mutt_str_strncasecmp("FLAGS", s, 5) == 0)
{
s = msg_parse_flags(h, s);
if (!s)
return -1;
}
else if (mutt_str_str... | CWE-787 | 24 |
mp_dss_print(netdissect_options *ndo,
const u_char *opt, u_int opt_len, u_char flags)
{
const struct mp_dss *mdss = (const struct mp_dss *) opt;
if ((opt_len != mp_dss_len(mdss, 1) &&
opt_len != mp_dss_len(mdss, 0)) || flags & TH_SYN)
return 0;
if (mds... | CWE-125 | 47 |
service_info *FindServiceControlURLPath(
service_table *table, const char *controlURLPath)
{
service_info *finger = NULL;
uri_type parsed_url;
uri_type parsed_url_in;
if (table && parse_uri(controlURLPath,
strlen(controlURLPath),
&parsed_url_in) == HTTP_SUCCESS) {
finger = table->serviceList;
... | CWE-476 | 46 |
find_sig8_target_as_global_offset(Dwarf_Attribute attr,
Dwarf_Sig8 *sig8,
Dwarf_Bool *is_info,
Dwarf_Off *targoffset,
Dwarf_Error *error)
{
Dwarf_Die targdie = 0;
Dwarf_Bool targ_is_info = 0;
Dwarf_Off localoff = 0;
int res = 0;
targ_is_info = attr->ar_cu_context->cc_is_info;
... | CWE-125 | 47 |
static void Np_toString(js_State *J)
{
char buf[32];
js_Object *self = js_toobject(J, 0);
int radix = js_isundefined(J, 1) ? 10 : js_tointeger(J, 1);
if (self->type != JS_CNUMBER)
js_typeerror(J, "not a number");
if (radix == 10) {
js_pushstring(J, jsV_numbertostring(J, buf, self->u.number));
return;
}
if ... | CWE-787 | 24 |
process_bitmap_updates(STREAM s)
{
uint16 num_updates;
uint16 left, top, right, bottom, width, height;
uint16 cx, cy, bpp, Bpp, compress, bufsize, size;
uint8 *data, *bmpdata;
int i;
logger(Protocol, Debug, "%s()", __func__);
in_uint16_le(s, num_updates);
for (i = 0; i < num_updates; i++)
{
in_uint16_le(s... | CWE-125 | 47 |
PHP_FUNCTION(locale_get_display_name)
{
get_icu_disp_value_src_php( DISP_NAME , INTERNAL_FUNCTION_PARAM_PASSTHRU );
} | CWE-125 | 47 |
ast_for_for_stmt(struct compiling *c, const node *n0, bool is_async)
{
const node * const n = is_async ? CHILD(n0, 1) : n0;
asdl_seq *_target, *seq = NULL, *suite_seq;
expr_ty expression;
expr_ty target, first;
const node *node_target;
int end_lineno, end_col_offset;
/* for_stmt: 'for' exprl... | CWE-125 | 47 |
_client_protocol_timeout (GsmXSMPClient *client)
{
g_debug ("GsmXSMPClient: client_protocol_timeout for client '%s' in ICE status %d",
client->priv->description,
IceConnectionStatus (client->priv->ice_connection));
gsm_client_set_status (GSM_CLIENT (client), GSM_CLIENT... | CWE-835 | 42 |
process_plane(uint8 * in, int width, int height, uint8 * out, int size)
{
UNUSED(size);
int indexw;
int indexh;
int code;
int collen;
int replen;
int color;
int x;
int revcode;
uint8 * last_line;
uint8 * this_line;
uint8 * org_in;
uint8 * org_out;
org_in = in;
org_out = out;
last_line = 0;
indexh = 0;... | CWE-787 | 24 |
mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
struct cfg80211_ap_settings *params)
{
struct ieee_types_header *rate_ie;
int var_offset = offsetof(struct ieee80211_mgmt, u.beacon.variable);
const u8 *var_pos = params->beacon.head + var_offset;
int len = params->beacon.head_len - var_offset;
u... | CWE-787 | 24 |
PHP_FUNCTION(locale_get_display_region)
{
get_icu_disp_value_src_php( LOC_REGION_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU );
} | CWE-125 | 47 |
static int crypto_rng_init_tfm(struct crypto_tfm *tfm)
{
struct crypto_rng *rng = __crypto_rng_cast(tfm);
struct rng_alg *alg = crypto_rng_alg(rng);
struct old_rng_alg *oalg = crypto_old_rng_alg(rng);
if (oalg->rng_make_random) {
rng->generate = generate;
rng->seed = rngapi_reset;
rng->seedsize = oalg->seeds... | CWE-476 | 46 |
def testRunCommandInvalidSignature(self, use_tfrt):
self.parser = saved_model_cli.create_parser()
base_path = test.test_src_dir_path(SAVED_MODEL_PATH)
args = self.parser.parse_args([
'run', '--dir', base_path, '--tag_set', 'serve', '--signature_def',
'INVALID_SIGNATURE', '--input_exprs', '... | CWE-94 | 14 |
def test_challenge_with_vhm(self):
rc, root, folder, object = self._makeTree()
response = FauxCookieResponse()
vhm = 'http://localhost/VirtualHostBase/http/test/VirtualHostRoot/xxx'
actualURL = 'http://test/xxx'
request = FauxRequest(RESPONSE=response, URL=vhm,
... | CWE-601 | 11 |
def test_fix_missing_locations(self):
src = ast.parse('write("spam")')
src.body.append(ast.Expr(ast.Call(ast.Name('spam', ast.Load()),
[ast.Str('eggs')], [])))
self.assertEqual(src, ast.fix_missing_locations(src))
self.maxDiff = None
... | CWE-125 | 47 |
def testProxyGET(self):
data = b"""\
GET https://example.com:8080/foobar HTTP/8.4
content-length: 7
Hello.
"""
parser = self.parser
self.feed(data)
self.assertTrue(parser.completed)
self.assertEqual(parser.version, "8.4")
self.assertFalse(parser.empty)
self.a... | CWE-444 | 41 |
def _build_url(self, path, queries=()):
"""
Takes a relative path and query parameters, combines them with the
base path, and returns the result. Handles utf-8 encoding as necessary.
:param path: relative path for this request, relative to
self.base_prefix... | CWE-295 | 52 |
def uniq(inpt):
output = []
inpt = [ " ".join(inp.split()) for inp in inpt]
for x in inpt:
if x not in output:
output.append(x)
return output | CWE-918 | 16 |
def model_from_yaml(yaml_string, custom_objects=None):
"""Parses a yaml model configuration file and returns a model instance.
Usage:
>>> model = tf.keras.Sequential([
... tf.keras.layers.Dense(5, input_shape=(3,)),
... tf.keras.layers.Softmax()])
>>> try:
... import yaml
... config = mode... | CWE-502 | 15 |
def edit_book_comments(comments, book):
modif_date = False
if len(book.comments):
if book.comments[0].text != comments:
book.comments[0].text = comments
modif_date = True
else:
if comments:
book.comments.append(db.Comments(text=comments, book=book.id))
... | CWE-79 | 1 |
def __init__(self, hs):
super().__init__(hs)
self.hs = hs
self.is_mine_id = hs.is_mine_id
self.http_client = hs.get_simple_http_client()
self._presence_enabled = hs.config.use_presence
# The number of ongoing syncs on this process, by user id.
# Empty if _pr... | CWE-601 | 11 |
def insensitive_starts_with(field: Term, value: str) -> Criterion:
return Upper(field).like(Upper(f"{value}%")) | CWE-89 | 0 |
def test_broken_chunked_encoding(self):
control_line = "20;\r\n" # 20 hex = 32 dec
s = "This string has 32 characters.\r\n"
to_send = "GET / HTTP/1.1\nTransfer-Encoding: chunked\n\n"
to_send += control_line + s
# garbage in input
to_send += "GET / HTTP/1.1\nTransfer-... | CWE-444 | 41 |
def sql_execute(self, sentence):
self.cursor.execute(sentence)
return self.cursor.fetchall() | CWE-89 | 0 |
def feed_author(book_id):
off = request.args.get("offset") or 0
entries, __, pagination = calibre_db.fill_indexpage((int(off) / (int(config.config_books_per_page)) + 1), 0,
db.Books,
db.Books.authors.... | CWE-918 | 16 |
def read_config(self, config, **kwargs):
consent_config = config.get("user_consent")
self.terms_template = self.read_templates(["terms.html"], autoescape=True)[0]
if consent_config is None:
return
self.user_consent_version = str(consent_config["version"])
self.us... | CWE-79 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.