instruction
stringclasses
1 value
input
stringlengths
31
235k
output
class label
2 classes
Categorize the following code snippet as vulnerable or not. True or False
static void decrypt ( MPI output , MPI a , MPI b , ELG_secret_key * skey ) { MPI t1 = mpi_alloc_secure ( mpi_get_nlimbs ( skey -> p ) ) ; mpi_normalize ( a ) ; mpi_normalize ( b ) ; mpi_powm ( t1 , a , skey -> x , skey -> p ) ; mpi_invm ( t1 , t1 , skey -> p ) ; mpi_mulm ( output , b , t1 , skey -> p ) ; # if 0 if ( DBG_CIPHER ) { log_mpidump ( "elg decrypted x= " , skey -> x ) ; log_mpidump ( "elg decrypted p= " , skey -> p ) ; log_mpidump ( "elg decrypted a= " , a ) ; log_mpidump ( "elg decrypted b= " , b ) ; log_mpidump ( "elg decrypted M= " , output ) ; } # endif mpi_free ( t1 ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
METHOD ( certificate_t , get_subject , identification_t * , private_x509_cert_t * this ) { return this -> subject ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void ctl_clr_stats ( void ) { ctltimereset = current_time ; numctlreq = 0 ; numctlbadpkts = 0 ; numctlresponses = 0 ; numctlfrags = 0 ; numctlerrors = 0 ; numctlfrags = 0 ; numctltooshort = 0 ; numctlinputresp = 0 ; numctlinputfrag = 0 ; numctlinputerr = 0 ; numctlbadoffset = 0 ; numctlbadversion = 0 ; numctldatatooshort = 0 ; numctlbadop = 0 ; numasyncmsgs = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void u_printf_reset_sign ( UNumberFormat * format , const u_printf_spec_info * info , UChar * prefixBuffer , int32_t * prefixBufLen , UErrorCode * status ) { if ( info -> fShowSign ) { unum_setTextAttribute ( format , UNUM_POSITIVE_PREFIX , prefixBuffer , * prefixBufLen , status ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void evdns_resolv_set_defaults ( int flags ) { if ( flags & DNS_OPTION_SEARCH ) search_set_from_hostname ( ) ; if ( flags & DNS_OPTION_NAMESERVERS ) evdns_nameserver_ip_add ( "127.0.0.1" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void fz_cmm_fin_profile ( fz_context * ctx , fz_iccprofile * profile ) { if ( ctx && ctx -> colorspace && ctx -> colorspace -> cmm && ctx -> cmm_instance ) if ( profile && profile -> cmm_handle != NULL ) ctx -> colorspace -> cmm -> fin_profile ( ctx -> cmm_instance , profile ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline Quantum GetPixelChannel ( const Image * restrict image , const PixelChannel channel , const Quantum * restrict pixel ) { if ( image -> channel_map [ channel ] . traits == UndefinedPixelTrait ) return ( ( Quantum ) 0 ) ; return ( pixel [ image -> channel_map [ channel ] . offset ] ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline PixelTrait GetPixelCbTraits ( const Image * restrict image ) { return ( image -> channel_map [ CbPixelChannel ] . traits ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void spl_filesystem_tree_it_move_forward ( zend_object_iterator * iter TSRMLS_DC ) { spl_filesystem_iterator * iterator = ( spl_filesystem_iterator * ) iter ; spl_filesystem_object * object = spl_filesystem_iterator_to_object ( iterator ) ; object -> u . dir . index ++ ; do { spl_filesystem_dir_read ( object TSRMLS_CC ) ; } while ( spl_filesystem_is_dot ( object -> u . dir . entry . d_name ) ) ; if ( object -> file_name ) { efree ( object -> file_name ) ; object -> file_name = NULL ; } if ( iterator -> current ) { zval_ptr_dtor ( & iterator -> current ) ; iterator -> current = NULL ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_logicalChannelNum ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 92 "../../asn1/h245/h245.cnf" guint32 value ; offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 65535U , & value , FALSE ) ; h223_me -> sublist = NULL ; h223_me -> vc = value & 0xffff ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int parse_padding ( tvbuff_t * tvb , int offset , int alignment , proto_tree * pad_tree , const char * fmt , ... ) { if ( offset % alignment ) { const int padding = alignment - ( offset % alignment ) ; const char * txt ; va_list ap ; proto_item * ti ; va_start ( ap , fmt ) ; txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ; proto_tree_add_subtree ( pad_tree , tvb , offset , padding , ett_mswsp_msg_padding , & ti , txt ) ; va_end ( ap ) ; proto_item_append_text ( ti , " (%d)" , padding ) ; offset += padding ; } DISSECTOR_ASSERT ( ( offset % alignment ) == 0 ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
hb_bool_t hb_set_is_empty ( const hb_set_t * set ) { return set -> is_empty ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
char * curl_mvaprintf ( const char * format , va_list ap_save ) { int retcode ; struct asprintf info ; info . buffer = NULL ; info . len = 0 ; info . alloc = 0 ; info . fail = 0 ; retcode = dprintf_formatf ( & info , alloc_addbyter , format , ap_save ) ; if ( ( - 1 == retcode ) || info . fail ) { if ( info . alloc ) free ( info . buffer ) ; return NULL ; } if ( info . alloc ) { info . buffer [ info . len ] = 0 ; return info . buffer ; } else return strdup ( "" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int util_query ( MYSQL * org_mysql , const char * query ) { MYSQL * mysql ; DBUG_ENTER ( "util_query" ) ; if ( ! ( mysql = cur_con -> util_mysql ) ) { DBUG_PRINT ( "info" , ( "Creating util_mysql" ) ) ; if ( ! ( mysql = mysql_init ( mysql ) ) ) die ( "Failed in mysql_init()" ) ; if ( opt_connect_timeout ) mysql_options ( mysql , MYSQL_OPT_CONNECT_TIMEOUT , ( void * ) & opt_connect_timeout ) ; mysql_options ( mysql , MYSQL_OPT_LOCAL_INFILE , 0 ) ; mysql_options ( mysql , MYSQL_OPT_NONBLOCK , 0 ) ; safe_connect ( mysql , "util" , org_mysql -> host , org_mysql -> user , org_mysql -> passwd , org_mysql -> db , org_mysql -> port , org_mysql -> unix_socket ) ; cur_con -> util_mysql = mysql ; } int ret = mysql_query ( mysql , query ) ; DBUG_RETURN ( ret ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void proto_tree_set_oid ( field_info * fi , const guint8 * value_ptr , gint length ) { GByteArray * bytes ; DISSECTOR_ASSERT ( value_ptr != NULL || length == 0 ) ; bytes = g_byte_array_new ( ) ; if ( length > 0 ) { g_byte_array_append ( bytes , value_ptr , length ) ; } fvalue_set_byte_array ( & fi -> value , bytes ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline const guint8 * get_string_value ( wmem_allocator_t * scope , tvbuff_t * tvb , gint start , gint length , gint * ret_length , const guint encoding ) { if ( length == - 1 ) { length = tvb_ensure_captured_length_remaining ( tvb , start ) ; } * ret_length = length ; return tvb_get_string_enc ( scope , tvb , start , length , encoding ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void qio_channel_websock_handshake_send_res_err ( QIOChannelWebsock * ioc , const char * resdata ) { char * date = qio_channel_websock_date_str ( ) ; qio_channel_websock_handshake_send_res ( ioc , resdata , date ) ; g_free ( date ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_task_setioprio ( struct task_struct * p , int ioprio ) { return current_has_perm ( p , PROCESS__SETSCHED ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static unsigned char * extra_open_record ( unsigned char * bp , int dr_len , struct isoent * isoent , struct ctl_extr_rec * ctl ) { ctl -> bp = bp ; if ( bp != NULL ) bp += dr_len ; ctl -> use_extr = 0 ; ctl -> isoent = isoent ; ctl -> ce_ptr = NULL ; ctl -> cur_len = ctl -> dr_len = dr_len ; ctl -> limit = DR_LIMIT ; return ( bp ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
REGRESSION_TEST ( SDK_API_TSIOBufferReaderClone ) ( RegressionTest * test , int , int * pstatus ) { bool test_passed = false ; * pstatus = REGRESSION_TEST_INPROGRESS ; TSIOBuffer bufp = TSIOBufferSizedCreate ( TS_IOBUFFER_SIZE_INDEX_4K ) ; TSIOBufferReader readerp = TSIOBufferReaderAlloc ( bufp ) ; TSIOBufferProduce ( bufp , 10 ) ; TSIOBufferReaderConsume ( readerp , 5 ) ; TSIOBufferReader readerp2 = TSIOBufferReaderClone ( readerp ) ; int64_t reader_avail = TSIOBufferReaderAvail ( readerp2 ) ; if ( reader_avail == 5 ) { SDK_RPRINT ( test , "TSIOBufferReaderClone" , "TestCase1" , TC_PASS , "ok" ) ; test_passed = true ; } else { SDK_RPRINT ( test , "TSIOBufferReaderClone" , "TestCase1" , TC_FAIL , "failed" ) ; } * pstatus = ( ( test_passed == true ) ? REGRESSION_TEST_PASSED : REGRESSION_TEST_FAILED ) ; return ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_ParallelH245Control_item ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 361 "./asn1/h225/h225.cnf" tvbuff_t * h245_tvb = NULL ; offset = dissect_per_octet_string ( tvb , offset , actx , tree , hf_index , NO_BOUND , NO_BOUND , FALSE , & h245_tvb ) ; next_tvb_add_handle ( & h245_list , h245_tvb , ( h225_h245_in_tree ) ? tree : NULL , h245dg_handle ) ; return offset ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static FILE * Needs816Enc ( SplineFont * sf , int * tlen , EncMap * map , FILE * * apple , int * appletlen ) { FILE * sub ; const char * encname = map -> enc -> iconv_name != NULL ? map -> enc -> iconv_name : map -> enc -> enc_name ; EncMap * oldmap = map ; EncMap * applemap = NULL ; Encoding * enc ; * tlen = 0 ; if ( apple != NULL ) { * apple = NULL ; * appletlen = 0 ; } if ( sf -> cidmaster != NULL || sf -> subfontcnt != 0 ) return ( NULL ) ; if ( ( strstrmatch ( encname , "big" ) != NULL && strchr ( encname , '5' ) != NULL ) || strstrmatch ( encname , "johab" ) != NULL || strstrmatch ( encname , "sjis" ) != NULL || strstrmatch ( encname , "cp932" ) != NULL || strstrmatch ( encname , "euc-kr" ) != NULL || strstrmatch ( encname , "euc-cn" ) != NULL ) ; else if ( strstrmatch ( encname , "2022" ) != NULL && ( strstrmatch ( encname , "JP2" ) != NULL || strstrmatch ( encname , "JP-2" ) != NULL || strstrmatch ( encname , "JP-3" ) != NULL ) ) return ( NULL ) ; else if ( sf -> uni_interp >= ui_japanese && sf -> uni_interp <= ui_korean ) { enc = FindOrMakeEncoding ( sf -> uni_interp == ui_japanese ? "sjis" : sf -> uni_interp == ui_trad_chinese ? "big5" : sf -> uni_interp == ui_simp_chinese ? "euc-cn" : "euc-kr" ) ; if ( map -> enc != enc ) { map = EncMapFromEncoding ( sf , enc ) ; encname = map -> enc -> iconv_name != NULL ? map -> enc -> iconv_name : map -> enc -> enc_name ; } } else return ( NULL ) ; if ( strstrmatch ( encname , "sjis" ) != NULL ) { enc = FindOrMakeEncoding ( "cp932" ) ; if ( enc != NULL ) { applemap = map ; map = EncMapFromEncoding ( sf , enc ) ; } } else if ( strstrmatch ( encname , "cp932" ) != NULL ) applemap = EncMapFromEncoding ( sf , FindOrMakeEncoding ( "sjis" ) ) ; if ( applemap != NULL ) * apple = _Gen816Enc ( sf , appletlen , applemap ) ; sub = _Gen816Enc ( sf , tlen , map ) ; if ( applemap != NULL && applemap != oldmap ) EncMapFree ( applemap ) ; if ( map != oldmap ) EncMapFree ( map ) ; return ( sub ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void init_bit_trees ( ) { init_bit_tree ( cat1 , 1 ) ; init_bit_tree ( cat2 , 2 ) ; init_bit_tree ( cat3 , 3 ) ; init_bit_tree ( cat4 , 4 ) ; init_bit_tree ( cat5 , 5 ) ; init_bit_tree ( cat6 , 14 ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static uint32_t openpic_cpu_read_internal ( void * opaque , hwaddr addr , int idx ) { OpenPICState * opp = opaque ; IRQDest * dst ; uint32_t retval ; DPRINTF ( "%s: cpu %d addr %#" HWADDR_PRIx "\n" , __func__ , idx , addr ) ; retval = 0xFFFFFFFF ; if ( idx < 0 ) { return retval ; } if ( addr & 0xF ) { return retval ; } dst = & opp -> dst [ idx ] ; addr &= 0xFF0 ; switch ( addr ) { case 0x80 : retval = dst -> ctpr ; break ; case 0x90 : retval = idx ; break ; case 0xA0 : retval = openpic_iack ( opp , dst , idx ) ; break ; case 0xB0 : retval = 0 ; break ; default : break ; } DPRINTF ( "%s: => 0x%08x\n" , __func__ , retval ) ; return retval ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) { return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) { return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) { OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) { return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ; } static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) { return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) { return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) { return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ; } # define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ; typedef const char * OPENSSL_CSTRING ; DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int codebook_sanity_check_for_rate_quarter ( const uint8_t * cbgain ) { int i , diff , prev_diff = 0 ; for ( i = 1 ; i < 5 ; i ++ ) { diff = cbgain [ i ] - cbgain [ i - 1 ] ; if ( FFABS ( diff ) > 10 ) return - 1 ; else if ( FFABS ( diff - prev_diff ) > 12 ) return - 1 ; prev_diff = diff ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ossl_asn1_is_explicit ( VALUE obj ) { VALUE s ; s = ossl_asn1_get_tagging ( obj ) ; if ( NIL_P ( s ) || s == sym_IMPLICIT ) return 0 ; else if ( s == sym_EXPLICIT ) return 1 ; else ossl_raise ( eASN1Error , "invalid tag default" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_GatekeeperInfo ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_GatekeeperInfo , GatekeeperInfo_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void config_unpeers ( config_tree * ptree ) { sockaddr_u peeraddr ; struct addrinfo hints ; unpeer_node * curr_unpeer ; struct peer * p ; const char * name ; int rc ; curr_unpeer = HEAD_PFIFO ( ptree -> unpeers ) ; for ( ; curr_unpeer != NULL ; curr_unpeer = curr_unpeer -> link ) { if ( curr_unpeer -> assocID ) { p = findpeerbyassoc ( curr_unpeer -> assocID ) ; if ( p != NULL ) { msyslog ( LOG_NOTICE , "unpeered %s" , stoa ( & p -> srcadr ) ) ; peer_clear ( p , "GONE" ) ; unpeer ( p ) ; } continue ; } memset ( & peeraddr , 0 , sizeof ( peeraddr ) ) ; AF ( & peeraddr ) = curr_unpeer -> addr -> type ; name = curr_unpeer -> addr -> address ; rc = getnetnum ( name , & peeraddr , 0 , t_UNK ) ; if ( rc > 0 ) { DPRINTF ( 1 , ( "unpeer: searching for %s\n" , stoa ( & peeraddr ) ) ) ; p = findexistingpeer ( & peeraddr , NULL , NULL , - 1 ) ; if ( p != NULL ) { msyslog ( LOG_NOTICE , "unpeered %s" , stoa ( & peeraddr ) ) ; peer_clear ( p , "GONE" ) ; unpeer ( p ) ; } continue ; } for ( p = peer_list ; p != NULL ; p = p -> p_link ) if ( p -> hostname != NULL ) if ( ! strcasecmp ( p -> hostname , name ) ) break ; if ( p != NULL ) { msyslog ( LOG_NOTICE , "unpeered %s" , name ) ; peer_clear ( p , "GONE" ) ; unpeer ( p ) ; } # ifdef WORKER memset ( & hints , 0 , sizeof ( hints ) ) ; hints . ai_family = curr_unpeer -> addr -> type ; hints . ai_socktype = SOCK_DGRAM ; hints . ai_protocol = IPPROTO_UDP ; getaddrinfo_sometime ( name , "ntp" , & hints , INITIAL_DNS_RETRY , & unpeer_name_resolved , NULL ) ; # else msyslog ( LOG_ERR , "hostname %s can not be used, please use IP address instead.\n" , name ) ; # endif } }
0False
Categorize the following code snippet as vulnerable or not. True or False
enum ImapAuthRes imap_auth_gss ( struct ImapData * idata , const char * method ) { gss_buffer_desc request_buf , send_token ; gss_buffer_t sec_token ; gss_name_t target_name ; gss_ctx_id_t context ; gss_OID mech_name ; char server_conf_flags ; gss_qop_t quality ; int cflags ; OM_uint32 maj_stat , min_stat ; char buf1 [ GSS_BUFSIZE ] , buf2 [ GSS_BUFSIZE ] ; unsigned long buf_size ; int rc ; if ( ! mutt_bit_isset ( idata -> capabilities , AGSSAPI ) ) return IMAP_AUTH_UNAVAIL ; if ( mutt_account_getuser ( & idata -> conn -> account ) < 0 ) return IMAP_AUTH_FAILURE ; snprintf ( buf1 , sizeof ( buf1 ) , "imap@%s" , idata -> conn -> account . host ) ; request_buf . value = buf1 ; request_buf . length = strlen ( buf1 ) ; maj_stat = gss_import_name ( & min_stat , & request_buf , gss_nt_service_name , & target_name ) ; if ( maj_stat != GSS_S_COMPLETE ) { mutt_debug ( 2 , "Couldn't get service name for [%s]\n" , buf1 ) ; return IMAP_AUTH_UNAVAIL ; } else if ( DebugLevel >= 2 ) { gss_display_name ( & min_stat , target_name , & request_buf , & mech_name ) ; mutt_debug ( 2 , "Using service name [%s]\n" , ( char * ) request_buf . value ) ; gss_release_buffer ( & min_stat , & request_buf ) ; } sec_token = GSS_C_NO_BUFFER ; context = GSS_C_NO_CONTEXT ; maj_stat = gss_init_sec_context ( & min_stat , GSS_C_NO_CREDENTIAL , & context , target_name , GSS_C_NO_OID , GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG , 0 , GSS_C_NO_CHANNEL_BINDINGS , sec_token , NULL , & send_token , ( unsigned int * ) & cflags , NULL ) ; if ( maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED ) { print_gss_error ( maj_stat , min_stat ) ; mutt_debug ( 1 , "Error acquiring credentials - no TGT?\n" ) ; gss_release_name ( & min_stat , & target_name ) ; return IMAP_AUTH_UNAVAIL ; } mutt_message ( _ ( "Authenticating (GSSAPI)..." ) ) ; imap_cmd_start ( idata , "AUTHENTICATE GSSAPI" ) ; do rc = imap_cmd_step ( idata ) ; while ( rc == IMAP_CMD_CONTINUE ) ; if ( rc != IMAP_CMD_RESPOND ) { mutt_debug ( 2 , "Invalid response from server: %s\n" , buf1 ) ; gss_release_name ( & min_stat , & target_name ) ; goto bail ; } mutt_debug ( 2 , "Sending credentials\n" ) ; mutt_b64_encode ( buf1 , send_token . value , send_token . length , sizeof ( buf1 ) - 2 ) ; gss_release_buffer ( & min_stat , & send_token ) ; mutt_str_strcat ( buf1 , sizeof ( buf1 ) , "\r\n" ) ; mutt_socket_send ( idata -> conn , buf1 ) ; while ( maj_stat == GSS_S_CONTINUE_NEEDED ) { do rc = imap_cmd_step ( idata ) ; while ( rc == IMAP_CMD_CONTINUE ) ; if ( rc != IMAP_CMD_RESPOND ) { mutt_debug ( 1 , "#1 Error receiving server response.\n" ) ; gss_release_name ( & min_stat , & target_name ) ; goto bail ; } request_buf . length = mutt_b64_decode ( buf2 , idata -> buf + 2 , sizeof ( buf2 ) ) ; request_buf . value = buf2 ; sec_token = & request_buf ; maj_stat = gss_init_sec_context ( & min_stat , GSS_C_NO_CREDENTIAL , & context , target_name , GSS_C_NO_OID , GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG , 0 , GSS_C_NO_CHANNEL_BINDINGS , sec_token , NULL , & send_token , ( unsigned int * ) & cflags , NULL ) ; if ( maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED ) { print_gss_error ( maj_stat , min_stat ) ; mutt_debug ( 1 , "Error exchanging credentials\n" ) ; gss_release_name ( & min_stat , & target_name ) ; goto err_abort_cmd ; } mutt_b64_encode ( buf1 , send_token . value , send_token . length , sizeof ( buf1 ) - 2 ) ; gss_release_buffer ( & min_stat , & send_token ) ; mutt_str_strcat ( buf1 , sizeof ( buf1 ) , "\r\n" ) ; mutt_socket_send ( idata -> conn , buf1 ) ; } gss_release_name ( & min_stat , & target_name ) ; do rc = imap_cmd_step ( idata ) ; while ( rc == IMAP_CMD_CONTINUE ) ; if ( rc != IMAP_CMD_RESPOND ) { mutt_debug ( 1 , "#2 Error receiving server response.\n" ) ; goto bail ; } request_buf . length = mutt_b64_decode ( buf2 , idata -> buf + 2 , sizeof ( buf2 ) ) ; request_buf . value = buf2 ; maj_stat = gss_unwrap ( & min_stat , context , & request_buf , & send_token , & cflags , & quality ) ; if ( maj_stat != GSS_S_COMPLETE ) { print_gss_error ( maj_stat , min_stat ) ; mutt_debug ( 2 , "Couldn't unwrap security level data\n" ) ; gss_release_buffer ( & min_stat , & send_token ) ; goto err_abort_cmd ; } mutt_debug ( 2 , "Credential exchange complete\n" ) ; server_conf_flags = ( ( char * ) send_token . value ) [ 0 ] ; if ( ! ( ( ( char * ) send_token . value ) [ 0 ] & GSS_AUTH_P_NONE ) ) { mutt_debug ( 2 , "Server requires integrity or privacy\n" ) ; gss_release_buffer ( & min_stat , & send_token ) ; goto err_abort_cmd ; } ( ( char * ) send_token . value ) [ 0 ] = '\0' ; buf_size = ntohl ( * ( ( long * ) send_token . value ) ) ; gss_release_buffer ( & min_stat , & send_token ) ; mutt_debug ( 2 , "Unwrapped security level flags: %c%c%c\n" , ( server_conf_flags & GSS_AUTH_P_NONE ) ? 'N' : '-' , ( server_conf_flags & GSS_AUTH_P_INTEGRITY ) ? 'I' : '-' , ( server_conf_flags & GSS_AUTH_P_PRIVACY ) ? 'P' : '-' ) ; mutt_debug ( 2 , "Maximum GSS token size is %ld\n" , buf_size ) ; buf_size = htonl ( buf_size ) ; memcpy ( buf1 , & buf_size , 4 ) ; buf1 [ 0 ] = GSS_AUTH_P_NONE ; strncpy ( buf1 + 4 , idata -> conn -> account . user , sizeof ( buf1 ) - 4 ) ; request_buf . value = buf1 ; request_buf . length = 4 + strlen ( idata -> conn -> account . user ) ; maj_stat = gss_wrap ( & min_stat , context , 0 , GSS_C_QOP_DEFAULT , & request_buf , & cflags , & send_token ) ; if ( maj_stat != GSS_S_COMPLETE ) { mutt_debug ( 2 , "Error creating login request\n" ) ; goto err_abort_cmd ; } mutt_b64_encode ( buf1 , send_token . value , send_token . length , sizeof ( buf1 ) - 2 ) ; mutt_debug ( 2 , "Requesting authorisation as %s\n" , idata -> conn -> account . user ) ; mutt_str_strcat ( buf1 , sizeof ( buf1 ) , "\r\n" ) ; mutt_socket_send ( idata -> conn , buf1 ) ; do rc = imap_cmd_step ( idata ) ; while ( rc == IMAP_CMD_CONTINUE ) ; if ( rc == IMAP_CMD_RESPOND ) { mutt_debug ( 1 , "Unexpected server continuation request.\n" ) ; goto err_abort_cmd ; } if ( imap_code ( idata -> buf ) ) { mutt_debug ( 2 , "Releasing GSS credentials\n" ) ; maj_stat = gss_delete_sec_context ( & min_stat , & context , & send_token ) ; if ( maj_stat != GSS_S_COMPLETE ) mutt_debug ( 1 , "Error releasing credentials\n" ) ; gss_release_buffer ( & min_stat , & send_token ) ; return IMAP_AUTH_SUCCESS ; } else goto bail ; err_abort_cmd : mutt_socket_send ( idata -> conn , "*\r\n" ) ; do rc = imap_cmd_step ( idata ) ; while ( rc == IMAP_CMD_CONTINUE ) ; bail : mutt_error ( _ ( "GSSAPI authentication failed." ) ) ; return IMAP_AUTH_FAILURE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_NOTIFY_INFO ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) { guint32 count ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_notify_info_version , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_notify_info_flags , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_notify_info_count , & count ) ; if ( ! di -> conformant_run ) col_append_fstr ( pinfo -> cinfo , COL_INFO , ", %d %s" , count , notify_plural ( count ) ) ; offset = dissect_ndr_ucarray ( tvb , offset , pinfo , tree , di , drep , dissect_NOTIFY_INFO_DATA ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void set_num_721 ( unsigned char * p , uint16_t value ) { archive_le16enc ( p , value ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void usb_xhci_init ( XHCIState * xhci ) { DeviceState * dev = DEVICE ( xhci ) ; XHCIPort * port ; int i , usbports , speedmask ; xhci -> usbsts = USBSTS_HCH ; if ( xhci -> numports_2 > MAXPORTS_2 ) { xhci -> numports_2 = MAXPORTS_2 ; } if ( xhci -> numports_3 > MAXPORTS_3 ) { xhci -> numports_3 = MAXPORTS_3 ; } usbports = MAX ( xhci -> numports_2 , xhci -> numports_3 ) ; xhci -> numports = xhci -> numports_2 + xhci -> numports_3 ; usb_bus_new ( & xhci -> bus , sizeof ( xhci -> bus ) , & xhci_bus_ops , dev ) ; for ( i = 0 ; i < usbports ; i ++ ) { speedmask = 0 ; if ( i < xhci -> numports_2 ) { if ( xhci_get_flag ( xhci , XHCI_FLAG_SS_FIRST ) ) { port = & xhci -> ports [ i + xhci -> numports_3 ] ; port -> portnr = i + 1 + xhci -> numports_3 ; } else { port = & xhci -> ports [ i ] ; port -> portnr = i + 1 ; } port -> uport = & xhci -> uports [ i ] ; port -> speedmask = USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL | USB_SPEED_MASK_HIGH ; snprintf ( port -> name , sizeof ( port -> name ) , "usb2 port #%d" , i + 1 ) ; speedmask |= port -> speedmask ; } if ( i < xhci -> numports_3 ) { if ( xhci_get_flag ( xhci , XHCI_FLAG_SS_FIRST ) ) { port = & xhci -> ports [ i ] ; port -> portnr = i + 1 ; } else { port = & xhci -> ports [ i + xhci -> numports_2 ] ; port -> portnr = i + 1 + xhci -> numports_2 ; } port -> uport = & xhci -> uports [ i ] ; port -> speedmask = USB_SPEED_MASK_SUPER ; snprintf ( port -> name , sizeof ( port -> name ) , "usb3 port #%d" , i + 1 ) ; speedmask |= port -> speedmask ; } usb_register_port ( & xhci -> bus , & xhci -> uports [ i ] , xhci , i , & xhci_uport_ops , speedmask ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int TSHttpTxnLookingUpTypeGet ( TSHttpTxn txnp ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; HttpSM * sm = ( HttpSM * ) txnp ; HttpTransact : : State * s = & ( sm -> t_state ) ; return ( int ) ( s -> current . request_to ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Dwarf_Small dwarf_elf_object_access_get_pointer_size ( void * obj_in ) { dwarf_elf_object_access_internals_t * obj = ( dwarf_elf_object_access_internals_t * ) obj_in ; return obj -> pointer_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int tipc_nl_compat_doit ( struct tipc_nl_compat_cmd_doit * cmd , struct tipc_nl_compat_msg * msg ) { int err ; if ( msg -> req_type && ! TLV_CHECK_TYPE ( msg -> req , msg -> req_type ) ) return - EINVAL ; err = __tipc_nl_compat_doit ( cmd , msg ) ; if ( err ) return err ; msg -> rep = tipc_tlv_alloc ( 0 ) ; if ( ! msg -> rep ) return - ENOMEM ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline int client_to_server ( packet_info * pinfo ) { return pinfo -> destport == PCP_PORT || pinfo -> destport == PMPROXY_PORT ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int xsltCheckWrite ( xsltSecurityPrefsPtr sec , xsltTransformContextPtr ctxt , const xmlChar * URL ) { int ret ; xmlURIPtr uri ; xsltSecurityCheck check ; uri = xmlParseURI ( ( const char * ) URL ) ; if ( uri == NULL ) { uri = xmlCreateURI ( ) ; if ( uri == NULL ) { xsltTransformError ( ctxt , NULL , NULL , "xsltCheckWrite: out of memory for %s\n" , URL ) ; return ( - 1 ) ; } uri -> path = ( char * ) xmlStrdup ( URL ) ; } if ( ( uri -> scheme == NULL ) || ( xmlStrEqual ( BAD_CAST uri -> scheme , BAD_CAST "file" ) ) ) { # if defined ( WIN32 ) && ! defined ( __CYGWIN__ ) if ( ( uri -> path ) && ( uri -> path [ 0 ] == '/' ) && ( uri -> path [ 1 ] != '\0' ) && ( uri -> path [ 2 ] == ':' ) ) ret = xsltCheckWritePath ( sec , ctxt , uri -> path + 1 ) ; else # endif ret = xsltCheckWritePath ( sec , ctxt , uri -> path ) ; if ( ret <= 0 ) { xmlFreeURI ( uri ) ; return ( ret ) ; } } else { check = xsltGetSecurityPrefs ( sec , XSLT_SECPREF_WRITE_NETWORK ) ; if ( check != NULL ) { ret = check ( sec , ctxt , ( const char * ) URL ) ; if ( ret == 0 ) { xsltTransformError ( ctxt , NULL , NULL , "File write for %s refused\n" , URL ) ; xmlFreeURI ( uri ) ; return ( 0 ) ; } } } xmlFreeURI ( uri ) ; return ( 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_mediaControlChannel ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 914 "../../asn1/h245/h245.cnf" if ( upcoming_channel ) upcoming_channel -> upcoming_addr = & upcoming_channel -> media_control_addr ; offset = dissect_h245_TransportAddress ( tvb , offset , actx , tree , hf_index ) ; # line 918 "../../asn1/h245/h245.cnf" if ( upcoming_channel ) upcoming_channel -> upcoming_addr = NULL ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void mpeg_decode_sequence_extension ( Mpeg1Context * s1 ) { MpegEncContext * s = & s1 -> mpeg_enc_ctx ; int horiz_size_ext , vert_size_ext ; int bit_rate_ext ; skip_bits ( & s -> gb , 1 ) ; s -> avctx -> profile = get_bits ( & s -> gb , 3 ) ; s -> avctx -> level = get_bits ( & s -> gb , 4 ) ; s -> progressive_sequence = get_bits1 ( & s -> gb ) ; s -> chroma_format = get_bits ( & s -> gb , 2 ) ; horiz_size_ext = get_bits ( & s -> gb , 2 ) ; vert_size_ext = get_bits ( & s -> gb , 2 ) ; s -> width |= ( horiz_size_ext << 12 ) ; s -> height |= ( vert_size_ext << 12 ) ; bit_rate_ext = get_bits ( & s -> gb , 12 ) ; s -> bit_rate += ( bit_rate_ext << 18 ) * 400 ; skip_bits1 ( & s -> gb ) ; s -> avctx -> rc_buffer_size += get_bits ( & s -> gb , 8 ) * 1024 * 16 << 10 ; s -> low_delay = get_bits1 ( & s -> gb ) ; if ( s -> flags & CODEC_FLAG_LOW_DELAY ) s -> low_delay = 1 ; s1 -> frame_rate_ext . num = get_bits ( & s -> gb , 2 ) + 1 ; s1 -> frame_rate_ext . den = get_bits ( & s -> gb , 5 ) + 1 ; av_dlog ( s -> avctx , "sequence extension\n" ) ; s -> codec_id = s -> avctx -> codec_id = AV_CODEC_ID_MPEG2VIDEO ; if ( s -> avctx -> debug & FF_DEBUG_PICT_INFO ) av_log ( s -> avctx , AV_LOG_DEBUG , "profile: %d, level: %d vbv buffer: %d, bitrate:%d\n" , s -> avctx -> profile , s -> avctx -> level , s -> avctx -> rc_buffer_size , s -> bit_rate ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
gboolean logcat_text_brief_dump_open ( wtap_dumper * wdh , int * err _U_ ) { struct dumper_t * dumper ; dumper = ( struct dumper_t * ) g_malloc ( sizeof ( struct dumper_t ) ) ; dumper -> type = DUMP_BRIEF ; wdh -> priv = dumper ; wdh -> subtype_write = logcat_dump_text ; wdh -> subtype_close = NULL ; return TRUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Datum ExecEvalNullTest ( NullTestState * nstate , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) { NullTest * ntest = ( NullTest * ) nstate -> xprstate . expr ; Datum result ; result = ExecEvalExpr ( nstate -> arg , econtext , isNull , isDone ) ; if ( isDone && * isDone == ExprEndResult ) return result ; if ( ntest -> argisrow && ! ( * isNull ) ) { HeapTupleHeader tuple ; Oid tupType ; int32 tupTypmod ; TupleDesc tupDesc ; HeapTupleData tmptup ; int att ; tuple = DatumGetHeapTupleHeader ( result ) ; tupType = HeapTupleHeaderGetTypeId ( tuple ) ; tupTypmod = HeapTupleHeaderGetTypMod ( tuple ) ; tupDesc = get_cached_rowtype ( tupType , tupTypmod , & nstate -> argdesc , econtext ) ; tmptup . t_len = HeapTupleHeaderGetDatumLength ( tuple ) ; tmptup . t_data = tuple ; for ( att = 1 ; att <= tupDesc -> natts ; att ++ ) { if ( tupDesc -> attrs [ att - 1 ] -> attisdropped ) continue ; if ( heap_attisnull ( & tmptup , att ) ) { if ( ntest -> nulltesttype == IS_NOT_NULL ) return BoolGetDatum ( false ) ; } else { if ( ntest -> nulltesttype == IS_NULL ) return BoolGetDatum ( false ) ; } } return BoolGetDatum ( true ) ; } else { switch ( ntest -> nulltesttype ) { case IS_NULL : if ( * isNull ) { * isNull = false ; return BoolGetDatum ( true ) ; } else return BoolGetDatum ( false ) ; case IS_NOT_NULL : if ( * isNull ) { * isNull = false ; return BoolGetDatum ( false ) ; } else return BoolGetDatum ( true ) ; default : elog ( ERROR , "unrecognized nulltesttype: %d" , ( int ) ntest -> nulltesttype ) ; return ( Datum ) 0 ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
bool mysql_revoke_all ( THD * thd , List < LEX_USER > & list ) { uint counter , revoked , is_proc ; int result ; ACL_DB * acl_db ; TABLE_LIST tables [ GRANT_TABLES ] ; bool save_binlog_row_based ; DBUG_ENTER ( "mysql_revoke_all" ) ; save_binlog_row_based = thd -> current_stmt_binlog_row_based ; thd -> clear_current_stmt_binlog_row_based ( ) ; if ( ( result = open_grant_tables ( thd , tables ) ) ) { thd -> current_stmt_binlog_row_based = save_binlog_row_based ; DBUG_RETURN ( result != 1 ) ; } rw_wrlock ( & LOCK_grant ) ; VOID ( pthread_mutex_lock ( & acl_cache -> lock ) ) ; LEX_USER * lex_user , * tmp_lex_user ; List_iterator < LEX_USER > user_list ( list ) ; while ( ( tmp_lex_user = user_list ++ ) ) { if ( ! ( lex_user = get_current_user ( thd , tmp_lex_user ) ) ) { result = - 1 ; continue ; } if ( ! find_acl_user ( lex_user -> host . str , lex_user -> user . str , TRUE ) ) { result = - 1 ; continue ; } if ( replace_user_table ( thd , tables [ 0 ] . table , * lex_user , ~ ( ulong ) 0 , 1 , 0 , 0 ) ) { result = - 1 ; continue ; } do { for ( counter = 0 , revoked = 0 ; counter < acl_dbs . elements ; ) { const char * user , * host ; acl_db = dynamic_element ( & acl_dbs , counter , ACL_DB * ) ; if ( ! ( user = acl_db -> user ) ) user = "" ; if ( ! ( host = acl_db -> host . hostname ) ) host = "" ; if ( ! strcmp ( lex_user -> user . str , user ) && ! strcmp ( lex_user -> host . str , host ) ) { if ( ! replace_db_table ( tables [ 1 ] . table , acl_db -> db , * lex_user , ~ ( ulong ) 0 , 1 ) ) { revoked = 1 ; continue ; } result = - 1 ; } counter ++ ; } } while ( revoked ) ; do { for ( counter = 0 , revoked = 0 ; counter < column_priv_hash . records ; ) { const char * user , * host ; GRANT_TABLE * grant_table = ( GRANT_TABLE * ) hash_element ( & column_priv_hash , counter ) ; if ( ! ( user = grant_table -> user ) ) user = "" ; if ( ! ( host = grant_table -> host . hostname ) ) host = "" ; if ( ! strcmp ( lex_user -> user . str , user ) && ! strcmp ( lex_user -> host . str , host ) ) { if ( replace_table_table ( thd , grant_table , tables [ 2 ] . table , * lex_user , grant_table -> db , grant_table -> tname , ~ ( ulong ) 0 , 0 , 1 ) ) { result = - 1 ; } else { if ( ! grant_table -> cols ) { revoked = 1 ; continue ; } List < LEX_COLUMN > columns ; if ( ! replace_column_table ( grant_table , tables [ 3 ] . table , * lex_user , columns , grant_table -> db , grant_table -> tname , ~ ( ulong ) 0 , 1 ) ) { revoked = 1 ; continue ; } result = - 1 ; } } counter ++ ; } } while ( revoked ) ; for ( is_proc = 0 ; is_proc < 2 ; is_proc ++ ) do { HASH * hash = is_proc ? & proc_priv_hash : & func_priv_hash ; for ( counter = 0 , revoked = 0 ; counter < hash -> records ; ) { const char * user , * host ; GRANT_NAME * grant_proc = ( GRANT_NAME * ) hash_element ( hash , counter ) ; if ( ! ( user = grant_proc -> user ) ) user = "" ; if ( ! ( host = grant_proc -> host . hostname ) ) host = "" ; if ( ! strcmp ( lex_user -> user . str , user ) && ! strcmp ( lex_user -> host . str , host ) ) { if ( replace_routine_table ( thd , grant_proc , tables [ 4 ] . table , * lex_user , grant_proc -> db , grant_proc -> tname , is_proc , ~ ( ulong ) 0 , 1 ) == 0 ) { revoked = 1 ; continue ; } result = - 1 ; } counter ++ ; } } while ( revoked ) ; } VOID ( pthread_mutex_unlock ( & acl_cache -> lock ) ) ; if ( result ) my_message ( ER_REVOKE_GRANTS , ER ( ER_REVOKE_GRANTS ) , MYF ( 0 ) ) ; result = result | write_bin_log ( thd , FALSE , thd -> query ( ) , thd -> query_length ( ) ) ; rw_unlock ( & LOCK_grant ) ; close_thread_tables ( thd ) ; thd -> current_stmt_binlog_row_based = save_binlog_row_based ; DBUG_RETURN ( result ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void xhci_set_ep_state ( XHCIState * xhci , XHCIEPContext * epctx , XHCIStreamContext * sctx , uint32_t state ) { XHCIRing * ring = NULL ; uint32_t ctx [ 5 ] ; uint32_t ctx2 [ 2 ] ; xhci_dma_read_u32s ( xhci , epctx -> pctx , ctx , sizeof ( ctx ) ) ; ctx [ 0 ] &= ~ EP_STATE_MASK ; ctx [ 0 ] |= state ; if ( epctx -> nr_pstreams ) { if ( sctx != NULL ) { ring = & sctx -> ring ; xhci_dma_read_u32s ( xhci , sctx -> pctx , ctx2 , sizeof ( ctx2 ) ) ; ctx2 [ 0 ] &= 0xe ; ctx2 [ 0 ] |= sctx -> ring . dequeue | sctx -> ring . ccs ; ctx2 [ 1 ] = ( sctx -> ring . dequeue >> 16 ) >> 16 ; xhci_dma_write_u32s ( xhci , sctx -> pctx , ctx2 , sizeof ( ctx2 ) ) ; } } else { ring = & epctx -> ring ; } if ( ring ) { ctx [ 2 ] = ring -> dequeue | ring -> ccs ; ctx [ 3 ] = ( ring -> dequeue >> 16 ) >> 16 ; DPRINTF ( "xhci: set epctx: " DMA_ADDR_FMT " state=%d dequeue=%08x%08x\n" , epctx -> pctx , state , ctx [ 3 ] , ctx [ 2 ] ) ; } xhci_dma_write_u32s ( xhci , epctx -> pctx , ctx , sizeof ( ctx ) ) ; if ( epctx -> state != state ) { trace_usb_xhci_ep_state ( epctx -> slotid , epctx -> epid , ep_state_name ( epctx -> state ) , ep_state_name ( state ) ) ; } epctx -> state = state ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void http_basic_test ( void ) { struct timeval tv ; struct bufferevent * bev ; int fd ; const char * http_request ; short port = - 1 ; test_ok = 0 ; fprintf ( stdout , "Testing Basic HTTP Server: " ) ; http = http_setup ( & port , NULL ) ; if ( evhttp_bind_socket ( http , "127.0.0.1" , port + 1 ) == - 1 ) { fprintf ( stdout , "FAILED (bind)\n" ) ; exit ( 1 ) ; } fd = http_connect ( "127.0.0.1" , port ) ; bev = bufferevent_new ( fd , http_readcb , http_writecb , http_errorcb , NULL ) ; http_request = "GET /test HTTP/1.1\r\n" "Host: some" ; bufferevent_write ( bev , http_request , strlen ( http_request ) ) ; timerclear ( & tv ) ; tv . tv_usec = 10000 ; event_once ( - 1 , EV_TIMEOUT , http_complete_write , bev , & tv ) ; event_dispatch ( ) ; if ( test_ok != 3 ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } bufferevent_free ( bev ) ; EVUTIL_CLOSESOCKET ( fd ) ; fd = http_connect ( "127.0.0.1" , port + 1 ) ; bev = bufferevent_new ( fd , http_readcb , http_writecb , http_errorcb , NULL ) ; http_request = "GET /test HTTP/1.1\r\n" "Host: somehost\r\n" "Connection: close\r\n" "\r\n" ; bufferevent_write ( bev , http_request , strlen ( http_request ) ) ; event_dispatch ( ) ; bufferevent_free ( bev ) ; EVUTIL_CLOSESOCKET ( fd ) ; evhttp_free ( http ) ; if ( test_ok != 5 ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } fprintf ( stdout , "OK\n" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void init_re ( void ) { const char * ps_re_str = "^(" "[[:space:]]*REPLACE[[:space:]]|" "[[:space:]]*INSERT[[:space:]]|" "[[:space:]]*UPDATE[[:space:]]|" "[[:space:]]*DELETE[[:space:]]|" "[[:space:]]*SELECT[[:space:]]|" "[[:space:]]*CREATE[[:space:]]+TABLE[[:space:]]|" "[[:space:]]*DO[[:space:]]|" "[[:space:]]*SET[[:space:]]+OPTION[[:space:]]|" "[[:space:]]*DELETE[[:space:]]+MULTI[[:space:]]|" "[[:space:]]*UPDATE[[:space:]]+MULTI[[:space:]]|" "[[:space:]]*INSERT[[:space:]]+SELECT[[:space:]])" ; const char * sp_re_str = ps_re_str ; const char * view_re_str = "^(" "[[:space:]]*SELECT[[:space:]])" ; init_re_comp ( & ps_re , ps_re_str ) ; init_re_comp ( & sp_re , sp_re_str ) ; init_re_comp ( & view_re , view_re_str ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _slurm_rpc_update_block ( slurm_msg_t * msg ) { int error_code = SLURM_SUCCESS ; DEF_TIMERS ; update_block_msg_t * block_desc_ptr = ( update_block_msg_t * ) msg -> data ; uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ; char * name = NULL ; START_TIMER ; debug2 ( "Processing RPC: REQUEST_UPDATE_BLOCK from uid=%d" , uid ) ; if ( ! validate_super_user ( uid ) ) { error_code = ESLURM_USER_ID_MISSING ; error ( "Security violation, UPDATE_BLOCK RPC from uid=%d" , uid ) ; if ( block_desc_ptr -> bg_block_id ) { name = block_desc_ptr -> bg_block_id ; } else if ( block_desc_ptr -> mp_str ) { name = block_desc_ptr -> mp_str ; } } if ( error_code == SLURM_SUCCESS ) { if ( block_desc_ptr -> bg_block_id ) { error_code = select_g_update_block ( block_desc_ptr ) ; END_TIMER2 ( "_slurm_rpc_update_block" ) ; name = block_desc_ptr -> bg_block_id ; } else if ( block_desc_ptr -> mp_str ) { error_code = select_g_update_sub_node ( block_desc_ptr ) ; END_TIMER2 ( "_slurm_rpc_update_subbp" ) ; name = block_desc_ptr -> mp_str ; } else { error ( "Unknown update for blocks" ) ; error_code = SLURM_ERROR ; END_TIMER2 ( "_slurm_rpc_update_block" ) ; } } if ( error_code ) { info ( "_slurm_rpc_update_block %s: %s" , name , slurm_strerror ( error_code ) ) ; slurm_send_rc_msg ( msg , error_code ) ; } else { debug2 ( "_slurm_rpc_update_block complete for %s %s" , name , TIME_STR ) ; slurm_send_rc_msg ( msg , SLURM_SUCCESS ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int32_t getRunFromLogicalIndex ( UBiDi * pBiDi , int32_t logicalIndex , UErrorCode * pErrorCode ) { Run * runs = pBiDi -> runs ; int32_t runCount = pBiDi -> runCount , visualStart = 0 , i , length , logicalStart ; for ( i = 0 ; i < runCount ; i ++ ) { length = runs [ i ] . visualLimit - visualStart ; logicalStart = GET_INDEX ( runs [ i ] . logicalStart ) ; if ( ( logicalIndex >= logicalStart ) && ( logicalIndex < ( logicalStart + length ) ) ) { return i ; } visualStart += length ; } U_ASSERT ( FALSE ) ; * pErrorCode = U_INVALID_STATE_ERROR ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONLoadSnapshot ( qemuMonitorPtr mon , const char * name ) { int ret ; virJSONValuePtr cmd ; virJSONValuePtr reply = NULL ; cmd = qemuMonitorJSONMakeCommand ( "loadvm" , "s:name" , name , NULL ) ; if ( ! cmd ) return - 1 ; if ( ( ret = qemuMonitorJSONCommand ( mon , cmd , & reply ) ) < 0 ) goto cleanup ; if ( qemuMonitorJSONHasError ( reply , "CommandNotFound" ) && qemuMonitorCheckHMP ( mon , "loadvm" ) ) { VIR_DEBUG ( "loadvm command not found, trying HMP" ) ; ret = qemuMonitorTextLoadSnapshot ( mon , name ) ; goto cleanup ; } ret = qemuMonitorJSONCheckError ( cmd , reply ) ; cleanup : virJSONValueFree ( cmd ) ; virJSONValueFree ( reply ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void handle_new_lock_ctx ( struct xml_ctx * ctx , int tag_closed ) { struct remote_lock * lock = ( struct remote_lock * ) ctx -> userData ; git_SHA_CTX sha_ctx ; unsigned char lock_token_sha1 [ 20 ] ; if ( tag_closed && ctx -> cdata ) { if ( ! strcmp ( ctx -> name , DAV_ACTIVELOCK_OWNER ) ) { lock -> owner = xstrdup ( ctx -> cdata ) ; } else if ( ! strcmp ( ctx -> name , DAV_ACTIVELOCK_TIMEOUT ) ) { const char * arg ; if ( skip_prefix ( ctx -> cdata , "Second-" , & arg ) ) lock -> timeout = strtol ( arg , NULL , 10 ) ; } else if ( ! strcmp ( ctx -> name , DAV_ACTIVELOCK_TOKEN ) ) { lock -> token = xstrdup ( ctx -> cdata ) ; git_SHA1_Init ( & sha_ctx ) ; git_SHA1_Update ( & sha_ctx , lock -> token , strlen ( lock -> token ) ) ; git_SHA1_Final ( lock_token_sha1 , & sha_ctx ) ; lock -> tmpfile_suffix [ 0 ] = '_' ; memcpy ( lock -> tmpfile_suffix + 1 , sha1_to_hex ( lock_token_sha1 ) , 40 ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void NextCh ( cmsIT8 * it8 ) { if ( it8 -> FileStack [ it8 -> IncludeSP ] -> Stream ) { it8 -> ch = fgetc ( it8 -> FileStack [ it8 -> IncludeSP ] -> Stream ) ; if ( feof ( it8 -> FileStack [ it8 -> IncludeSP ] -> Stream ) ) { if ( it8 -> IncludeSP > 0 ) { fclose ( it8 -> FileStack [ it8 -> IncludeSP -- ] -> Stream ) ; it8 -> ch = ' ' ; } else it8 -> ch = 0 ; } } else { it8 -> ch = * it8 -> Source ; if ( it8 -> ch ) it8 -> Source ++ ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
extern int as_mysql_get_fed_cluster_id ( mysql_conn_t * mysql_conn , const char * cluster , const char * federation , int last_id , int * ret_id ) { int id = 1 ; char * query = NULL ; MYSQL_ROW row ; MYSQL_RES * result = NULL ; xassert ( cluster ) ; xassert ( federation ) ; xassert ( ret_id ) ; xstrfmtcat ( query , "SELECT name, fed_id " "FROM %s " "WHERE deleted=0 AND name='%s' AND federation='%s'; " , cluster_table , cluster , federation ) ; if ( debug_flags & DEBUG_FLAG_FEDR ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ; if ( ! ( result = mysql_db_query_ret ( mysql_conn , query , 0 ) ) ) { xfree ( query ) ; error ( "no result given for %s" , query ) ; return SLURM_ERROR ; } xfree ( query ) ; while ( ( row = mysql_fetch_row ( result ) ) ) { int tmp_id = slurm_atoul ( row [ 1 ] ) ; if ( debug_flags & DEBUG_FLAG_FEDR ) info ( "cluster '%s' already part of federation '%s', " "using existing id %d" , cluster , federation , tmp_id ) ; mysql_free_result ( result ) ; * ret_id = tmp_id ; return SLURM_SUCCESS ; } mysql_free_result ( result ) ; xstrfmtcat ( query , "SELECT name, federation, fed_id " "FROM %s " "WHERE name!='%s' AND federation='%s' " "AND fed_id > %d AND deleted=0 ORDER BY fed_id; " , cluster_table , cluster , federation , last_id ) ; if ( debug_flags & DEBUG_FLAG_FEDR ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ; if ( ! ( result = mysql_db_query_ret ( mysql_conn , query , 0 ) ) ) { xfree ( query ) ; error ( "no result given for %s" , query ) ; return SLURM_ERROR ; } xfree ( query ) ; if ( last_id >= id ) id = last_id + 1 ; while ( ( row = mysql_fetch_row ( result ) ) ) { if ( id != slurm_atoul ( row [ 2 ] ) ) break ; id ++ ; } mysql_free_result ( result ) ; if ( id > MAX_FED_CLUSTERS ) { error ( "Too many clusters in this federation." ) ; errno = ESLURM_FED_CLUSTER_MAX_CNT ; return ESLURM_FED_CLUSTER_MAX_CNT ; } * ret_id = id ; return SLURM_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool parse_certificate ( private_x509_cert_t * this ) { asn1_parser_t * parser ; chunk_t object ; int objectID ; int extn_oid = OID_UNKNOWN ; int sig_alg = OID_UNKNOWN ; bool success = FALSE ; bool critical = FALSE ; parser = asn1_parser_create ( certObjects , this -> encoding ) ; while ( parser -> iterate ( parser , & objectID , & object ) ) { u_int level = parser -> get_level ( parser ) + 1 ; switch ( objectID ) { case X509_OBJ_TBS_CERTIFICATE : this -> tbsCertificate = object ; break ; case X509_OBJ_VERSION : this -> version = ( object . len ) ? ( 1 + ( u_int ) * object . ptr ) : 1 ; if ( this -> version < 1 || this -> version > 3 ) { DBG1 ( DBG_ASN , "X.509v%d not supported" , this -> version ) ; goto end ; } else { DBG2 ( DBG_ASN , " X.509v%d" , this -> version ) ; } break ; case X509_OBJ_SERIAL_NUMBER : this -> serialNumber = object ; break ; case X509_OBJ_SIG_ALG : sig_alg = asn1_parse_algorithmIdentifier ( object , level , NULL ) ; break ; case X509_OBJ_ISSUER : this -> issuer = identification_create_from_encoding ( ID_DER_ASN1_DN , object ) ; DBG2 ( DBG_ASN , " '%Y'" , this -> issuer ) ; break ; case X509_OBJ_NOT_BEFORE : this -> notBefore = asn1_parse_time ( object , level ) ; break ; case X509_OBJ_NOT_AFTER : this -> notAfter = asn1_parse_time ( object , level ) ; break ; case X509_OBJ_SUBJECT : this -> subject = identification_create_from_encoding ( ID_DER_ASN1_DN , object ) ; DBG2 ( DBG_ASN , " '%Y'" , this -> subject ) ; break ; case X509_OBJ_SUBJECT_PUBLIC_KEY_INFO : DBG2 ( DBG_ASN , "-- > --" ) ; this -> public_key = lib -> creds -> create ( lib -> creds , CRED_PUBLIC_KEY , KEY_ANY , BUILD_BLOB_ASN1_DER , object , BUILD_END ) ; DBG2 ( DBG_ASN , "-- < --" ) ; if ( this -> public_key == NULL ) { goto end ; } break ; case X509_OBJ_OPTIONAL_EXTENSIONS : if ( this -> version != 3 ) { DBG1 ( DBG_ASN , "Only X.509v3 certificates have extensions" ) ; goto end ; } break ; case X509_OBJ_EXTN_ID : extn_oid = asn1_known_oid ( object ) ; break ; case X509_OBJ_CRITICAL : critical = object . len && * object . ptr ; DBG2 ( DBG_ASN , " %s" , critical ? "TRUE" : "FALSE" ) ; break ; case X509_OBJ_EXTN_VALUE : { switch ( extn_oid ) { case OID_SUBJECT_KEY_ID : if ( ! asn1_parse_simple_object ( & object , ASN1_OCTET_STRING , level , "keyIdentifier" ) ) { goto end ; } this -> subjectKeyIdentifier = object ; break ; case OID_SUBJECT_ALT_NAME : if ( ! x509_parse_generalNames ( object , level , FALSE , this -> subjectAltNames ) ) { goto end ; } break ; case OID_BASIC_CONSTRAINTS : if ( ! parse_basicConstraints ( object , level , this ) ) { goto end ; } break ; case OID_CRL_DISTRIBUTION_POINTS : if ( ! x509_parse_crlDistributionPoints ( object , level , this -> crl_uris ) ) { goto end ; } break ; case OID_AUTHORITY_KEY_ID : chunk_free ( & this -> authKeyIdentifier ) ; this -> authKeyIdentifier = x509_parse_authorityKeyIdentifier ( object , level , & this -> authKeySerialNumber ) ; break ; case OID_AUTHORITY_INFO_ACCESS : if ( ! parse_authorityInfoAccess ( object , level , this ) ) { goto end ; } break ; case OID_KEY_USAGE : parse_keyUsage ( object , this ) ; break ; case OID_EXTENDED_KEY_USAGE : if ( ! parse_extendedKeyUsage ( object , level , this ) ) { goto end ; } break ; case OID_IP_ADDR_BLOCKS : if ( ! parse_ipAddrBlocks ( object , level , this ) ) { goto end ; } break ; case OID_NAME_CONSTRAINTS : if ( ! parse_nameConstraints ( object , level , this ) ) { goto end ; } break ; case OID_CERTIFICATE_POLICIES : if ( ! parse_certificatePolicies ( object , level , this ) ) { goto end ; } break ; case OID_POLICY_MAPPINGS : if ( ! parse_policyMappings ( object , level , this ) ) { goto end ; } break ; case OID_POLICY_CONSTRAINTS : if ( ! parse_policyConstraints ( object , level , this ) ) { goto end ; } break ; case OID_INHIBIT_ANY_POLICY : if ( ! asn1_parse_simple_object ( & object , ASN1_INTEGER , level , "inhibitAnyPolicy" ) ) { goto end ; } this -> inhibit_any = parse_constraint ( object ) ; break ; case OID_NS_REVOCATION_URL : case OID_NS_CA_REVOCATION_URL : case OID_NS_CA_POLICY_URL : case OID_NS_COMMENT : if ( ! asn1_parse_simple_object ( & object , ASN1_IA5STRING , level , oid_names [ extn_oid ] . name ) ) { goto end ; } break ; default : if ( critical && lib -> settings -> get_bool ( lib -> settings , "%s.x509.enforce_critical" , TRUE , lib -> ns ) ) { DBG1 ( DBG_ASN , "critical '%s' extension not supported" , ( extn_oid == OID_UNKNOWN ) ? "unknown" : ( char * ) oid_names [ extn_oid ] . name ) ; goto end ; } break ; } break ; } case X509_OBJ_ALGORITHM : this -> algorithm = asn1_parse_algorithmIdentifier ( object , level , NULL ) ; if ( this -> algorithm != sig_alg ) { DBG1 ( DBG_ASN , " signature algorithms do not agree" ) ; goto end ; } break ; case X509_OBJ_SIGNATURE : this -> signature = chunk_skip ( object , 1 ) ; break ; default : break ; } } success = parser -> success ( parser ) ; end : parser -> destroy ( parser ) ; if ( success ) { hasher_t * hasher ; if ( this -> public . interface . interface . issued_by ( & this -> public . interface . interface , & this -> public . interface . interface , NULL ) ) { this -> flags |= X509_SELF_SIGNED ; } hasher = lib -> crypto -> create_hasher ( lib -> crypto , HASH_SHA1 ) ; if ( ! hasher || ! hasher -> allocate_hash ( hasher , this -> encoding , & this -> encoding_hash ) ) { DESTROY_IF ( hasher ) ; DBG1 ( DBG_ASN , " unable to create hash of certificate, SHA1 not supported" ) ; return FALSE ; } hasher -> destroy ( hasher ) ; } return success ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
unsigned long # define BN_BYTES 8 # endif # ifdef SIXTY_FOUR_BIT # define BN_ULONG unsigned long long # define BN_BYTES 8 # endif # ifdef THIRTY_TWO_BIT # define BN_ULONG unsigned int # define BN_BYTES 4 # endif # define BN_BITS2 ( BN_BYTES * 8 ) # define BN_BITS ( BN_BITS2 * 2 ) # define BN_TBIT ( ( BN_ULONG ) 1 << ( BN_BITS2 - 1 ) ) # define BN_FLG_MALLOCED 0x01 # define BN_FLG_STATIC_DATA 0x02 # define BN_FLG_CONSTTIME 0x04 # define BN_FLG_SECURE 0x08 # if OPENSSL_API_COMPAT < 0x00908000L # define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME # define BN_FLG_FREE 0x8000 # endif void BN_set_flags ( BIGNUM * b , int n ) ; int BN_get_flags ( const BIGNUM * b , int n ) ; # define BN_RAND_TOP_ANY - 1 # define BN_RAND_TOP_ONE 0 # define BN_RAND_TOP_TWO 1 # define BN_RAND_BOTTOM_ANY 0 # define BN_RAND_BOTTOM_ODD 1 void BN_with_flags ( BIGNUM * dest , const BIGNUM * b , int flags ) ; int BN_GENCB_call ( BN_GENCB * cb , int a , int b ) ; BN_GENCB * BN_GENCB_new ( void ) ; void BN_GENCB_free ( BN_GENCB * cb ) ; void BN_GENCB_set_old ( BN_GENCB * gencb , void ( * callback ) ( int , int , void * ) , void * cb_arg ) ; void BN_GENCB_set ( BN_GENCB * gencb , int ( * callback ) ( int , int , BN_GENCB * ) , void * cb_arg ) ; void * BN_GENCB_get_arg ( BN_GENCB * cb ) ; # define BN_prime_checks 0 # define BN_prime_checks_for_size ( b ) ( ( b ) >= 3747 ? 3 : ( b ) >= 1345 ? 4 : ( b ) >= 476 ? 5 : ( b ) >= 400 ? 6 : ( b ) >= 347 ? 7 : ( b ) >= 308 ? 8 : ( b ) >= 55 ? 27 : 34 ) # define BN_num_bytes ( a ) ( ( BN_num_bits ( a ) + 7 ) / 8 ) int BN_abs_is_word ( const BIGNUM * a , const BN_ULONG w ) ; int BN_is_zero ( const BIGNUM * a ) ; int BN_is_one ( const BIGNUM * a ) ; int BN_is_word ( const BIGNUM * a , const BN_ULONG w ) ; int BN_is_odd ( const BIGNUM * a ) ; # define BN_one ( a ) ( BN_set_word ( ( a ) , 1 ) ) void BN_zero_ex ( BIGNUM * a ) ; # if OPENSSL_API_COMPAT >= 0x00908000L # define BN_zero ( a ) BN_zero_ex ( a ) # else # define BN_zero ( a ) ( BN_set_word ( ( a ) , 0 ) ) # endif const BIGNUM * BN_value_one ( void ) ; char * BN_options ( void ) ; BN_CTX * BN_CTX_new ( void ) ; BN_CTX * BN_CTX_secure_new ( void ) ; void BN_CTX_free ( BN_CTX * c ) ; void BN_CTX_start ( BN_CTX * ctx ) ; BIGNUM * BN_CTX_get ( BN_CTX * ctx ) ; void BN_CTX_end ( BN_CTX * ctx ) ; int BN_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ; int BN_priv_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ; int BN_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ; int BN_priv_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ; int BN_pseudo_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ; int BN_pseudo_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ; int BN_num_bits ( const BIGNUM * a ) ; int BN_num_bits_word ( BN_ULONG l ) ; int BN_security_bits ( int L , int N ) ; BIGNUM * BN_new ( void ) ; BIGNUM * BN_secure_new ( void ) ; void BN_clear_free ( BIGNUM * a ) ; BIGNUM * BN_copy ( BIGNUM * a , const BIGNUM * b ) ; void BN_swap ( BIGNUM * a , BIGNUM * b ) ; BIGNUM * BN_bin2bn ( const unsigned char * s , int len , BIGNUM * ret ) ; int BN_bn2bin ( const BIGNUM * a , unsigned char * to ) ; int BN_bn2binpad ( const BIGNUM * a , unsigned char * to , int tolen ) ; BIGNUM * BN_lebin2bn ( const unsigned char * s , int len , BIGNUM * ret ) ; int BN_bn2lebinpad ( const BIGNUM * a , unsigned char * to , int tolen ) ; BIGNUM * BN_mpi2bn ( const unsigned char * s , int len , BIGNUM * ret ) ; int BN_bn2mpi ( const BIGNUM * a , unsigned char * to ) ; int BN_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_usub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_uadd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ; int BN_sqr ( BIGNUM * r , const BIGNUM * a , BN_CTX * ctx ) ; void BN_set_negative ( BIGNUM * b , int n ) ; int BN_is_negative ( const BIGNUM * b ) ; int BN_div ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ; # define BN_mod ( rem , m , d , ctx ) BN_div ( NULL , ( rem ) , ( m ) , ( d ) , ( ctx ) ) int BN_nnmod ( BIGNUM * r , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ; int BN_mod_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_add_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ; int BN_mod_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_sub_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ; int BN_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_lshift1 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_lshift1_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m ) ; int BN_mod_lshift ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_lshift_quick ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m ) ; BN_ULONG BN_mod_word ( const BIGNUM * a , BN_ULONG w ) ; BN_ULONG BN_div_word ( BIGNUM * a , BN_ULONG w ) ; int BN_mul_word ( BIGNUM * a , BN_ULONG w ) ; int BN_add_word ( BIGNUM * a , BN_ULONG w ) ; int BN_sub_word ( BIGNUM * a , BN_ULONG w ) ; int BN_set_word ( BIGNUM * a , BN_ULONG w ) ; BN_ULONG BN_get_word ( const BIGNUM * a )
1True
Categorize the following code snippet as vulnerable or not. True or False
static void _LMBCSOpen ## n ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err ) \ { _LMBCSOpenWorker ( _this , pArgs , err , n ) ; } static void _LMBCSOpenWorker ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err , ulmbcs_byte_t OptGroup ) { UConverterDataLMBCS * extraInfo = _this -> extraInfo = ( UConverterDataLMBCS * ) uprv_malloc ( sizeof ( UConverterDataLMBCS ) ) ; if ( extraInfo != NULL ) { UConverterNamePieces stackPieces ; UConverterLoadArgs stackArgs = { ( int32_t ) sizeof ( UConverterLoadArgs ) } ; ulmbcs_byte_t i ; uprv_memset ( extraInfo , 0 , sizeof ( UConverterDataLMBCS ) ) ; stackArgs . onlyTestIsLoadable = pArgs -> onlyTestIsLoadable ; for ( i = 0 ; i <= ULMBCS_GRP_LAST && U_SUCCESS ( * err ) ; i ++ ) { if ( OptGroupByteToCPName [ i ] != NULL ) { extraInfo -> OptGrpConverter [ i ] = ucnv_loadSharedData ( OptGroupByteToCPName [ i ] , & stackPieces , & stackArgs , err ) ; } } if ( U_FAILURE ( * err ) || pArgs -> onlyTestIsLoadable ) { _LMBCSClose ( _this ) ; return ; } extraInfo -> OptGroup = OptGroup ; extraInfo -> localeConverterIndex = FindLMBCSLocale ( pArgs -> locale ) ; } else { * err = U_MEMORY_ALLOCATION_ERROR ; } } static void _LMBCSClose ( UConverter * _this ) { if ( _this -> extraInfo != NULL ) { ulmbcs_byte_t Ix ; UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) _this -> extraInfo ; for ( Ix = 0 ; Ix <= ULMBCS_GRP_LAST ; Ix ++ ) { if ( extraInfo -> OptGrpConverter [ Ix ] != NULL ) ucnv_unloadSharedDataIfReady ( extraInfo -> OptGrpConverter [ Ix ] ) ; } if ( ! _this -> isExtraLocal ) { uprv_free ( _this -> extraInfo ) ; _this -> extraInfo = NULL ; } } } typedef struct LMBCSClone { UConverter cnv ; UConverterDataLMBCS lmbcs ; } LMBCSClone ; static UConverter * _LMBCSSafeClone ( const UConverter * cnv , void * stackBuffer , int32_t * pBufferSize , UErrorCode * status ) { LMBCSClone * newLMBCS ; UConverterDataLMBCS * extraInfo ; int32_t i ; if ( * pBufferSize <= 0 ) { * pBufferSize = ( int32_t ) sizeof ( LMBCSClone ) ; return NULL ; } extraInfo = ( UConverterDataLMBCS * ) cnv -> extraInfo ; newLMBCS = ( LMBCSClone * ) stackBuffer ; uprv_memcpy ( & newLMBCS -> lmbcs , extraInfo , sizeof ( UConverterDataLMBCS ) ) ; for ( i = 0 ; i <= ULMBCS_GRP_LAST ; ++ i ) { if ( extraInfo -> OptGrpConverter [ i ] != NULL ) { ucnv_incrementRefCount ( extraInfo -> OptGrpConverter [ i ] ) ; } } newLMBCS -> cnv . extraInfo = & newLMBCS -> lmbcs ; newLMBCS -> cnv . isExtraLocal = TRUE ; return & newLMBCS -> cnv ; } static size_t LMBCSConversionWorker ( UConverterDataLMBCS * extraInfo , ulmbcs_byte_t group , ulmbcs_byte_t * pStartLMBCS , UChar * pUniChar , ulmbcs_byte_t * lastConverterIndex , UBool * groups_tried ) { ulmbcs_byte_t * pLMBCS = pStartLMBCS ; UConverterSharedData * xcnv = extraInfo -> OptGrpConverter [ group ] ; int bytesConverted ; uint32_t value ; ulmbcs_byte_t firstByte ; U_ASSERT ( xcnv ) ; U_ASSERT ( group < ULMBCS_GRP_UNICODE ) ; bytesConverted = ucnv_MBCSFromUChar32 ( xcnv , * pUniChar , & value , FALSE ) ; if ( bytesConverted > 0 ) { firstByte = ( ulmbcs_byte_t ) ( value >> ( ( bytesConverted - 1 ) * 8 ) ) ; } else { groups_tried [ group ] = TRUE ; return 0 ; } * lastConverterIndex = group ; U_ASSERT ( ( firstByte <= ULMBCS_C0END ) || ( firstByte >= ULMBCS_C1START ) || ( group == ULMBCS_GRP_EXCEPT ) ) ; if ( group != ULMBCS_GRP_EXCEPT && extraInfo -> OptGroup != group ) { * pLMBCS ++ = group ; if ( bytesConverted == 1 && group >= ULMBCS_DOUBLEOPTGROUP_START ) { * pLMBCS ++ = group ; } } if ( bytesConverted == 1 && firstByte < 0x20 ) return 0 ; switch ( bytesConverted ) { case 4 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 24 ) ; U_FALLTHROUGH ; case 3 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 16 ) ; U_FALLTHROUGH ; case 2 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 8 ) ; U_FALLTHROUGH ; case 1 : * pLMBCS ++ = ( ulmbcs_byte_t ) value ; U_FALLTHROUGH ; default : break ; } return ( pLMBCS - pStartLMBCS ) ; } static size_t LMBCSConvertUni ( ulmbcs_byte_t * pLMBCS , UChar uniChar ) { uint8_t LowCh = ( uint8_t ) ( uniChar & 0x00FF ) ; uint8_t HighCh = ( uint8_t ) ( uniChar >> 8 ) ; * pLMBCS ++ = ULMBCS_GRP_UNICODE ; if ( LowCh == 0 ) { * pLMBCS ++ = ULMBCS_UNICOMPATZERO ; * pLMBCS ++ = HighCh ; } else { * pLMBCS ++ = HighCh ; * pLMBCS ++ = LowCh ; } return ULMBCS_UNICODE_SIZE ; } static void _LMBCSFromUnicode ( UConverterFromUnicodeArgs * args , UErrorCode * err ) { ulmbcs_byte_t lastConverterIndex = 0 ; UChar uniChar ; ulmbcs_byte_t LMBCS [ ULMBCS_CHARSIZE_MAX ] ; ulmbcs_byte_t * pLMBCS ; int32_t bytes_written ; UBool groups_tried [ ULMBCS_GRP_LAST + 1 ] ; UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ; int sourceIndex = 0 ; ulmbcs_byte_t OldConverterIndex = 0 ; while ( args -> source < args -> sourceLimit && ! U_FAILURE ( * err ) ) { OldConverterIndex = extraInfo -> localeConverterIndex ; if ( args -> target >= args -> targetLimit ) { * err = U_BUFFER_OVERFLOW_ERROR ; break ; } uniChar = * ( args -> source ) ; bytes_written = 0 ; pLMBCS = LMBCS ; if ( ( uniChar >= 0x80 ) && ( uniChar <= 0xff ) && ( uniChar != 0xB1 ) && ( uniChar != 0xD7 ) && ( uniChar != 0xF7 ) && ( uniChar != 0xB0 ) && ( uniChar != 0xB4 ) && ( uniChar != 0xB6 ) && ( uniChar != 0xA7 ) && ( uniChar != 0xA8 ) ) { extraInfo -> localeConverterIndex = ULMBCS_GRP_L1 ; } if ( ( ( uniChar > ULMBCS_C0END ) && ( uniChar < ULMBCS_C1START ) ) || uniChar == 0 || uniChar == ULMBCS_HT || uniChar == ULMBCS_CR || uniChar == ULMBCS_LF || uniChar == ULMBCS_123SYSTEMRANGE ) { * pLMBCS ++ = ( ulmbcs_byte_t ) uniChar ; bytes_written = 1 ; } if ( ! bytes_written ) { ulmbcs_byte_t group = FindLMBCSUniRange ( uniChar ) ; if ( group == ULMBCS_GRP_UNICODE ) { pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ; bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ; } else if ( group == ULMBCS_GRP_CTRL ) { if ( uniChar <= ULMBCS_C0END ) { * pLMBCS ++ = ULMBCS_GRP_CTRL ; * pLMBCS ++ = ( ulmbcs_byte_t ) ( ULMBCS_CTRLOFFSET + uniChar ) ; } else if ( uniChar >= ULMBCS_C1START && uniChar <= ULMBCS_C1START + ULMBCS_CTRLOFFSET ) { * pLMBCS ++ = ULMBCS_GRP_CTRL ; * pLMBCS ++ = ( ulmbcs_byte_t ) ( uniChar & 0x00FF ) ; } bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ; } else if ( group < ULMBCS_GRP_UNICODE ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , group , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } if ( ! bytes_written ) { uprv_memset ( groups_tried , 0 , sizeof ( groups_tried ) ) ; if ( ( extraInfo -> OptGroup != 1 ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> OptGroup ) ) ) { if ( extraInfo -> localeConverterIndex < ULMBCS_DOUBLEOPTGROUP_START ) { bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_L1 , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; if ( ! bytes_written ) { bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } if ( ! bytes_written ) { bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } } else { bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } } if ( ! bytes_written && ( extraInfo -> localeConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> localeConverterIndex ) ) ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } if ( ! bytes_written && ( lastConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , lastConverterIndex ) ) ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , lastConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } if ( ! bytes_written ) { ulmbcs_byte_t grp_start ; ulmbcs_byte_t grp_end ; ulmbcs_byte_t grp_ix ; grp_start = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_DOUBLEOPTGROUP_START : ULMBCS_GRP_L1 ) ; grp_end = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_GRP_LAST : ULMBCS_GRP_TH ) ; if ( group == ULMBCS_AMBIGUOUS_ALL ) { grp_start = ULMBCS_GRP_L1 ; grp_end = ULMBCS_GRP_LAST ; } for ( grp_ix = grp_start ; grp_ix <= grp_end && ! bytes_written ; grp_ix ++ ) { if ( extraInfo -> OptGrpConverter [ grp_ix ] && ! groups_tried [ grp_ix ] ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , grp_ix , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } } if ( ! bytes_written && grp_start == ULMBCS_GRP_L1 ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } } if ( ! bytes_written ) { pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ; bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ; } } } args -> source ++ ; pLMBCS = LMBCS ; while ( args -> target < args -> targetLimit && bytes_written -- ) { * ( args -> target ) ++ = * pLMBCS ++ ; if ( args -> offsets ) { * ( args -> offsets ) ++ = sourceIndex ; } } sourceIndex ++ ; if ( bytes_written > 0 ) { uint8_t * pErrorBuffer = args -> converter -> charErrorBuffer ; * err = U_BUFFER_OVERFLOW_ERROR ; args -> converter -> charErrorBufferLength = ( int8_t ) bytes_written ; while ( bytes_written -- ) { * pErrorBuffer ++ = * pLMBCS ++ ; } } extraInfo -> localeConverterIndex = OldConverterIndex ; } } static UChar GetUniFromLMBCSUni ( char const * * ppLMBCSin ) { uint8_t HighCh = * ( * ppLMBCSin ) ++ ; uint8_t LowCh = * ( * ppLMBCSin ) ++ ; if ( HighCh == ULMBCS_UNICOMPATZERO ) { HighCh = LowCh ; LowCh = 0 ; } return ( UChar ) ( ( HighCh << 8 ) | LowCh ) ; } # define CHECK_SOURCE_LIMIT ( index ) if ( args -> source + index > args -> sourceLimit ) { * err = U_TRUNCATED_CHAR_FOUND ; args -> source = args -> sourceLimit ; return 0xffff ; } static UChar32 _LMBCSGetNextUCharWorker ( UConverterToUnicodeArgs * args , UErrorCode * err ) { UChar32 uniChar = 0 ; ulmbcs_byte_t CurByte ; if ( args -> source >= args -> sourceLimit ) { * err = U_ILLEGAL_ARGUMENT_ERROR ; return 0xffff ; } CurByte = * ( ( ulmbcs_byte_t * ) ( args -> source ++ ) ) ; if ( ( ( CurByte > ULMBCS_C0END ) && ( CurByte < ULMBCS_C1START ) ) || ( CurByte == 0 ) || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR || CurByte == ULMBCS_LF || CurByte == ULMBCS_123SYSTEMRANGE ) { uniChar = CurByte ; } else { UConverterDataLMBCS * extraInfo ; ulmbcs_byte_t group ; UConverterSharedData * cnv ; if ( CurByte == ULMBCS_GRP_CTRL ) { ulmbcs_byte_t C0C1byte ; CHECK_SOURCE_LIMIT ( 1 ) ; C0C1byte = * ( args -> source ) ++ ; uniChar = ( C0C1byte < ULMBCS_C1START ) ? C0C1byte - ULMBCS_CTRLOFFSET : C0C1byte ; } else if ( CurByte == ULMBCS_GRP_UNICODE ) { CHECK_SOURCE_LIMIT ( 2 ) ; return GetUniFromLMBCSUni ( & ( args -> source ) ) ; } else if ( CurByte <= ULMBCS_CTRLOFFSET ) { group = CurByte ; extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ; if ( group > ULMBCS_GRP_LAST || ( cnv = extraInfo -> OptGrpConverter [ group ] ) == NULL ) { * err = U_INVALID_CHAR_FOUND ; } else if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) { CHECK_SOURCE_LIMIT ( 2 ) ; if ( * args -> source == group ) { ++ args -> source ; uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 1 , FALSE ) ; ++ args -> source ; } else { uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 2 , FALSE ) ; args -> source += 2 ; } } else { CHECK_SOURCE_LIMIT ( 1 ) ; CurByte = * ( args -> source ) ++ ; if ( CurByte >= ULMBCS_C1START ) { uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ; } else { char bytes [ 2 ] ; extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ; cnv = extraInfo -> OptGrpConverter [ ULMBCS_GRP_EXCEPT ] ; bytes [ 0 ] = group ; bytes [ 1 ] = CurByte ; uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , bytes , 2 , FALSE ) ; } } } else if ( CurByte >= ULMBCS_C1START ) { extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ; group = extraInfo -> OptGroup ; cnv = extraInfo -> OptGrpConverter [ group ] ; if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) { if ( ! ucnv_MBCSIsLeadByte ( cnv , CurByte ) ) { CHECK_SOURCE_LIMIT ( 0 ) ; uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 1 , FALSE ) ; } else { CHECK_SOURCE_LIMIT ( 1 ) ; uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 2 , FALSE ) ; ++ args -> source ; } } else { uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ; } } } return uniChar ; } static void _LMBCSToUnicodeWithOffsets ( UConverterToUnicodeArgs * args , UErrorCode * err ) { char LMBCS [ ULMBCS_CHARSIZE_MAX ] ; UChar uniChar ; const char * saveSource ; const char * pStartLMBCS = args -> source ; const char * errSource = NULL ; int8_t savebytes = 0 ; while ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit > args -> target ) { saveSource = args -> source ; if ( args -> converter -> toULength ) { const char * saveSourceLimit ; size_t size_old = args -> converter -> toULength ; size_t size_new_maybe_1 = sizeof ( LMBCS ) - size_old ; size_t size_new_maybe_2 = args -> sourceLimit - args -> source ; size_t size_new = ( size_new_maybe_1 < size_new_maybe_2 ) ? size_new_maybe_1 : size_new_maybe_2 ; uprv_memcpy ( LMBCS , args -> converter -> toUBytes , size_old ) ; uprv_memcpy ( LMBCS + size_old , args -> source , size_new ) ; saveSourceLimit = args -> sourceLimit ; args -> source = errSource = LMBCS ; args -> sourceLimit = LMBCS + size_old + size_new ; savebytes = ( int8_t ) ( size_old + size_new ) ; uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ; args -> source = saveSource + ( ( args -> source - LMBCS ) - size_old ) ; args -> sourceLimit = saveSourceLimit ; if ( * err == U_TRUNCATED_CHAR_FOUND ) { args -> converter -> toULength = savebytes ; uprv_memcpy ( args -> converter -> toUBytes , LMBCS , savebytes ) ; args -> source = args -> sourceLimit ; * err = U_ZERO_ERROR ; return ; } else { args -> converter -> toULength = 0 ; } } else { errSource = saveSource ; uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ; savebytes = ( int8_t ) ( args -> source - saveSource ) ; } if ( U_SUCCESS ( * err ) ) { if ( uniChar < 0xfffe ) { * ( args -> target ) ++ = uniChar ; if ( args -> offsets ) { * ( args -> offsets ) ++ = ( int32_t ) ( saveSource - pStartLMBCS ) ; } } else if ( uniChar == 0xfffe ) { * err = U_INVALID_CHAR_FOUND ; } else { * err = U_ILLEGAL_CHAR_FOUND ; } } } if ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit <= args -> target ) { * err = U_BUFFER_OVERFLOW_ERROR ; } else if ( U_FAILURE ( * err ) ) { args -> converter -> toULength = savebytes ; if ( savebytes > 0 ) { uprv_memcpy ( args -> converter -> toUBytes , errSource , savebytes ) ; } if ( * err == U_TRUNCATED_CHAR_FOUND ) { * err = U_ZERO_ERROR ; } } } DEFINE_LMBCS_OPEN ( 1 )
1True
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONGetBlockIoThrottle ( qemuMonitorPtr mon , const char * device , virDomainBlockIoTuneInfoPtr reply ) { int ret = - 1 ; virJSONValuePtr cmd = NULL ; virJSONValuePtr result = NULL ; cmd = qemuMonitorJSONMakeCommand ( "query-block" , NULL ) ; if ( ! cmd ) { return - 1 ; } ret = qemuMonitorJSONCommand ( mon , cmd , & result ) ; if ( ret == 0 && virJSONValueObjectHasKey ( result , "error" ) ) { if ( qemuMonitorJSONHasError ( result , "DeviceNotActive" ) ) qemuReportError ( VIR_ERR_OPERATION_INVALID , _ ( "No active operation on device: %s" ) , device ) ; else if ( qemuMonitorJSONHasError ( result , "NotSupported" ) ) qemuReportError ( VIR_ERR_OPERATION_INVALID , _ ( "Operation is not supported for device: %s" ) , device ) ; else qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "Unexpected error" ) ) ; ret = - 1 ; } if ( ret == 0 ) ret = qemuMonitorJSONBlockIoThrottleInfo ( result , device , reply ) ; virJSONValueFree ( cmd ) ; virJSONValueFree ( result ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static lbmpdm_definition_t * lbmpdm_definition_find ( guint64 channel , guint32 ID , guint8 version_major , guint8 version_minor ) { lbmpdm_definition_t * entry = NULL ; guint32 keyval [ LBMPDM_DEFINITION_KEY_ELEMENT_COUNT ] ; wmem_tree_key_t tkey [ 2 ] ; lbmpdm_definition_build_key ( keyval , tkey , channel , ID , version_major , version_minor ) ; entry = ( lbmpdm_definition_t * ) wmem_tree_lookup32_array ( lbmpdm_definition_table , tkey ) ; return ( entry ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline realpath_cache_bucket * realpath_cache_find ( const char * path , int path_len , time_t t TSRMLS_DC ) { # ifdef PHP_WIN32 unsigned long key = realpath_cache_key ( path , path_len TSRMLS_CC ) ; # else unsigned long key = realpath_cache_key ( path , path_len ) ; # endif unsigned long n = key % ( sizeof ( CWDG ( realpath_cache ) ) / sizeof ( CWDG ( realpath_cache ) [ 0 ] ) ) ; realpath_cache_bucket * * bucket = & CWDG ( realpath_cache ) [ n ] ; while ( * bucket != NULL ) { if ( CWDG ( realpath_cache_ttl ) && ( * bucket ) -> expires < t ) { realpath_cache_bucket * r = * bucket ; * bucket = ( * bucket ) -> next ; if ( r -> path == r -> realpath ) { CWDG ( realpath_cache_size ) -= sizeof ( realpath_cache_bucket ) + r -> path_len + 1 ; } else { CWDG ( realpath_cache_size ) -= sizeof ( realpath_cache_bucket ) + r -> path_len + 1 + r -> realpath_len + 1 ; } free ( r ) ; } else if ( key == ( * bucket ) -> key && path_len == ( * bucket ) -> path_len && memcmp ( path , ( * bucket ) -> path , path_len ) == 0 ) { return * bucket ; } else { bucket = & ( * bucket ) -> next ; } } return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int NETSCAPE_SPKI_verify ( NETSCAPE_SPKI * a , EVP_PKEY * r ) { return ( ASN1_item_verify ( ASN1_ITEM_rptr ( NETSCAPE_SPKAC ) , a -> sig_algor , a -> signature , a -> spkac , r ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void astream_add_body ( struct attachment_istream * astream , const struct message_block * block ) { struct attachment_istream_part * part = & astream -> part ; buffer_t * part_buf ; size_t new_size ; switch ( part -> state ) { case MAIL_ATTACHMENT_STATE_NO : stream_add_data ( astream , block -> data , block -> size ) ; break ; case MAIL_ATTACHMENT_STATE_MAYBE : if ( part -> part_buf == NULL ) { part -> part_buf = buffer_create_dynamic ( default_pool , astream -> set . min_size ) ; } part_buf = part -> part_buf ; new_size = part_buf -> used + block -> size ; if ( new_size < astream -> set . min_size ) { buffer_append ( part_buf , block -> data , block -> size ) ; break ; } if ( astream_open_output ( astream ) < 0 ) { part -> state = MAIL_ATTACHMENT_STATE_NO ; stream_add_data ( astream , part_buf -> data , part_buf -> used ) ; stream_add_data ( astream , block -> data , block -> size ) ; break ; } part -> state = MAIL_ATTACHMENT_STATE_YES ; astream_try_base64_decode ( part , part_buf -> data , part_buf -> used ) ; hash_format_loop ( astream -> set . hash_format , part_buf -> data , part_buf -> used ) ; o_stream_nsend ( part -> temp_output , part_buf -> data , part_buf -> used ) ; buffer_set_used_size ( part_buf , 0 ) ; case MAIL_ATTACHMENT_STATE_YES : astream_try_base64_decode ( part , block -> data , block -> size ) ; hash_format_loop ( astream -> set . hash_format , block -> data , block -> size ) ; o_stream_nsend ( part -> temp_output , block -> data , block -> size ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean confirm_multiple_windows ( GtkWindow * parent_window , int count , gboolean use_tabs ) { GtkDialog * dialog ; char * prompt ; char * detail ; int response ; if ( count <= SILENT_WINDOW_OPEN_LIMIT ) { return TRUE ; } prompt = _ ( "Are you sure you want to open all files?" ) ; if ( use_tabs ) { detail = g_strdup_printf ( ngettext ( "This will open %d separate tab." , "This will open %d separate tabs." , count ) , count ) ; } else { detail = g_strdup_printf ( ngettext ( "This will open %d separate window." , "This will open %d separate windows." , count ) , count ) ; } dialog = eel_show_yes_no_dialog ( prompt , detail , _ ( "_OK" ) , _ ( "_Cancel" ) , parent_window ) ; g_free ( detail ) ; response = gtk_dialog_run ( dialog ) ; gtk_widget_destroy ( GTK_WIDGET ( dialog ) ) ; return response == GTK_RESPONSE_YES ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONBlockResize ( qemuMonitorPtr mon , const char * device , unsigned long long size ) { int ret ; virJSONValuePtr cmd ; virJSONValuePtr reply = NULL ; cmd = qemuMonitorJSONMakeCommand ( "block_resize" , "s:device" , device , "U:size" , size * 1024 , NULL ) ; if ( ! cmd ) return - 1 ; ret = qemuMonitorJSONCommand ( mon , cmd , & reply ) ; if ( ret == 0 ) { if ( qemuMonitorJSONHasError ( reply , "CommandNotFound" ) ) { ret = - 2 ; goto cleanup ; } ret = qemuMonitorJSONCheckError ( cmd , reply ) ; } cleanup : virJSONValueFree ( cmd ) ; virJSONValueFree ( reply ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplFileObject , func_name ) \ { \ spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; \ FileFunctionCall ( func_name , ZEND_NUM_ARGS ( ) , NULL ) ; \ } SPL_METHOD ( SplFileObject , fgetcsv ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; char delimiter = intern -> u . file . delimiter , enclosure = intern -> u . file . enclosure , escape = intern -> u . file . escape ; char * delim = NULL , * enclo = NULL , * esc = NULL ; int d_len = 0 , e_len = 0 , esc_len = 0 ; if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "|sss" , & delim , & d_len , & enclo , & e_len , & esc , & esc_len ) == SUCCESS ) { switch ( ZEND_NUM_ARGS ( ) ) { case 3 : if ( esc_len != 1 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "escape must be a character" ) ; RETURN_FALSE ; } escape = esc [ 0 ] ; case 2 : if ( e_len != 1 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "enclosure must be a character" ) ; RETURN_FALSE ; } enclosure = enclo [ 0 ] ; case 1 : if ( d_len != 1 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "delimiter must be a character" ) ; RETURN_FALSE ; } delimiter = delim [ 0 ] ; case 0 : break ; } spl_filesystem_file_read_csv ( intern , delimiter , enclosure , escape , return_value TSRMLS_CC ) ; } } SPL_METHOD ( SplFileObject , fputcsv ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; char delimiter = intern -> u . file . delimiter , enclosure = intern -> u . file . enclosure , escape = intern -> u . file . escape ; char * delim = NULL , * enclo = NULL , * esc = NULL ; int d_len = 0 , e_len = 0 , esc_len = 0 , ret ; zval * fields = NULL ; if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "a|sss" , & fields , & delim , & d_len , & enclo , & e_len , & esc , & esc_len ) == SUCCESS ) { switch ( ZEND_NUM_ARGS ( ) ) { case 4 : if ( esc_len != 1 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "escape must be a character" ) ; RETURN_FALSE ; } escape = esc [ 0 ] ; case 3 : if ( e_len != 1 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "enclosure must be a character" ) ; RETURN_FALSE ; } enclosure = enclo [ 0 ] ; case 2 : if ( d_len != 1 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "delimiter must be a character" ) ; RETURN_FALSE ; } delimiter = delim [ 0 ] ; case 1 : case 0 : break ; } ret = php_fputcsv ( intern -> u . file . stream , fields , delimiter , enclosure , escape TSRMLS_CC ) ; RETURN_LONG ( ret ) ; } } SPL_METHOD ( SplFileObject , setCsvControl ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; char delimiter = ',' , enclosure = '"' , escape = '\\' ; char * delim = NULL , * enclo = NULL , * esc = NULL ; int d_len = 0 , e_len = 0 , esc_len = 0 ; if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "|sss" , & delim , & d_len , & enclo , & e_len , & esc , & esc_len ) == SUCCESS ) { switch ( ZEND_NUM_ARGS ( ) ) { case 3 : if ( esc_len != 1 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "escape must be a character" ) ; RETURN_FALSE ; } escape = esc [ 0 ] ; case 2 : if ( e_len != 1 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "enclosure must be a character" ) ; RETURN_FALSE ; } enclosure = enclo [ 0 ] ; case 1 : if ( d_len != 1 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "delimiter must be a character" ) ; RETURN_FALSE ; } delimiter = delim [ 0 ] ; case 0 : break ; } intern -> u . file . delimiter = delimiter ; intern -> u . file . enclosure = enclosure ; intern -> u . file . escape = escape ; } } SPL_METHOD ( SplFileObject , getCsvControl ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; char delimiter [ 2 ] , enclosure [ 2 ] ; array_init ( return_value ) ; delimiter [ 0 ] = intern -> u . file . delimiter ; delimiter [ 1 ] = '\0' ; enclosure [ 0 ] = intern -> u . file . enclosure ; enclosure [ 1 ] = '\0' ; add_next_index_string ( return_value , delimiter , 1 ) ; add_next_index_string ( return_value , enclosure , 1 ) ; } FileFunction ( flock )
0False
Categorize the following code snippet as vulnerable or not. True or False
static gint nlm_msg_res_unmatched_equal ( gconstpointer k1 , gconstpointer k2 ) { const nlm_msg_res_unmatched_data * umd1 = ( const nlm_msg_res_unmatched_data * ) k1 ; const nlm_msg_res_unmatched_data * umd2 = ( const nlm_msg_res_unmatched_data * ) k2 ; if ( umd1 -> cookie_len != umd2 -> cookie_len ) { return 0 ; } return ( memcmp ( umd1 -> cookie , umd2 -> cookie , umd1 -> cookie_len ) == 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_standard ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 757 "../../asn1/h245/h245.cnf" guint32 value_int = ( guint32 ) - 1 ; gef_ctx_t * gefx ; offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 127U , & value_int , FALSE ) ; gefx = gef_ctx_get ( actx -> private_data ) ; if ( gefx ) gefx -> id = wmem_strdup_printf ( wmem_packet_scope ( ) , "%d" , value_int ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vga_draw_line24_be ( VGACommonState * s1 , uint8_t * d , const uint8_t * s , int width ) { int w ; uint32_t r , g , b ; w = width ; do { r = s [ 0 ] ; g = s [ 1 ] ; b = s [ 2 ] ; ( ( uint32_t * ) d ) [ 0 ] = rgb_to_pixel32 ( r , g , b ) ; s += 3 ; d += 4 ; } while ( -- w != 0 ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void pdf_process_Do ( fz_context * ctx , pdf_processor * proc , pdf_csi * csi ) { pdf_obj * xres , * xobj , * subtype ; xres = pdf_dict_get ( ctx , csi -> rdb , PDF_NAME_XObject ) ; if ( ! xres ) fz_throw ( ctx , FZ_ERROR_SYNTAX , "cannot find XObject dictionary" ) ; xobj = pdf_dict_gets ( ctx , xres , csi -> name ) ; if ( ! xobj ) fz_throw ( ctx , FZ_ERROR_SYNTAX , "cannot find XObject resource '%s'" , csi -> name ) ; subtype = pdf_dict_get ( ctx , xobj , PDF_NAME_Subtype ) ; if ( pdf_name_eq ( ctx , subtype , PDF_NAME_Form ) ) { pdf_obj * st = pdf_dict_get ( ctx , xobj , PDF_NAME_Subtype2 ) ; if ( st ) subtype = st ; } if ( ! pdf_is_name ( ctx , subtype ) ) fz_throw ( ctx , FZ_ERROR_SYNTAX , "no XObject subtype specified" ) ; if ( pdf_is_hidden_ocg ( ctx , csi -> doc -> ocg , csi -> rdb , proc -> usage , pdf_dict_get ( ctx , xobj , PDF_NAME_OC ) ) ) return ; if ( pdf_name_eq ( ctx , subtype , PDF_NAME_Form ) ) { if ( proc -> op_Do_form ) { pdf_xobject * form = pdf_load_xobject ( ctx , csi -> doc , xobj ) ; fz_try ( ctx ) proc -> op_Do_form ( ctx , proc , csi -> name , form , csi -> rdb ) ; fz_always ( ctx ) pdf_drop_xobject ( ctx , form ) ; fz_catch ( ctx ) fz_rethrow ( ctx ) ; } } else if ( pdf_name_eq ( ctx , subtype , PDF_NAME_Image ) ) { if ( proc -> op_Do_image ) { fz_image * image = pdf_load_image ( ctx , csi -> doc , xobj ) ; fz_try ( ctx ) proc -> op_Do_image ( ctx , proc , csi -> name , image ) ; fz_always ( ctx ) fz_drop_image ( ctx , image ) ; fz_catch ( ctx ) fz_rethrow ( ctx ) ; } } else if ( ! strcmp ( pdf_to_name ( ctx , subtype ) , "PS" ) ) fz_warn ( ctx , "ignoring XObject with subtype PS" ) ; else fz_warn ( ctx , "ignoring XObject with unknown subtype: '%s'" , pdf_to_name ( ctx , subtype ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
mbfl_string * mime_header_encoder_result ( struct mime_header_encoder_data * pe , mbfl_string * result ) { if ( pe -> status1 >= 10 ) { ( * pe -> conv2_filter -> filter_flush ) ( pe -> conv2_filter ) ; ( * pe -> encod_filter -> filter_flush ) ( pe -> encod_filter ) ; mbfl_memory_device_strncat ( & pe -> outdev , "\x3f\x3d" , 2 ) ; } else if ( pe -> tmpdev . pos > 0 ) { if ( pe -> outdev . pos > 0 ) { if ( ( pe -> outdev . pos - pe -> linehead + pe -> tmpdev . pos ) > 74 ) { mbfl_memory_device_strncat ( & pe -> outdev , pe -> lwsp , pe -> lwsplen ) ; } else { mbfl_memory_device_output ( 0x20 , & pe -> outdev ) ; } } mbfl_memory_device_devcat ( & pe -> outdev , & pe -> tmpdev ) ; } mbfl_memory_device_reset ( & pe -> tmpdev ) ; pe -> prevpos = 0 ; pe -> linehead = 0 ; pe -> status1 = 0 ; pe -> status2 = 0 ; return mbfl_memory_device_result ( & pe -> outdev , result ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void show_stream_config ( struct stream_state * stream , struct VpxEncoderConfig * global , struct VpxInputContext * input ) { # define SHOW ( field ) fprintf ( stderr , " %-28s = %d\n" , # field , stream -> config . cfg . field ) if ( stream -> index == 0 ) { fprintf ( stderr , "Codec: %s\n" , vpx_codec_iface_name ( global -> codec -> codec_interface ( ) ) ) ; fprintf ( stderr , "Source file: %s File Type: %s Format: %s\n" , input -> filename , file_type_to_string ( input -> file_type ) , image_format_to_string ( input -> fmt ) ) ; } if ( stream -> next || stream -> index ) fprintf ( stderr , "\nStream Index: %d\n" , stream -> index ) ; fprintf ( stderr , "Destination file: %s\n" , stream -> config . out_fn ) ; fprintf ( stderr , "Encoder parameters:\n" ) ; SHOW ( g_usage ) ; SHOW ( g_threads ) ; SHOW ( g_profile ) ; SHOW ( g_w ) ; SHOW ( g_h ) ; SHOW ( g_bit_depth ) ; SHOW ( g_input_bit_depth ) ; SHOW ( g_timebase . num ) ; SHOW ( g_timebase . den ) ; SHOW ( g_error_resilient ) ; SHOW ( g_pass ) ; SHOW ( g_lag_in_frames ) ; SHOW ( rc_dropframe_thresh ) ; SHOW ( rc_resize_allowed ) ; SHOW ( rc_scaled_width ) ; SHOW ( rc_scaled_height ) ; SHOW ( rc_resize_up_thresh ) ; SHOW ( rc_resize_down_thresh ) ; SHOW ( rc_end_usage ) ; SHOW ( rc_target_bitrate ) ; SHOW ( rc_min_quantizer ) ; SHOW ( rc_max_quantizer ) ; SHOW ( rc_undershoot_pct ) ; SHOW ( rc_overshoot_pct ) ; SHOW ( rc_buf_sz ) ; SHOW ( rc_buf_initial_sz ) ; SHOW ( rc_buf_optimal_sz ) ; SHOW ( rc_2pass_vbr_bias_pct ) ; SHOW ( rc_2pass_vbr_minsection_pct ) ; SHOW ( rc_2pass_vbr_maxsection_pct ) ; SHOW ( kf_mode ) ; SHOW ( kf_min_dist ) ; SHOW ( kf_max_dist ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _slurm_rpc_update_job ( slurm_msg_t * msg ) { int error_code = SLURM_SUCCESS ; DEF_TIMERS ; job_desc_msg_t * job_desc_msg = ( job_desc_msg_t * ) msg -> data ; slurmctld_lock_t fed_read_lock = { NO_LOCK , NO_LOCK , NO_LOCK , NO_LOCK , READ_LOCK } ; slurmctld_lock_t job_write_lock = { READ_LOCK , WRITE_LOCK , WRITE_LOCK , READ_LOCK , READ_LOCK } ; uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ; lock_slurmctld ( fed_read_lock ) ; if ( ! _route_msg_to_origin ( msg , job_desc_msg -> job_id_str , job_desc_msg -> job_id , uid ) ) { unlock_slurmctld ( fed_read_lock ) ; return ; } unlock_slurmctld ( fed_read_lock ) ; START_TIMER ; debug2 ( "Processing RPC: REQUEST_UPDATE_JOB from uid=%d" , uid ) ; if ( job_desc_msg -> user_id != NO_VAL ) { if ( ! validate_super_user ( uid ) ) { error_code = ESLURM_USER_ID_MISSING ; error ( "Security violation, REQUEST_UPDATE_JOB RPC from uid=%d" , uid ) ; slurm_send_rc_msg ( msg , error_code ) ; } else { uid = job_desc_msg -> user_id ; } } if ( error_code == SLURM_SUCCESS ) { int db_inx_max_cnt = 5 , i = 0 ; dump_job_desc ( job_desc_msg ) ; xstrtolower ( job_desc_msg -> account ) ; xstrtolower ( job_desc_msg -> wckey ) ; error_code = ESLURM_JOB_SETTING_DB_INX ; while ( error_code == ESLURM_JOB_SETTING_DB_INX ) { lock_slurmctld ( job_write_lock ) ; if ( job_desc_msg -> job_id_str ) error_code = update_job_str ( msg , uid ) ; else error_code = update_job ( msg , uid , true ) ; unlock_slurmctld ( job_write_lock ) ; if ( error_code == ESLURM_JOB_SETTING_DB_INX ) { if ( i >= db_inx_max_cnt ) { if ( job_desc_msg -> job_id_str ) { info ( "%s: can't update job, waited %d seconds for job %s to get a db_index, but it hasn't happened yet. Giving up and informing the user" , __func__ , db_inx_max_cnt , job_desc_msg -> job_id_str ) ; } else { info ( "%s: can't update job, waited %d seconds for job %u to get a db_index, but it hasn't happened yet. Giving up and informing the user" , __func__ , db_inx_max_cnt , job_desc_msg -> job_id ) ; } slurm_send_rc_msg ( msg , error_code ) ; break ; } i ++ ; if ( job_desc_msg -> job_id_str ) { debug ( "%s: We cannot update job %s at the moment, we are setting the db index, waiting" , __func__ , job_desc_msg -> job_id_str ) ; } else { debug ( "%s: We cannot update job %u at the moment, we are setting the db index, waiting" , __func__ , job_desc_msg -> job_id ) ; } sleep ( 1 ) ; } } } END_TIMER2 ( "_slurm_rpc_update_job" ) ; if ( error_code ) { if ( job_desc_msg -> job_id_str ) { info ( "%s: JobId=%s uid=%d: %s" , __func__ , job_desc_msg -> job_id_str , uid , slurm_strerror ( error_code ) ) ; } else { info ( "%s: JobId=%u uid=%d: %s" , __func__ , job_desc_msg -> job_id , uid , slurm_strerror ( error_code ) ) ; } } else { if ( job_desc_msg -> job_id_str ) { info ( "%s: complete JobId=%s uid=%d %s" , __func__ , job_desc_msg -> job_id_str , uid , TIME_STR ) ; } else { info ( "%s: complete JobId=%u uid=%d %s" , __func__ , job_desc_msg -> job_id , uid , TIME_STR ) ; } schedule_job_save ( ) ; schedule_node_save ( ) ; queue_job_scheduler ( ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void virtio_balloon_to_target ( void * opaque , ram_addr_t target ) { VirtIOBalloon * dev = opaque ; if ( target > ram_size ) { target = ram_size ; } if ( target ) { dev -> num_pages = ( ram_size - target ) >> VIRTIO_BALLOON_PFN_SHIFT ; virtio_notify_config ( & dev -> vdev ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int ffv1_allocate_initial_states ( FFV1Context * f ) { int i ; for ( i = 0 ; i < f -> quant_table_count ; i ++ ) { f -> initial_states [ i ] = av_malloc ( f -> context_count [ i ] * sizeof ( * f -> initial_states [ i ] ) ) ; if ( ! f -> initial_states [ i ] ) return AVERROR ( ENOMEM ) ; memset ( f -> initial_states [ i ] , 128 , f -> context_count [ i ] * sizeof ( * f -> initial_states [ i ] ) ) ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ScoredHistoryMatchTest , ScoringTLD ) { base : : Time now = base : : Time : : NowFromSystemTime ( ) ; std : : string url_string ( "http://fedcba.com/" ) ; const GURL url ( url_string ) ; history : : URLRow row ( MakeURLRow ( url_string . c_str ( ) , "" , 8 , 3 , 1 ) ) ; RowWordStarts word_starts ; PopulateWordStarts ( row , & word_starts ) ; WordStarts two_words_no_offsets ( 2 , 0u ) ; VisitInfoVector visits = CreateVisitInfoVector ( 8 , 3 , now ) ; ScoredHistoryMatch scored ( row , visits , ASCIIToUTF16 ( "fed com" ) , Make2Terms ( "fed" , "com" ) , two_words_no_offsets , word_starts , false , nullptr , now ) ; EXPECT_EQ ( 0 , scored . raw_score ) ; base : : AutoReset < bool > reset ( & ScoredHistoryMatch : : allow_tld_matches_ , true ) ; ScoredHistoryMatch scored_with_tld ( row , visits , ASCIIToUTF16 ( "fed com" ) , Make2Terms ( "fed" , "com" ) , two_words_no_offsets , word_starts , false , nullptr , now ) ; EXPECT_GT ( scored_with_tld . raw_score , 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int com_delimiter ( String * buffer __attribute__ ( ( unused ) ) , char * line ) { char buff [ 256 ] , * tmp ; strmake_buf ( buff , line ) ; tmp = get_arg ( buff , GET ) ; if ( ! tmp || ! * tmp ) { put_info ( "DELIMITER must be followed by a 'delimiter' character or string" , INFO_ERROR ) ; return 0 ; } else { if ( strstr ( tmp , "\\" ) ) { put_info ( "DELIMITER cannot contain a backslash character" , INFO_ERROR ) ; return 0 ; } } strmake_buf ( delimiter , tmp ) ; delimiter_length = ( int ) strlen ( delimiter ) ; delimiter_str = delimiter ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * cmd_hash_engine ( cmd_parms * cmd , void * _dcfg , const char * p1 ) { directory_config * dcfg = ( directory_config * ) _dcfg ; if ( dcfg == NULL ) return NULL ; if ( strcasecmp ( p1 , "on" ) == 0 ) { dcfg -> hash_is_enabled = HASH_ENABLED ; dcfg -> hash_enforcement = HASH_ENABLED ; } else if ( strcasecmp ( p1 , "off" ) == 0 ) { dcfg -> hash_is_enabled = HASH_DISABLED ; dcfg -> hash_enforcement = HASH_DISABLED ; } else return apr_psprintf ( cmd -> pool , "ModSecurity: Invalid value for SecRuleEngine: %s" , p1 ) ; return NULL ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int jbig2_end_of_stripe ( Jbig2Ctx * ctx , Jbig2Segment * segment , const uint8_t * segment_data ) { Jbig2Page page = ctx -> pages [ ctx -> current_page ] ; int end_row ; end_row = jbig2_get_int32 ( segment_data ) ; if ( end_row < page . end_row ) { jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "end of stripe segment with non-positive end row advance" " (new end row %d vs current end row %d)" , end_row , page . end_row ) ; } else { jbig2_error ( ctx , JBIG2_SEVERITY_INFO , segment -> number , "end of stripe: advancing end row to %d" , end_row ) ; } page . end_row = end_row ; return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int nntp_mbox_sync ( struct Context * ctx , int * index_hint ) { struct NntpData * nntp_data = ctx -> data ; int rc ; # ifdef USE_HCACHE header_cache_t * hc = NULL ; # endif nntp_data -> nserv -> check_time = 0 ; rc = check_mailbox ( ctx ) ; if ( rc ) return rc ; # ifdef USE_HCACHE nntp_data -> last_cached = 0 ; hc = nntp_hcache_open ( nntp_data ) ; # endif for ( int i = 0 ; i < ctx -> msgcount ; i ++ ) { struct Header * hdr = ctx -> hdrs [ i ] ; char buf [ 16 ] ; snprintf ( buf , sizeof ( buf ) , "%d" , NHDR ( hdr ) -> article_num ) ; if ( nntp_data -> bcache && hdr -> deleted ) { mutt_debug ( 2 , "mutt_bcache_del %s\n" , buf ) ; mutt_bcache_del ( nntp_data -> bcache , buf ) ; } # ifdef USE_HCACHE if ( hc && ( hdr -> changed || hdr -> deleted ) ) { if ( hdr -> deleted && ! hdr -> read ) nntp_data -> unread -- ; mutt_debug ( 2 , "mutt_hcache_store %s\n" , buf ) ; mutt_hcache_store ( hc , buf , strlen ( buf ) , hdr , 0 ) ; } # endif } # ifdef USE_HCACHE if ( hc ) { mutt_hcache_close ( hc ) ; nntp_data -> last_cached = nntp_data -> last_loaded ; } # endif nntp_newsrc_gen_entries ( ctx ) ; nntp_newsrc_update ( nntp_data -> nserv ) ; nntp_newsrc_close ( nntp_data -> nserv ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int zifelse ( i_ctx_t * i_ctx_p ) { os_ptr op = osp ; check_proc ( * op ) ; check_proc ( op [ - 1 ] ) ; check_type ( op [ - 2 ] , t_boolean ) ; check_estack ( 1 ) ; ++ esp ; if ( op [ - 2 ] . value . boolval ) { ref_assign ( esp , op - 1 ) ; } else { ref_assign ( esp , op ) ; } esfile_check_cache ( ) ; pop ( 3 ) ; return o_push_estack ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint32 get_first_marker_offset ( mpa_state_t * state , struct tcpinfo * tcpinfo , guint8 endpoint ) { guint32 offset = 0 ; if ( tcpinfo -> seq > state -> minfo [ endpoint ] . seq ) { offset = ( tcpinfo -> seq - state -> minfo [ endpoint ] . seq ) % MPA_MARKER_INTERVAL ; } if ( tcpinfo -> seq < state -> minfo [ endpoint ] . seq ) { offset = state -> minfo [ endpoint ] . seq + ( TCP_MAX_SEQ - tcpinfo -> seq ) % MPA_MARKER_INTERVAL ; } return ( MPA_MARKER_INTERVAL - offset ) % MPA_MARKER_INTERVAL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void untrusted_launcher_response_callback ( GtkDialog * dialog , int response_id , ActivateParametersDesktop * parameters ) { GdkScreen * screen ; char * uri ; GFile * file ; switch ( response_id ) { case RESPONSE_RUN : { screen = gtk_widget_get_screen ( GTK_WIDGET ( parameters -> parent_window ) ) ; uri = nautilus_file_get_uri ( parameters -> file ) ; DEBUG ( "Launching untrusted launcher %s" , uri ) ; nautilus_launch_desktop_file ( screen , uri , NULL , parameters -> parent_window ) ; g_free ( uri ) ; } break ; case RESPONSE_MARK_TRUSTED : { file = nautilus_file_get_location ( parameters -> file ) ; nautilus_file_mark_desktop_file_trusted ( file , parameters -> parent_window , TRUE , NULL , NULL ) ; g_object_unref ( file ) ; } break ; default : { } break ; } gtk_widget_destroy ( GTK_WIDGET ( dialog ) ) ; activate_parameters_desktop_free ( parameters ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void jpc_enc_dump ( jpc_enc_t * enc ) { jpc_enc_tile_t * tile ; jpc_enc_tcmpt_t * tcmpt ; jpc_enc_rlvl_t * rlvl ; jpc_enc_band_t * band ; jpc_enc_prc_t * prc ; jpc_enc_cblk_t * cblk ; uint_fast16_t cmptno ; uint_fast16_t rlvlno ; uint_fast16_t bandno ; uint_fast32_t prcno ; uint_fast32_t cblkno ; tile = enc -> curtile ; for ( cmptno = 0 , tcmpt = tile -> tcmpts ; cmptno < tile -> numtcmpts ; ++ cmptno , ++ tcmpt ) { jas_eprintf ( " tcmpt %5d %5d %5d %5d\n" , jas_seq2d_xstart ( tcmpt -> data ) , jas_seq2d_ystart ( tcmpt -> data ) , jas_seq2d_xend ( tcmpt -> data ) , jas_seq2d_yend ( tcmpt -> data ) ) ; for ( rlvlno = 0 , rlvl = tcmpt -> rlvls ; rlvlno < tcmpt -> numrlvls ; ++ rlvlno , ++ rlvl ) { jas_eprintf ( " rlvl %5d %5d %5d %5d\n" , rlvl -> tlx , rlvl -> tly , rlvl -> brx , rlvl -> bry ) ; for ( bandno = 0 , band = rlvl -> bands ; bandno < rlvl -> numbands ; ++ bandno , ++ band ) { if ( ! band -> data ) { continue ; } jas_eprintf ( " band %5d %5d %5d %5d\n" , jas_seq2d_xstart ( band -> data ) , jas_seq2d_ystart ( band -> data ) , jas_seq2d_xend ( band -> data ) , jas_seq2d_yend ( band -> data ) ) ; for ( prcno = 0 , prc = band -> prcs ; prcno < rlvl -> numprcs ; ++ prcno , ++ prc ) { jas_eprintf ( " prc %5d %5d %5d %5d (%5d %5d)\n" , prc -> tlx , prc -> tly , prc -> brx , prc -> bry , prc -> brx - prc -> tlx , prc -> bry - prc -> tly ) ; if ( ! prc -> cblks ) { continue ; } for ( cblkno = 0 , cblk = prc -> cblks ; cblkno < prc -> numcblks ; ++ cblkno , ++ cblk ) { jas_eprintf ( " cblk %5d %5d %5d %5d\n" , jas_seq2d_xstart ( cblk -> data ) , jas_seq2d_ystart ( cblk -> data ) , jas_seq2d_xend ( cblk -> data ) , jas_seq2d_yend ( cblk -> data ) ) ; } } } } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { AVFrame * frame = data ; const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; ZmbvContext * const c = avctx -> priv_data ; int zret = Z_OK ; int len = buf_size ; int hi_ver , lo_ver , ret ; uint8_t * tmp ; if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return ret ; } c -> flags = buf [ 0 ] ; buf ++ ; len -- ; if ( c -> flags & ZMBV_KEYFRAME ) { hi_ver = buf [ 0 ] ; lo_ver = buf [ 1 ] ; c -> comp = buf [ 2 ] ; c -> fmt = buf [ 3 ] ; c -> bw = buf [ 4 ] ; c -> bh = buf [ 5 ] ; c -> decode_intra = NULL ; c -> decode_xor = NULL ; buf += 6 ; len -= 6 ; av_log ( avctx , AV_LOG_DEBUG , "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n" , c -> flags , hi_ver , lo_ver , c -> comp , c -> fmt , c -> bw , c -> bh ) ; if ( hi_ver != 0 || lo_ver != 1 ) { av_log_ask_for_sample ( avctx , "Unsupported version %i.%i\n" , hi_ver , lo_ver ) ; return AVERROR_PATCHWELCOME ; } if ( c -> bw == 0 || c -> bh == 0 ) { av_log_ask_for_sample ( avctx , "Unsupported block size %ix%i\n" , c -> bw , c -> bh ) ; return AVERROR_PATCHWELCOME ; } if ( c -> comp != 0 && c -> comp != 1 ) { av_log_ask_for_sample ( avctx , "Unsupported compression type %i\n" , c -> comp ) ; return AVERROR_PATCHWELCOME ; } switch ( c -> fmt ) { case ZMBV_FMT_8BPP : c -> bpp = 8 ; c -> decode_intra = zmbv_decode_intra ; c -> decode_xor = zmbv_decode_xor_8 ; break ; case ZMBV_FMT_15BPP : case ZMBV_FMT_16BPP : c -> bpp = 16 ; c -> decode_intra = zmbv_decode_intra ; c -> decode_xor = zmbv_decode_xor_16 ; break ; # ifdef ZMBV_ENABLE_24BPP case ZMBV_FMT_24BPP : c -> bpp = 24 ; c -> decode_intra = zmbv_decode_intra ; c -> decode_xor = zmbv_decode_xor_24 ; break ; # endif case ZMBV_FMT_32BPP : c -> bpp = 32 ; c -> decode_intra = zmbv_decode_intra ; c -> decode_xor = zmbv_decode_xor_32 ; break ; default : c -> decode_intra = NULL ; c -> decode_xor = NULL ; av_log_ask_for_sample ( avctx , "Unsupported (for now) format %i\n" , c -> fmt ) ; return AVERROR_PATCHWELCOME ; } zret = inflateReset ( & c -> zstream ) ; if ( zret != Z_OK ) { av_log ( avctx , AV_LOG_ERROR , "Inflate reset error: %d\n" , zret ) ; return AVERROR_UNKNOWN ; } tmp = av_realloc ( c -> cur , avctx -> width * avctx -> height * ( c -> bpp / 8 ) ) ; if ( ! tmp ) return AVERROR ( ENOMEM ) ; c -> cur = tmp ; tmp = av_realloc ( c -> prev , avctx -> width * avctx -> height * ( c -> bpp / 8 ) ) ; if ( ! tmp ) return AVERROR ( ENOMEM ) ; c -> prev = tmp ; c -> bx = ( c -> width + c -> bw - 1 ) / c -> bw ; c -> by = ( c -> height + c -> bh - 1 ) / c -> bh ; } if ( c -> decode_intra == NULL ) { av_log ( avctx , AV_LOG_ERROR , "Error! Got no format or no keyframe!\n" ) ; return AVERROR_INVALIDDATA ; } if ( c -> comp == 0 ) { memcpy ( c -> decomp_buf , buf , len ) ; c -> decomp_size = 1 ; } else { c -> zstream . total_in = c -> zstream . total_out = 0 ; c -> zstream . next_in = buf ; c -> zstream . avail_in = len ; c -> zstream . next_out = c -> decomp_buf ; c -> zstream . avail_out = c -> decomp_size ; zret = inflate ( & c -> zstream , Z_SYNC_FLUSH ) ; if ( zret != Z_OK && zret != Z_STREAM_END ) { av_log ( avctx , AV_LOG_ERROR , "inflate error %d\n" , zret ) ; return AVERROR_INVALIDDATA ; } c -> decomp_len = c -> zstream . total_out ; } if ( c -> flags & ZMBV_KEYFRAME ) { frame -> key_frame = 1 ; frame -> pict_type = AV_PICTURE_TYPE_I ; c -> decode_intra ( c ) ; } else { frame -> key_frame = 0 ; frame -> pict_type = AV_PICTURE_TYPE_P ; if ( c -> decomp_len ) c -> decode_xor ( c ) ; } { uint8_t * out , * src ; int i , j ; out = frame -> data [ 0 ] ; src = c -> cur ; switch ( c -> fmt ) { case ZMBV_FMT_8BPP : for ( j = 0 ; j < c -> height ; j ++ ) { for ( i = 0 ; i < c -> width ; i ++ ) { out [ i * 3 + 0 ] = c -> pal [ ( * src ) * 3 + 0 ] ; out [ i * 3 + 1 ] = c -> pal [ ( * src ) * 3 + 1 ] ; out [ i * 3 + 2 ] = c -> pal [ ( * src ) * 3 + 2 ] ; src ++ ; } out += frame -> linesize [ 0 ] ; } break ; case ZMBV_FMT_15BPP : for ( j = 0 ; j < c -> height ; j ++ ) { for ( i = 0 ; i < c -> width ; i ++ ) { uint16_t tmp = AV_RL16 ( src ) ; src += 2 ; out [ i * 3 + 0 ] = ( tmp & 0x7C00 ) >> 7 ; out [ i * 3 + 1 ] = ( tmp & 0x03E0 ) >> 2 ; out [ i * 3 + 2 ] = ( tmp & 0x001F ) << 3 ; } out += frame -> linesize [ 0 ] ; } break ; case ZMBV_FMT_16BPP : for ( j = 0 ; j < c -> height ; j ++ ) { for ( i = 0 ; i < c -> width ; i ++ ) { uint16_t tmp = AV_RL16 ( src ) ; src += 2 ; out [ i * 3 + 0 ] = ( tmp & 0xF800 ) >> 8 ; out [ i * 3 + 1 ] = ( tmp & 0x07E0 ) >> 3 ; out [ i * 3 + 2 ] = ( tmp & 0x001F ) << 3 ; } out += frame -> linesize [ 0 ] ; } break ; # ifdef ZMBV_ENABLE_24BPP case ZMBV_FMT_24BPP : for ( j = 0 ; j < c -> height ; j ++ ) { memcpy ( out , src , c -> width * 3 ) ; src += c -> width * 3 ; out += frame -> linesize [ 0 ] ; } break ; # endif case ZMBV_FMT_32BPP : for ( j = 0 ; j < c -> height ; j ++ ) { for ( i = 0 ; i < c -> width ; i ++ ) { uint32_t tmp = AV_RL32 ( src ) ; src += 4 ; AV_WB24 ( out + ( i * 3 ) , tmp ) ; } out += frame -> linesize [ 0 ] ; } break ; default : av_log ( avctx , AV_LOG_ERROR , "Cannot handle format %i\n" , c -> fmt ) ; } FFSWAP ( uint8_t * , c -> cur , c -> prev ) ; } * got_frame = 1 ; return buf_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _slurm_rpc_sib_job_lock ( uint32_t uid , slurm_msg_t * msg ) { int rc ; sib_msg_t * sib_msg = msg -> data ; if ( ! msg -> conn ) { error ( "Security violation, SIB_JOB_LOCK RPC from uid=%d" , uid ) ; slurm_send_rc_msg ( msg , ESLURM_ACCESS_DENIED ) ; return ; } rc = fed_mgr_job_lock_set ( sib_msg -> job_id , sib_msg -> cluster_id ) ; slurm_send_rc_msg ( msg , rc ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_LogicalChannelRateRelease ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_LogicalChannelRateRelease , LogicalChannelRateRelease_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void copy_node_types ( cmap_splay * node , void * arg ) { pdf_cmap * cmap = ( pdf_cmap * ) arg ; if ( node -> many ) { assert ( node -> low == node -> high ) ; cmap -> mranges [ cmap -> mlen ] . low = node -> low ; cmap -> mranges [ cmap -> mlen ] . out = node -> out ; cmap -> mlen ++ ; } else if ( node -> low <= 0xffff && node -> high <= 0xFFFF && node -> out <= 0xFFFF ) { cmap -> ranges [ cmap -> rlen ] . low = node -> low ; cmap -> ranges [ cmap -> rlen ] . high = node -> high ; cmap -> ranges [ cmap -> rlen ] . out = node -> out ; cmap -> rlen ++ ; } else { cmap -> xranges [ cmap -> xlen ] . low = node -> low ; cmap -> xranges [ cmap -> xlen ] . high = node -> high ; cmap -> xranges [ cmap -> xlen ] . out = node -> out ; cmap -> xlen ++ ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
guint16 de_cld_party_bcd_num ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len , gchar * add_string , int string_len ) { const gchar * extr_addr ; de_bcd_num ( tvb , tree , pinfo , offset , len , hf_gsm_a_dtap_cld_party_bcd_num , & extr_addr ) ; if ( extr_addr ) { if ( sccp_assoc && ! sccp_assoc -> called_party ) { sccp_assoc -> called_party = wmem_strdup ( wmem_file_scope ( ) , extr_addr ) ; } if ( add_string ) g_snprintf ( add_string , string_len , " - (%s)" , extr_addr ) ; } return ( len ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( HistoryQuickProviderTest , NonWordLastCharacterMatch ) { std : : string expected_url ( "http://slashdot.org/favorite_page.html" ) ; std : : vector < std : : string > expected_urls ; expected_urls . push_back ( expected_url ) ; RunTest ( ASCIIToUTF16 ( "slashdot.org/" ) , false , expected_urls , true , ASCIIToUTF16 ( "slashdot.org/favorite_page.html" ) , ASCIIToUTF16 ( "favorite_page.html" ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int s390_virtio_net_init ( VirtIOS390Device * dev ) { VirtIODevice * vdev ; vdev = virtio_net_init ( ( DeviceState * ) dev , & dev -> nic ) ; if ( ! vdev ) { return - 1 ; } return s390_virtio_device_init ( dev , vdev ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_rtmpt_http ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) { conversation_t * conv ; rtmpt_conv_t * rconv ; int cdir ; guint32 seq ; guint32 lastackseq ; guint32 offset ; gint remain ; offset = 0 ; remain = tvb_reported_length_remaining ( tvb , 0 ) ; cdir = pinfo -> srcport == pinfo -> match_uint ; if ( cdir ) { conv = find_conversation ( pinfo -> num , & pinfo -> dst , & pinfo -> src , pinfo -> ptype , 0 , pinfo -> srcport , 0 ) ; if ( ! conv ) { RTMPT_DEBUG ( "RTMPT new conversation\n" ) ; conv = conversation_new ( pinfo -> num , & pinfo -> dst , & pinfo -> src , pinfo -> ptype , 0 , pinfo -> srcport , 0 ) ; } } else { conv = find_conversation ( pinfo -> num , & pinfo -> src , & pinfo -> dst , pinfo -> ptype , 0 , pinfo -> destport , 0 ) ; if ( ! conv ) { RTMPT_DEBUG ( "RTMPT new conversation\n" ) ; conv = conversation_new ( pinfo -> num , & pinfo -> src , & pinfo -> dst , pinfo -> ptype , 0 , pinfo -> destport , 0 ) ; } } rconv = ( rtmpt_conv_t * ) conversation_get_proto_data ( conv , proto_rtmpt ) ; if ( ! rconv ) { rconv = rtmpt_init_rconv ( conv ) ; } lastackseq = GPOINTER_TO_INT ( wmem_tree_lookup32_le ( rconv -> seqs [ cdir ^ 1 ] , pinfo -> num ) ) + 1 ; if ( cdir == 1 && lastackseq < 2 && remain == 17 ) { offset += 17 ; remain -= 17 ; } else if ( cdir || remain == 1 ) { offset ++ ; remain -- ; } seq = GPOINTER_TO_INT ( wmem_tree_lookup32 ( rconv -> seqs [ cdir ] , pinfo -> num ) ) ; if ( seq == 0 ) { seq = GPOINTER_TO_INT ( wmem_tree_lookup32_le ( rconv -> seqs [ cdir ] , pinfo -> num ) ) ; seq += remain ; wmem_tree_insert32 ( rconv -> seqs [ cdir ] , pinfo -> num , GINT_TO_POINTER ( seq ) ) ; } seq -= remain - 1 ; RTMPT_DEBUG ( "RTMPT f=%d cdir=%d seq=%d lastackseq=%d len=%d\n" , pinfo -> num , cdir , seq , lastackseq , remain ) ; if ( remain < 1 ) return offset ; if ( offset > 0 ) { tvbuff_t * tvbrtmp = tvb_new_subset_length ( tvb , offset , remain ) ; dissect_rtmpt_common ( tvbrtmp , pinfo , tree , rconv , cdir , seq , lastackseq ) ; } else { dissect_rtmpt_common ( tvb , pinfo , tree , rconv , cdir , seq , lastackseq ) ; } return tvb_captured_length ( tvb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void xps_begin_opacity ( xps_document * doc , const fz_matrix * ctm , const fz_rect * area , char * base_uri , xps_resource * dict , char * opacity_att , fz_xml * opacity_mask_tag ) { float opacity ; if ( ! opacity_att && ! opacity_mask_tag ) return ; opacity = 1 ; if ( opacity_att ) opacity = fz_atof ( opacity_att ) ; if ( opacity_mask_tag && ! strcmp ( fz_xml_tag ( opacity_mask_tag ) , "SolidColorBrush" ) ) { char * scb_opacity_att = fz_xml_att ( opacity_mask_tag , "Opacity" ) ; char * scb_color_att = fz_xml_att ( opacity_mask_tag , "Color" ) ; if ( scb_opacity_att ) opacity = opacity * fz_atof ( scb_opacity_att ) ; if ( scb_color_att ) { fz_colorspace * colorspace ; float samples [ FZ_MAX_COLORS ] ; xps_parse_color ( doc , base_uri , scb_color_att , & colorspace , samples ) ; opacity = opacity * samples [ 0 ] ; } opacity_mask_tag = NULL ; } if ( doc -> opacity_top + 1 < nelem ( doc -> opacity ) ) { doc -> opacity [ doc -> opacity_top + 1 ] = doc -> opacity [ doc -> opacity_top ] * opacity ; doc -> opacity_top ++ ; } if ( opacity_mask_tag ) { fz_begin_mask ( doc -> dev , area , 0 , NULL , NULL ) ; xps_parse_brush ( doc , ctm , area , base_uri , dict , opacity_mask_tag ) ; fz_end_mask ( doc -> dev ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ProtocolHandlerRegistryTest , IgnoreProtocolHandler ) { registry ( ) -> OnIgnoreRegisterProtocolHandler ( test_protocol_handler ( ) ) ; ASSERT_TRUE ( registry ( ) -> IsIgnored ( test_protocol_handler ( ) ) ) ; registry ( ) -> RemoveIgnoredHandler ( test_protocol_handler ( ) ) ; ASSERT_FALSE ( registry ( ) -> IsIgnored ( test_protocol_handler ( ) ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gpgme_error_t uiserver_decrypt ( void * engine , gpgme_data_t ciph , gpgme_data_t plain ) { return _uiserver_decrypt ( engine , 0 , ciph , plain ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void pdf_tos_reset ( fz_context * ctx , pdf_text_object_state * tos , int render ) { tos -> text = fz_new_text ( ctx ) ; tos -> text_mode = render ; tos -> text_bbox = fz_empty_rect ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_notify_options_flags ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) { guint32 flags ; static const int * hf_flags [ ] = { & hf_notify_options_flags_refresh , NULL } ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , - 1 , & flags ) ; proto_tree_add_bitmask_value_with_flags ( tree , tvb , offset - 4 , hf_notify_options_flags , ett_notify_options_flags , hf_flags , flags , BMT_NO_APPEND ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int RTP_packet ( void * ptr _U_ , packet_info * pinfo , epan_dissect_t * edt _U_ , void const * RTPinfo ) { voip_rtp_tapinfo_t * tapinfo = & the_tapinfo_rtp_struct ; voip_rtp_stream_info_t * tmp_listinfo ; voip_rtp_stream_info_t * strinfo = NULL ; GList * list ; struct _rtp_conversation_info * p_conv_data = NULL ; const struct _rtp_info * pi = ( const struct _rtp_info * ) RTPinfo ; if ( pi -> info_setup_frame_num == 0 ) { return 0 ; } # ifdef HAVE_LIBPORTAUDIO add_rtp_packet ( pi , pinfo ) ; # endif list = g_list_first ( tapinfo -> list ) ; while ( list ) { tmp_listinfo = ( voip_rtp_stream_info_t * ) list -> data ; if ( ( tmp_listinfo -> setup_frame_number == pi -> info_setup_frame_num ) && ( tmp_listinfo -> ssrc == pi -> info_sync_src ) && ( tmp_listinfo -> end_stream == FALSE ) ) { if ( tmp_listinfo -> pt != pi -> info_payload_type ) { tmp_listinfo -> end_stream = TRUE ; } else { strinfo = ( voip_rtp_stream_info_t * ) ( list -> data ) ; break ; } } list = g_list_next ( list ) ; } if ( ( rtp_evt_frame_num == pinfo -> fd -> num ) && ! strinfo && ( rtp_evt_end == TRUE ) ) { return 0 ; } if ( strinfo == NULL ) { strinfo = ( voip_rtp_stream_info_t * ) g_malloc ( sizeof ( voip_rtp_stream_info_t ) ) ; COPY_ADDRESS ( & ( strinfo -> src_addr ) , & ( pinfo -> src ) ) ; strinfo -> src_port = pinfo -> srcport ; COPY_ADDRESS ( & ( strinfo -> dest_addr ) , & ( pinfo -> dst ) ) ; strinfo -> dest_port = pinfo -> destport ; strinfo -> ssrc = pi -> info_sync_src ; strinfo -> end_stream = FALSE ; strinfo -> pt = pi -> info_payload_type ; strinfo -> pt_str = NULL ; strinfo -> is_srtp = pi -> info_is_srtp ; if ( ( strinfo -> pt >= PT_UNDF_96 ) && ( strinfo -> pt <= PT_UNDF_127 ) ) { p_conv_data = ( struct _rtp_conversation_info * ) p_get_proto_data ( wmem_file_scope ( ) , pinfo , proto_get_id_by_filter_name ( "rtp" ) , 0 ) ; if ( p_conv_data && p_conv_data -> rtp_dyn_payload ) { const gchar * encoding_name = rtp_dyn_payload_get_name ( p_conv_data -> rtp_dyn_payload , strinfo -> pt ) ; if ( encoding_name ) { strinfo -> pt_str = g_strdup ( encoding_name ) ; } } } if ( ! strinfo -> pt_str ) strinfo -> pt_str = g_strdup ( val_to_str_ext ( strinfo -> pt , & rtp_payload_type_short_vals_ext , "%u" ) ) ; strinfo -> npackets = 0 ; strinfo -> start_fd = pinfo -> fd ; strinfo -> start_rel_ts = pinfo -> rel_ts ; strinfo -> setup_frame_number = pi -> info_setup_frame_num ; strinfo -> rtp_event = - 1 ; tapinfo -> list = g_list_prepend ( tapinfo -> list , strinfo ) ; } strinfo -> npackets ++ ; strinfo -> stop_fd = pinfo -> fd ; strinfo -> stop_rel_ts = pinfo -> rel_ts ; if ( rtp_evt_frame_num == pinfo -> fd -> num ) { strinfo -> rtp_event = rtp_evt ; if ( rtp_evt_end == TRUE ) { strinfo -> end_stream = TRUE ; } } the_tapinfo_struct . redraw = TRUE ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( AppApiTest , MAYBE_ReloadAppAfterCrash ) { extensions : : ProcessMap * process_map = extensions : : ProcessMap : : Get ( browser ( ) -> profile ( ) ) ; ASSERT_TRUE ( LoadExtension ( test_data_dir_ . AppendASCII ( "app_process" ) ) ) ; GURL base_url = GetTestBaseURL ( "app_process" ) ; ui_test_utils : : NavigateToURL ( browser ( ) , base_url . Resolve ( "path1/empty.html" ) ) ; WebContents * contents = browser ( ) -> tab_strip_model ( ) -> GetWebContentsAt ( 0 ) ; EXPECT_TRUE ( process_map -> Contains ( contents -> GetRenderProcessHost ( ) -> GetID ( ) ) ) ; bool is_installed = false ; ASSERT_TRUE ( content : : ExecuteScriptAndExtractBool ( contents , "window.domAutomationController.send(chrome.app.isInstalled)" , & is_installed ) ) ; ASSERT_TRUE ( is_installed ) ; content : : CrashTab ( browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) ) ; content : : WindowedNotificationObserver observer ( content : : NOTIFICATION_LOAD_STOP , content : : Source < NavigationController > ( & browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) -> GetController ( ) ) ) ; chrome : : Reload ( browser ( ) , WindowOpenDisposition : : CURRENT_TAB ) ; observer . Wait ( ) ; ASSERT_TRUE ( content : : ExecuteScriptAndExtractBool ( contents , "window.domAutomationController.send(chrome.app.isInstalled)" , & is_installed ) ) ; ASSERT_TRUE ( is_installed ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean should_skip_file ( NautilusDirectory * directory , GFileInfo * info ) { static gboolean show_hidden_files_changed_callback_installed = FALSE ; if ( ! show_hidden_files_changed_callback_installed ) { g_signal_connect_swapped ( gtk_filechooser_preferences , "changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES , G_CALLBACK ( show_hidden_files_changed_callback ) , NULL ) ; show_hidden_files_changed_callback_installed = TRUE ; show_hidden_files_changed_callback ( NULL ) ; } if ( ! show_hidden_files && ( g_file_info_get_is_hidden ( info ) || g_file_info_get_is_backup ( info ) ) ) { return TRUE ; } return FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
long ssl3_get_message ( SSL * s , int st1 , int stn , int mt , long max , int * ok ) { unsigned char * p ; unsigned long l ; long n ; int i , al ; if ( s -> s3 -> tmp . reuse_message ) { s -> s3 -> tmp . reuse_message = 0 ; if ( ( mt >= 0 ) && ( s -> s3 -> tmp . message_type != mt ) ) { al = SSL_AD_UNEXPECTED_MESSAGE ; SSLerr ( SSL_F_SSL3_GET_MESSAGE , SSL_R_UNEXPECTED_MESSAGE ) ; goto f_err ; } * ok = 1 ; s -> init_msg = s -> init_buf -> data + 4 ; s -> init_num = ( int ) s -> s3 -> tmp . message_size ; return s -> init_num ; } p = ( unsigned char * ) s -> init_buf -> data ; if ( s -> state == st1 ) { int skip_message ; do { while ( s -> init_num < 4 ) { i = s -> method -> ssl_read_bytes ( s , SSL3_RT_HANDSHAKE , & p [ s -> init_num ] , 4 - s -> init_num , 0 ) ; if ( i <= 0 ) { s -> rwstate = SSL_READING ; * ok = 0 ; return i ; } s -> init_num += i ; } skip_message = 0 ; if ( ! s -> server ) if ( p [ 0 ] == SSL3_MT_HELLO_REQUEST ) if ( p [ 1 ] == 0 && p [ 2 ] == 0 && p [ 3 ] == 0 ) { s -> init_num = 0 ; skip_message = 1 ; if ( s -> msg_callback ) s -> msg_callback ( 0 , s -> version , SSL3_RT_HANDSHAKE , p , 4 , s , s -> msg_callback_arg ) ; } } while ( skip_message ) ; if ( ( mt >= 0 ) && ( * p != mt ) ) { al = SSL_AD_UNEXPECTED_MESSAGE ; SSLerr ( SSL_F_SSL3_GET_MESSAGE , SSL_R_UNEXPECTED_MESSAGE ) ; goto f_err ; } if ( ( mt < 0 ) && ( * p == SSL3_MT_CLIENT_HELLO ) && ( st1 == SSL3_ST_SR_CERT_A ) && ( stn == SSL3_ST_SR_CERT_B ) ) { ssl3_init_finished_mac ( s ) ; } s -> s3 -> tmp . message_type = * ( p ++ ) ; n2l3 ( p , l ) ; if ( l > ( unsigned long ) max ) { al = SSL_AD_ILLEGAL_PARAMETER ; SSLerr ( SSL_F_SSL3_GET_MESSAGE , SSL_R_EXCESSIVE_MESSAGE_SIZE ) ; goto f_err ; } if ( l > ( INT_MAX - 4 ) ) { al = SSL_AD_ILLEGAL_PARAMETER ; SSLerr ( SSL_F_SSL3_GET_MESSAGE , SSL_R_EXCESSIVE_MESSAGE_SIZE ) ; goto f_err ; } if ( l && ! BUF_MEM_grow_clean ( s -> init_buf , ( int ) l + 4 ) ) { SSLerr ( SSL_F_SSL3_GET_MESSAGE , ERR_R_BUF_LIB ) ; goto err ; } s -> s3 -> tmp . message_size = l ; s -> state = stn ; s -> init_msg = s -> init_buf -> data + 4 ; s -> init_num = 0 ; } p = s -> init_msg ; n = s -> s3 -> tmp . message_size - s -> init_num ; while ( n > 0 ) { i = s -> method -> ssl_read_bytes ( s , SSL3_RT_HANDSHAKE , & p [ s -> init_num ] , n , 0 ) ; if ( i <= 0 ) { s -> rwstate = SSL_READING ; * ok = 0 ; return i ; } s -> init_num += i ; n -= i ; } # ifndef OPENSSL_NO_NEXTPROTONEG if ( * s -> init_buf -> data == SSL3_MT_FINISHED ) ssl3_take_mac ( s ) ; # endif ssl3_finish_mac ( s , ( unsigned char * ) s -> init_buf -> data , s -> init_num + 4 ) ; if ( s -> msg_callback ) s -> msg_callback ( 0 , s -> version , SSL3_RT_HANDSHAKE , s -> init_buf -> data , ( size_t ) s -> init_num + 4 , s , s -> msg_callback_arg ) ; * ok = 1 ; return s -> init_num ; f_err : ssl3_send_alert ( s , SSL3_AL_FATAL , al ) ; err : * ok = 0 ; return ( - 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
GType hb_gobject_ ## name ## _get_type ( void ) \ { static gsize type_id = 0 ; if ( g_once_init_enter ( & type_id ) ) { GType id = g_boxed_type_register_static ( g_intern_static_string ( "hb_" # name "_t" ) , ( GBoxedCopyFunc ) copy_func , ( GBoxedFreeFunc ) free_func ) ; g_once_init_leave ( & type_id , id ) ; } return type_id ; \ } # define HB_DEFINE_OBJECT_TYPE ( name ) HB_DEFINE_BOXED_TYPE ( name , hb_ ## name ## _reference , hb_ ## name ## _destroy ) ; HB_DEFINE_OBJECT_TYPE ( buffer )
1True
Categorize the following code snippet as vulnerable or not. True or False
static int nsv_read_packet ( AVFormatContext * s , AVPacket * pkt ) { NSVContext * nsv = s -> priv_data ; int i , err = 0 ; if ( ! nsv -> ahead [ 0 ] . data && ! nsv -> ahead [ 1 ] . data ) err = nsv_read_chunk ( s , 0 ) ; if ( err < 0 ) return err ; for ( i = 0 ; i < 2 ; i ++ ) { if ( nsv -> ahead [ i ] . data ) { memcpy ( pkt , & nsv -> ahead [ i ] , sizeof ( AVPacket ) ) ; nsv -> ahead [ i ] . data = NULL ; return pkt -> size ; } } return - 1 ; }
0False