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 int pxa2xx_clkcfg_write ( CPUARMState * env , const ARMCPRegInfo * ri , uint64_t value ) { PXA2xxState * s = ( PXA2xxState * ) ri -> opaque ; s -> clkcfg = value & 0xf ; if ( value & 2 ) { printf ( "%s: CPU frequency change attempt\n" , __func__ ) ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int test_file_size ( const char * file , xoff_t * size ) { struct stat sbuf ; int ret ; ( * size ) = 0 ; if ( stat ( file , & sbuf ) < 0 ) { ret = get_errno ( ) ; XPR ( NT "stat failed: %s: %s\n" , file , strerror ( ret ) ) ; return ret ; } if ( ! S_ISREG ( sbuf . st_mode ) ) { ret = XD3_INTERNAL ; XPR ( NT "not a regular file: %s: %s\n" , file , strerror ( ret ) ) ; return ret ; } ( * size ) = sbuf . st_size ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint16 de_allowed_act ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) { guint32 curr_offset ; curr_offset = offset ; proto_tree_add_item ( tree , hf_gsm_a_dtap_ccbs_activation , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_bits_item ( tree , hf_gsm_a_spare_bits , tvb , ( curr_offset << 3 ) + 1 , 7 , ENC_BIG_ENDIAN ) ; curr_offset ++ ; EXTRANEOUS_DATA_CHECK ( len , curr_offset - offset , pinfo , & ei_gsm_a_dtap_extraneous_data ) ; return ( len ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int replace_table_table ( THD * thd , GRANT_TABLE * grant_table , TABLE * table , const LEX_USER & combo , const char * db , const char * table_name , ulong rights , ulong col_rights , bool revoke_grant ) { char grantor [ USER_HOST_BUFF_SIZE ] ; int old_row_exists = 1 ; int error = 0 ; ulong store_table_rights , store_col_rights ; uchar user_key [ MAX_KEY_LENGTH ] ; DBUG_ENTER ( "replace_table_table" ) ; get_grantor ( thd , grantor ) ; if ( ! find_acl_user ( combo . host . str , combo . user . str , FALSE ) ) { my_message ( ER_PASSWORD_NO_MATCH , ER ( ER_PASSWORD_NO_MATCH ) , MYF ( 0 ) ) ; DBUG_RETURN ( - 1 ) ; } table -> use_all_columns ( ) ; restore_record ( table , s -> default_values ) ; table -> field [ 0 ] -> store ( combo . host . str , combo . host . length , system_charset_info ) ; table -> field [ 1 ] -> store ( db , ( uint ) strlen ( db ) , system_charset_info ) ; table -> field [ 2 ] -> store ( combo . user . str , combo . user . length , system_charset_info ) ; table -> field [ 3 ] -> store ( table_name , ( uint ) strlen ( table_name ) , system_charset_info ) ; store_record ( table , record [ 1 ] ) ; key_copy ( user_key , table -> record [ 0 ] , table -> key_info , table -> key_info -> key_length ) ; if ( table -> file -> index_read_idx_map ( table -> record [ 0 ] , 0 , user_key , HA_WHOLE_KEY , HA_READ_KEY_EXACT ) ) { if ( revoke_grant ) { my_error ( ER_NONEXISTING_TABLE_GRANT , MYF ( 0 ) , combo . user . str , combo . host . str , table_name ) ; DBUG_RETURN ( - 1 ) ; } old_row_exists = 0 ; restore_record ( table , record [ 1 ] ) ; } store_table_rights = get_rights_for_table ( rights ) ; store_col_rights = get_rights_for_column ( col_rights ) ; if ( old_row_exists ) { ulong j , k ; store_record ( table , record [ 1 ] ) ; j = ( ulong ) table -> field [ 6 ] -> val_int ( ) ; k = ( ulong ) table -> field [ 7 ] -> val_int ( ) ; if ( revoke_grant ) { store_table_rights = j & ~ store_table_rights ; } else { store_table_rights |= j ; store_col_rights |= k ; } } table -> field [ 4 ] -> store ( grantor , ( uint ) strlen ( grantor ) , system_charset_info ) ; table -> field [ 6 ] -> store ( ( longlong ) store_table_rights , TRUE ) ; table -> field [ 7 ] -> store ( ( longlong ) store_col_rights , TRUE ) ; rights = fix_rights_for_table ( store_table_rights ) ; col_rights = fix_rights_for_column ( store_col_rights ) ; if ( old_row_exists ) { if ( store_table_rights || store_col_rights ) { if ( ( error = table -> file -> ha_update_row ( table -> record [ 1 ] , table -> record [ 0 ] ) ) && error != HA_ERR_RECORD_IS_THE_SAME ) goto table_error ; } else if ( ( error = table -> file -> ha_delete_row ( table -> record [ 1 ] ) ) ) goto table_error ; } else { error = table -> file -> ha_write_row ( table -> record [ 0 ] ) ; if ( table -> file -> is_fatal_error ( error , HA_CHECK_DUP_KEY ) ) goto table_error ; } if ( rights | col_rights ) { grant_table -> privs = rights ; grant_table -> cols = col_rights ; } else { hash_delete ( & column_priv_hash , ( uchar * ) grant_table ) ; } DBUG_RETURN ( 0 ) ; table_error : table -> file -> print_error ( error , MYF ( 0 ) ) ; DBUG_RETURN ( - 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void path_table_add_entry ( struct path_table * pathtbl , struct isoent * ent ) { ent -> ptnext = NULL ; * pathtbl -> last = ent ; pathtbl -> last = & ( ent -> ptnext ) ; pathtbl -> cnt ++ ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_TerminalCapabilitySetRejectCause ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_TerminalCapabilitySetRejectCause , TerminalCapabilitySetRejectCause_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void set_num_712 ( unsigned char * p , char value ) { * ( ( char * ) p ) = value ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
gboolean nautilus_directory_is_anyone_monitoring_file_list ( NautilusDirectory * directory ) { if ( directory -> details -> call_when_ready_counters [ REQUEST_FILE_LIST ] > 0 ) { return TRUE ; } if ( directory -> details -> monitor_counters [ REQUEST_FILE_LIST ] > 0 ) { return TRUE ; } return FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void SetPixelAlpha ( const Image * restrict image , const Quantum alpha , Quantum * restrict pixel ) { if ( image -> channel_map [ AlphaPixelChannel ] . traits != UndefinedPixelTrait ) pixel [ image -> channel_map [ AlphaPixelChannel ] . offset ] = alpha ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_MultilinkResponse ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_MultilinkResponse , MultilinkResponse_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static OffsetHashTable new_offset_hash_table ( void ) { struct off_item * * tbl ; tbl = xmalloc_clear ( 2048 * sizeof * tbl ) ; return tbl ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
vpx_codec_err_t vpx_svc_encode ( SvcContext * svc_ctx , vpx_codec_ctx_t * codec_ctx , struct vpx_image * rawimg , vpx_codec_pts_t pts , int64_t duration , int deadline ) { vpx_codec_err_t res ; vpx_codec_iter_t iter ; const vpx_codec_cx_pkt_t * cx_pkt ; int layer_for_psnr = 0 ; SvcInternal * const si = get_svc_internal ( svc_ctx ) ; if ( svc_ctx == NULL || codec_ctx == NULL || si == NULL ) { return VPX_CODEC_INVALID_PARAM ; } svc_log_reset ( svc_ctx ) ; si -> rc_stats_buf_used = 0 ; si -> layers = svc_ctx -> spatial_layers ; if ( si -> encode_frame_count == 0 ) { si -> frame_within_gop = 0 ; } si -> is_keyframe = ( si -> frame_within_gop == 0 ) ; if ( rawimg != NULL ) { svc_log ( svc_ctx , SVC_LOG_DEBUG , "vpx_svc_encode layers: %d, frame_count: %d, " "frame_within_gop: %d\n" , si -> layers , si -> encode_frame_count , si -> frame_within_gop ) ; } if ( rawimg != NULL ) { for ( si -> layer = 0 ; si -> layer < si -> layers ; ++ si -> layer ) { set_svc_parameters ( svc_ctx , codec_ctx ) ; } } res = vpx_codec_encode ( codec_ctx , rawimg , pts , ( uint32_t ) duration , 0 , deadline ) ; if ( res != VPX_CODEC_OK ) { return res ; } iter = NULL ; while ( ( cx_pkt = vpx_codec_get_cx_data ( codec_ctx , & iter ) ) ) { switch ( cx_pkt -> kind ) { case VPX_CODEC_CX_FRAME_PKT : { fd_list_add ( & si -> frame_list , fd_create ( cx_pkt -> data . frame . buf , cx_pkt -> data . frame . sz , cx_pkt -> data . frame . flags ) ) ; svc_log ( svc_ctx , SVC_LOG_DEBUG , "SVC frame: %d, kf: %d, size: %d, " "pts: %d\n" , si -> frame_received , ( cx_pkt -> data . frame . flags & VPX_FRAME_IS_KEY ) ? 1 : 0 , ( int ) cx_pkt -> data . frame . sz , ( int ) cx_pkt -> data . frame . pts ) ; ++ si -> frame_received ; layer_for_psnr = 0 ; break ; } case VPX_CODEC_PSNR_PKT : { int i ; svc_log ( svc_ctx , SVC_LOG_DEBUG , "SVC frame: %d, layer: %d, PSNR(Total/Y/U/V): " "%2.3f %2.3f %2.3f %2.3f \n" , si -> frame_received , layer_for_psnr , cx_pkt -> data . psnr . psnr [ 0 ] , cx_pkt -> data . psnr . psnr [ 1 ] , cx_pkt -> data . psnr . psnr [ 2 ] , cx_pkt -> data . psnr . psnr [ 3 ] ) ; svc_log ( svc_ctx , SVC_LOG_DEBUG , "SVC frame: %d, layer: %d, SSE(Total/Y/U/V): " "%2.3f %2.3f %2.3f %2.3f \n" , si -> frame_received , layer_for_psnr , cx_pkt -> data . psnr . sse [ 0 ] , cx_pkt -> data . psnr . sse [ 1 ] , cx_pkt -> data . psnr . sse [ 2 ] , cx_pkt -> data . psnr . sse [ 3 ] ) ; for ( i = 0 ; i < COMPONENTS ; i ++ ) { si -> psnr_sum [ layer_for_psnr ] [ i ] += cx_pkt -> data . psnr . psnr [ i ] ; si -> sse_sum [ layer_for_psnr ] [ i ] += cx_pkt -> data . psnr . sse [ i ] ; } ++ layer_for_psnr ; break ; } case VPX_CODEC_STATS_PKT : { size_t new_size = si -> rc_stats_buf_used + cx_pkt -> data . twopass_stats . sz ; if ( new_size > si -> rc_stats_buf_size ) { char * p = ( char * ) realloc ( si -> rc_stats_buf , new_size ) ; if ( p == NULL ) { svc_log ( svc_ctx , SVC_LOG_ERROR , "Error allocating stats buf\n" ) ; return VPX_CODEC_MEM_ERROR ; } si -> rc_stats_buf = p ; si -> rc_stats_buf_size = new_size ; } memcpy ( si -> rc_stats_buf + si -> rc_stats_buf_used , cx_pkt -> data . twopass_stats . buf , cx_pkt -> data . twopass_stats . sz ) ; si -> rc_stats_buf_used += cx_pkt -> data . twopass_stats . sz ; break ; } # if CONFIG_SPATIAL_SVC case VPX_CODEC_SPATIAL_SVC_LAYER_SIZES : { int i ; for ( i = 0 ; i < si -> layers ; ++ i ) si -> bytes_sum [ i ] += cx_pkt -> data . layer_sizes [ i ] ; break ; } # endif default : { break ; } } } if ( rawimg != NULL ) { ++ si -> frame_within_gop ; ++ si -> encode_frame_count ; } return VPX_CODEC_OK ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int qemuMonitorJSONGetMigrationStatusReply ( virJSONValuePtr reply , int * status , unsigned long long * transferred , unsigned long long * remaining , unsigned long long * total ) { virJSONValuePtr ret ; const char * statusstr ; unsigned long long t ; if ( ! ( ret = virJSONValueObjectGet ( reply , "return" ) ) ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "info migration reply was missing return data" ) ) ; return - 1 ; } if ( ! ( statusstr = virJSONValueObjectGetString ( ret , "status" ) ) ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "info migration reply was missing return status" ) ) ; return - 1 ; } if ( ( * status = qemuMonitorMigrationStatusTypeFromString ( statusstr ) ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , _ ( "unexpected migration status in %s" ) , statusstr ) ; return - 1 ; } if ( * status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE ) { virJSONValuePtr ram = virJSONValueObjectGet ( ret , "ram" ) ; if ( ! ram ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "migration was active, but no RAM info was set" ) ) ; return - 1 ; } if ( virJSONValueObjectGetNumberUlong ( ram , "transferred" , transferred ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "migration was active, but RAM 'transferred' " "data was missing" ) ) ; return - 1 ; } if ( virJSONValueObjectGetNumberUlong ( ram , "remaining" , remaining ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "migration was active, but RAM 'remaining' " "data was missing" ) ) ; return - 1 ; } if ( virJSONValueObjectGetNumberUlong ( ram , "total" , total ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "migration was active, but RAM 'total' " "data was missing" ) ) ; return - 1 ; } virJSONValuePtr disk = virJSONValueObjectGet ( ret , "disk" ) ; if ( ! disk ) { return 0 ; } if ( virJSONValueObjectGetNumberUlong ( disk , "transferred" , & t ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "disk migration was active, but 'transferred' " "data was missing" ) ) ; return - 1 ; } * transferred += t ; if ( virJSONValueObjectGetNumberUlong ( disk , "remaining" , & t ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "disk migration was active, but 'remaining' " "data was missing" ) ) ; return - 1 ; } * remaining += t ; if ( virJSONValueObjectGetNumberUlong ( disk , "total" , & t ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "disk migration was active, but 'total' " "data was missing" ) ) ; return - 1 ; } * total += t ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
unsigned int vp9_variance ## W ## x ## H ## _c ( const uint8_t * a , int a_stride , const uint8_t * b , int b_stride , unsigned int * sse ) { int sum ; variance ( a , a_stride , b , b_stride , W , H , sse , & sum ) ; return * sse - ( ( ( int64_t ) sum * sum ) / ( W * H ) ) ; \ } # define SUBPIX_VAR ( W , H ) unsigned int vp9_sub_pixel_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse ) { uint16_t fdata3 [ ( H + 1 ) * W ] ; uint8_t temp2 [ H * W ] ; var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ; var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ; return vp9_variance ## W ## x ## H ## _c ( temp2 , W , dst , dst_stride , sse ) ; \ } # define SUBPIX_AVG_VAR ( W , H ) unsigned int vp9_sub_pixel_avg_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse , const uint8_t * second_pred ) { uint16_t fdata3 [ ( H + 1 ) * W ] ; uint8_t temp2 [ H * W ] ; DECLARE_ALIGNED_ARRAY ( 16 , uint8_t , temp3 , H * W ) ; var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ; var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ; vp9_comp_avg_pred ( temp3 , second_pred , W , H , temp2 , W ) ; return vp9_variance ## W ## x ## H ## _c ( temp3 , W , dst , dst_stride , sse ) ; \ } void vp9_get16x16var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) { variance ( src_ptr , source_stride , ref_ptr , ref_stride , 16 , 16 , sse , sum ) ; } void vp9_get8x8var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) { variance ( src_ptr , source_stride , ref_ptr , ref_stride , 8 , 8 , sse , sum ) ; } unsigned int vp9_mse16x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) { int sum ; variance ( src , src_stride , ref , ref_stride , 16 , 16 , sse , & sum ) ; return * sse ; } unsigned int vp9_mse16x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) { int sum ; variance ( src , src_stride , ref , ref_stride , 16 , 8 , sse , & sum ) ; return * sse ; } unsigned int vp9_mse8x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) { int sum ; variance ( src , src_stride , ref , ref_stride , 8 , 16 , sse , & sum ) ; return * sse ; } unsigned int vp9_mse8x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) { int sum ; variance ( src , src_stride , ref , ref_stride , 8 , 8 , sse , & sum ) ; return * sse ; } VAR ( 4 , 4 ) SUBPIX_VAR ( 4 , 4 ) SUBPIX_AVG_VAR ( 4 , 4 ) VAR ( 4 , 8 ) SUBPIX_VAR ( 4 , 8 ) SUBPIX_AVG_VAR ( 4 , 8 ) VAR ( 8 , 4 ) SUBPIX_VAR ( 8 , 4 ) SUBPIX_AVG_VAR ( 8 , 4 ) VAR ( 8 , 8 ) SUBPIX_VAR ( 8 , 8 ) SUBPIX_AVG_VAR ( 8 , 8 ) VAR ( 8 , 16 ) SUBPIX_VAR ( 8 , 16 ) SUBPIX_AVG_VAR ( 8 , 16 ) VAR ( 16 , 8 ) SUBPIX_VAR ( 16 , 8 ) SUBPIX_AVG_VAR ( 16 , 8 ) VAR ( 16 , 16 ) SUBPIX_VAR ( 16 , 16 ) SUBPIX_AVG_VAR ( 16 , 16 ) VAR ( 16 , 32 ) SUBPIX_VAR ( 16 , 32 ) SUBPIX_AVG_VAR ( 16 , 32 ) VAR ( 32 , 16 )
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pxa2xx_rtc_hzupdate ( PXA2xxRTCState * s ) { int64_t rt = qemu_get_clock_ms ( rtc_clock ) ; s -> last_rcnr += ( ( rt - s -> last_hz ) << 15 ) / ( 1000 * ( ( s -> rttr & 0xffff ) + 1 ) ) ; s -> last_rdcr += ( ( rt - s -> last_hz ) << 15 ) / ( 1000 * ( ( s -> rttr & 0xffff ) + 1 ) ) ; s -> last_hz = rt ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void cpu_io_recompile ( CPUArchState * env , uintptr_t retaddr ) { TranslationBlock * tb ; uint32_t n , cflags ; target_ulong pc , cs_base ; uint64_t flags ; tb = tb_find_pc ( retaddr ) ; if ( ! tb ) { cpu_abort ( env , "cpu_io_recompile: could not find TB for pc=%p" , ( void * ) retaddr ) ; } n = env -> icount_decr . u16 . low + tb -> icount ; cpu_restore_state_from_tb ( tb , env , retaddr ) ; n = n - env -> icount_decr . u16 . low ; n ++ ; # if defined ( TARGET_MIPS ) if ( ( env -> hflags & MIPS_HFLAG_BMASK ) != 0 && n > 1 ) { env -> active_tc . PC -= 4 ; env -> icount_decr . u16 . low ++ ; env -> hflags &= ~ MIPS_HFLAG_BMASK ; } # elif defined ( TARGET_SH4 ) if ( ( env -> flags & ( ( DELAY_SLOT | DELAY_SLOT_CONDITIONAL ) ) ) != 0 && n > 1 ) { env -> pc -= 2 ; env -> icount_decr . u16 . low ++ ; env -> flags &= ~ ( DELAY_SLOT | DELAY_SLOT_CONDITIONAL ) ; } # endif if ( n > CF_COUNT_MASK ) { cpu_abort ( env , "TB too big during recompile" ) ; } cflags = n | CF_LAST_IO ; pc = tb -> pc ; cs_base = tb -> cs_base ; flags = tb -> flags ; tb_phys_invalidate ( tb , - 1 ) ; tb_gen_code ( env , pc , cs_base , flags , cflags ) ; cpu_resume_from_signal ( env , NULL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int com_use ( String * buffer __attribute__ ( ( unused ) ) , char * line ) { char * tmp , buff [ FN_REFLEN + 1 ] ; int select_db ; bzero ( buff , sizeof ( buff ) ) ; strmake_buf ( buff , line ) ; tmp = get_arg ( buff , GET ) ; if ( ! tmp || ! * tmp ) { put_info ( "USE must be followed by a database name" , INFO_ERROR ) ; return 0 ; } get_current_db ( ) ; if ( ! current_db || cmp_database ( charset_info , current_db , tmp ) ) { if ( one_database ) { skip_updates = 1 ; select_db = 0 ; } else select_db = 2 ; } else { skip_updates = 0 ; select_db = 1 ; } if ( select_db ) { if ( ! connected && reconnect ( ) ) return opt_reconnect ? - 1 : 1 ; if ( mysql_select_db ( & mysql , tmp ) ) { if ( mysql_errno ( & mysql ) != CR_SERVER_GONE_ERROR ) return put_error ( & mysql ) ; if ( reconnect ( ) ) return opt_reconnect ? - 1 : 1 ; if ( mysql_select_db ( & mysql , tmp ) ) return put_error ( & mysql ) ; } my_free ( current_db ) ; current_db = my_strdup ( tmp , MYF ( MY_WME ) ) ; # ifdef HAVE_READLINE if ( select_db > 1 ) build_completion_hash ( opt_rehash , 1 ) ; # endif } put_info ( "Database changed" , INFO_INFO ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void * jbig2_default_alloc ( Jbig2Allocator * allocator , size_t size ) { return malloc ( size ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_IpV4 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_octet_string ( tvb , offset , actx , tree , hf_index , 4 , 4 , FALSE , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
bool check_grant_routine ( THD * thd , ulong want_access , TABLE_LIST * procs , bool is_proc , bool no_errors ) { TABLE_LIST * table ; Security_context * sctx = thd -> security_ctx ; char * user = sctx -> priv_user ; char * host = sctx -> priv_host ; DBUG_ENTER ( "check_grant_routine" ) ; want_access &= ~ sctx -> master_access ; if ( ! want_access ) DBUG_RETURN ( 0 ) ; rw_rdlock ( & LOCK_grant ) ; for ( table = procs ; table ; table = table -> next_global ) { GRANT_NAME * grant_proc ; if ( ( grant_proc = routine_hash_search ( host , sctx -> ip , table -> db , user , table -> table_name , is_proc , 0 ) ) ) table -> grant . privilege |= grant_proc -> privs ; if ( want_access & ~ table -> grant . privilege ) { want_access &= ~ table -> grant . privilege ; goto err ; } } rw_unlock ( & LOCK_grant ) ; DBUG_RETURN ( 0 ) ; err : rw_unlock ( & LOCK_grant ) ; if ( ! no_errors ) { char buff [ 1024 ] ; const char * command = "" ; if ( table ) strxmov ( buff , table -> db , "." , table -> table_name , NullS ) ; if ( want_access & EXECUTE_ACL ) command = "execute" ; else if ( want_access & ALTER_PROC_ACL ) command = "alter routine" ; else if ( want_access & GRANT_ACL ) command = "grant" ; my_error ( ER_PROCACCESS_DENIED_ERROR , MYF ( 0 ) , command , user , host , table ? buff : "unknown" ) ; } DBUG_RETURN ( 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void y4m_convert_null ( y4m_input * _y4m , unsigned char * _dst , unsigned char * _aux ) { ( void ) _y4m ; ( void ) _dst ; ( void ) _aux ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean logcat_dump_text ( wtap_dumper * wdh , const struct wtap_pkthdr * phdr , const guint8 * pd , int * err ) { gchar * buf ; gint length ; gchar priority ; const gchar * tag ; const gint * pid ; const gint * tid ; const gchar * log ; gchar * log_part ; const gchar * str_begin ; const gchar * str_end ; const guint32 * datetime ; const guint32 * nanoseconds ; const union wtap_pseudo_header * pseudo_header = & phdr -> pseudo_header ; const struct dumper_t * dumper = ( const struct dumper_t * ) wdh -> priv ; if ( phdr -> rec_type != REC_TYPE_PACKET ) { * err = WTAP_ERR_REC_TYPE_UNSUPPORTED ; return FALSE ; } if ( pseudo_header -> logcat . version == 1 ) { pid = ( const gint * ) ( pd + 4 ) ; tid = ( const gint * ) ( pd + 2 * 4 ) ; datetime = ( const guint32 * ) ( pd + 3 * 4 ) ; nanoseconds = ( const guint32 * ) ( pd + 4 * 4 ) ; priority = get_priority ( ( const guint8 * ) ( pd + 5 * 4 ) ) ; tag = ( const gchar * ) ( pd + 5 * 4 + 1 ) ; log = tag + strlen ( tag ) + 1 ; } else if ( pseudo_header -> logcat . version == 2 ) { pid = ( const gint * ) ( pd + 4 ) ; tid = ( const gint * ) ( pd + 2 * 4 ) ; datetime = ( const guint32 * ) ( pd + 3 * 4 ) ; nanoseconds = ( const guint32 * ) ( pd + 4 * 4 ) ; priority = get_priority ( ( const guint8 * ) ( pd + 6 * 4 ) ) ; tag = ( const char * ) ( pd + 6 * 4 + 1 ) ; log = tag + strlen ( tag ) + 1 ; } else { * err = WTAP_ERR_UNSUPPORTED ; return FALSE ; } str_begin = str_end = log ; while ( dumper -> type != DUMP_LONG && ( str_end = strchr ( str_begin , '\n' ) ) ) { log_part = ( gchar * ) g_malloc ( str_end - str_begin + 1 ) ; g_strlcpy ( log_part , str_begin , str_end - str_begin + 1 ) ; str_begin = str_end + 1 ; buf = logcat_log ( dumper , * datetime , * nanoseconds / 1000000 , * pid , * tid , priority , tag , log_part ) ; if ( ! buf ) { g_free ( log_part ) ; return FALSE ; } g_free ( log_part ) ; length = ( guint32 ) strlen ( buf ) ; if ( ! wtap_dump_file_write ( wdh , buf , length , err ) ) { g_free ( buf ) ; return FALSE ; } wdh -> bytes_dumped += length ; g_free ( buf ) ; } if ( * str_begin != '\0' ) { log_part = ( gchar * ) g_malloc ( strlen ( str_begin ) + 1 ) ; g_strlcpy ( log_part , str_begin , strlen ( str_begin ) + 1 ) ; buf = logcat_log ( dumper , * datetime , * nanoseconds / 1000000 , * pid , * tid , priority , tag , log_part ) ; if ( ! buf ) { g_free ( log_part ) ; return FALSE ; } g_free ( log_part ) ; length = ( guint32 ) strlen ( buf ) ; if ( ! wtap_dump_file_write ( wdh , buf , length , err ) ) { g_free ( buf ) ; return FALSE ; } wdh -> bytes_dumped += length ; g_free ( buf ) ; } return TRUE ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int ipvideo_decode_block_opcode_0x2 ( IpvideoContext * s , AVFrame * frame ) { unsigned char B ; int x , y ; if ( ! s -> is_16bpp ) { B = bytestream2_get_byte ( & s -> stream_ptr ) ; } else { B = bytestream2_get_byte ( & s -> mv_ptr ) ; } if ( B < 56 ) { x = 8 + ( B % 7 ) ; y = B / 7 ; } else { x = - 14 + ( ( B - 56 ) % 29 ) ; y = 8 + ( ( B - 56 ) / 29 ) ; } av_dlog ( NULL , " motion byte = %d, (x, y) = (%d, %d)\n" , B , x , y ) ; return copy_from ( s , s -> second_last_frame , frame , x , y ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static vpx_fixed_buf_t pass0 ( vpx_image_t * raw , FILE * infile , const VpxInterface * encoder , const vpx_codec_enc_cfg_t * cfg ) { vpx_codec_ctx_t codec ; int frame_count = 0 ; vpx_fixed_buf_t stats = { NULL , 0 } ; if ( vpx_codec_enc_init ( & codec , encoder -> codec_interface ( ) , cfg , 0 ) ) die_codec ( & codec , "Failed to initialize encoder" ) ; while ( vpx_img_read ( raw , infile ) ) { ++ frame_count ; get_frame_stats ( & codec , raw , frame_count , 1 , 0 , VPX_DL_BEST_QUALITY , & stats ) ; } while ( get_frame_stats ( & codec , NULL , frame_count , 1 , 0 , VPX_DL_BEST_QUALITY , & stats ) ) { } printf ( "Pass 0 complete. Processed %d frames.\n" , frame_count ) ; if ( vpx_codec_destroy ( & codec ) ) die_codec ( & codec , "Failed to destroy codec." ) ; return stats ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int dcc_resume_file_check ( FILE_DCC_REC * dcc , IRC_SERVER_REC * server , uoff_t size ) { if ( size >= dcc -> size ) { dcc -> starttime = time ( NULL ) ; dcc_reject ( DCC ( dcc ) , server ) ; } else if ( lseek ( dcc -> fhandle , ( off_t ) size , SEEK_SET ) != ( off_t ) size ) { dcc_reject ( DCC ( dcc ) , server ) ; } else { dcc -> transfd = dcc -> skipped = size ; return TRUE ; } return FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int kvm_arch_set_tsc_khz ( CPUState * cs ) { X86CPU * cpu = X86_CPU ( cs ) ; CPUX86State * env = & cpu -> env ; int r ; if ( ! env -> tsc_khz ) { return 0 ; } r = kvm_check_extension ( cs -> kvm_state , KVM_CAP_TSC_CONTROL ) ? kvm_vcpu_ioctl ( cs , KVM_SET_TSC_KHZ , env -> tsc_khz ) : - ENOTSUP ; if ( r < 0 ) { int cur_freq = kvm_check_extension ( cs -> kvm_state , KVM_CAP_GET_TSC_KHZ ) ? kvm_vcpu_ioctl ( cs , KVM_GET_TSC_KHZ ) : - ENOTSUP ; if ( cur_freq <= 0 || cur_freq != env -> tsc_khz ) { warn_report ( "TSC frequency mismatch between " "VM (%" PRId64 " kHz) and host (%d kHz), " "and TSC scaling unavailable" , env -> tsc_khz , cur_freq ) ; return r ; } } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void * linux_udev_event_thread_main ( void * arg ) { char dummy ; int r ; struct udev_device * udev_dev ; struct pollfd fds [ ] = { { . fd = udev_control_pipe [ 0 ] , . events = POLLIN } , { . fd = udev_monitor_fd , . events = POLLIN } , } ; usbi_dbg ( "udev event thread entering." ) ; while ( poll ( fds , 2 , - 1 ) >= 0 ) { if ( fds [ 0 ] . revents & POLLIN ) { r = usbi_read ( udev_control_pipe [ 0 ] , & dummy , sizeof ( dummy ) ) ; if ( r <= 0 ) { usbi_warn ( NULL , "udev control pipe read failed" ) ; } break ; } if ( fds [ 1 ] . revents & POLLIN ) { usbi_mutex_static_lock ( & linux_hotplug_lock ) ; udev_dev = udev_monitor_receive_device ( udev_monitor ) ; if ( udev_dev ) udev_hotplug_event ( udev_dev ) ; usbi_mutex_static_unlock ( & linux_hotplug_lock ) ; } } usbi_dbg ( "udev event thread exiting" ) ; return NULL ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static inline uint32_t read_IRQreg_ivpr ( OpenPICState * opp , int n_IRQ ) { return opp -> src [ n_IRQ ] . ivpr ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( ExtensionMessageBubbleViewBrowserTest , ExtensionBubbleAnchoredToAppMenuWithOtherAction ) { TestBubbleAnchoredToAppMenuWithOtherAction ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
hb_face_t * hb_face_create ( hb_blob_t * blob , unsigned int index ) { hb_face_t * face ; if ( unlikely ( ! blob || ! hb_blob_get_length ( blob ) ) ) return hb_face_get_empty ( ) ; hb_face_for_data_closure_t * closure = _hb_face_for_data_closure_create ( OT : : Sanitizer < OT : : OpenTypeFontFile > : : sanitize ( hb_blob_reference ( blob ) ) , index ) ; if ( unlikely ( ! closure ) ) return hb_face_get_empty ( ) ; face = hb_face_create_for_tables ( _hb_face_for_data_reference_table , closure , ( hb_destroy_func_t ) _hb_face_for_data_closure_destroy ) ; hb_face_set_index ( face , index ) ; return face ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int nntp_fetch_headers ( struct Context * ctx , void * hc , anum_t first , anum_t last , int restore ) { struct NntpData * nntp_data = ctx -> data ; struct FetchCtx fc ; struct Header * hdr = NULL ; char buf [ HUGE_STRING ] ; int rc = 0 ; int oldmsgcount = ctx -> msgcount ; anum_t current ; anum_t first_over = first ; # ifdef USE_HCACHE void * hdata = NULL ; # endif if ( ! last || first > last ) return 0 ; fc . ctx = ctx ; fc . first = first ; fc . last = last ; fc . restore = restore ; fc . messages = mutt_mem_calloc ( last - first + 1 , sizeof ( unsigned char ) ) ; if ( fc . messages == NULL ) return - 1 ; # ifdef USE_HCACHE fc . hc = hc ; # endif if ( NntpListgroup && nntp_data -> nserv -> hasLISTGROUP && ! nntp_data -> deleted ) { if ( ! ctx -> quiet ) mutt_message ( _ ( "Fetching list of articles..." ) ) ; if ( nntp_data -> nserv -> hasLISTGROUPrange ) snprintf ( buf , sizeof ( buf ) , "LISTGROUP %s %u-%u\r\n" , nntp_data -> group , first , last ) ; else snprintf ( buf , sizeof ( buf ) , "LISTGROUP %s\r\n" , nntp_data -> group ) ; rc = nntp_fetch_lines ( nntp_data , buf , sizeof ( buf ) , NULL , fetch_numbers , & fc ) ; if ( rc > 0 ) { mutt_error ( "LISTGROUP: %s" , buf ) ; } if ( rc == 0 ) { for ( current = first ; current <= last && rc == 0 ; current ++ ) { if ( fc . messages [ current - first ] ) continue ; snprintf ( buf , sizeof ( buf ) , "%u" , current ) ; if ( nntp_data -> bcache ) { mutt_debug ( 2 , "#1 mutt_bcache_del %s\n" , buf ) ; mutt_bcache_del ( nntp_data -> bcache , buf ) ; } # ifdef USE_HCACHE if ( fc . hc ) { mutt_debug ( 2 , "mutt_hcache_delete %s\n" , buf ) ; mutt_hcache_delete ( fc . hc , buf , strlen ( buf ) ) ; } # endif } } } else { for ( current = first ; current <= last ; current ++ ) fc . messages [ current - first ] = 1 ; } if ( ! ctx -> quiet ) { mutt_progress_init ( & fc . progress , _ ( "Fetching message headers..." ) , MUTT_PROGRESS_MSG , ReadInc , last - first + 1 ) ; } for ( current = first ; current <= last && rc == 0 ; current ++ ) { if ( ! ctx -> quiet ) mutt_progress_update ( & fc . progress , current - first + 1 , - 1 ) ; # ifdef USE_HCACHE snprintf ( buf , sizeof ( buf ) , "%u" , current ) ; # endif if ( ! fc . messages [ current - first ] ) continue ; if ( ctx -> msgcount >= ctx -> hdrmax ) mx_alloc_memory ( ctx ) ; # ifdef USE_HCACHE hdata = mutt_hcache_fetch ( fc . hc , buf , strlen ( buf ) ) ; if ( hdata ) { mutt_debug ( 2 , "mutt_hcache_fetch %s\n" , buf ) ; ctx -> hdrs [ ctx -> msgcount ] = hdr = mutt_hcache_restore ( hdata ) ; mutt_hcache_free ( fc . hc , & hdata ) ; hdr -> data = 0 ; if ( hdr -> deleted && ! restore ) { mutt_header_free ( & hdr ) ; if ( nntp_data -> bcache ) { mutt_debug ( 2 , "#2 mutt_bcache_del %s\n" , buf ) ; mutt_bcache_del ( nntp_data -> bcache , buf ) ; } continue ; } hdr -> read = false ; hdr -> old = false ; } else # endif if ( nntp_data -> deleted ) continue ; else if ( nntp_data -> nserv -> hasOVER || nntp_data -> nserv -> hasXOVER ) { if ( NntpListgroup && nntp_data -> nserv -> hasLISTGROUP ) break ; else continue ; } else { FILE * fp = mutt_file_mkstemp ( ) ; if ( ! fp ) { mutt_perror ( "mutt_file_mkstemp() failed!" ) ; rc = - 1 ; break ; } snprintf ( buf , sizeof ( buf ) , "HEAD %u\r\n" , current ) ; rc = nntp_fetch_lines ( nntp_data , buf , sizeof ( buf ) , NULL , fetch_tempfile , fp ) ; if ( rc ) { mutt_file_fclose ( & fp ) ; if ( rc < 0 ) break ; if ( mutt_str_strncmp ( "423" , buf , 3 ) != 0 ) { mutt_error ( "HEAD: %s" , buf ) ; break ; } if ( nntp_data -> bcache ) { snprintf ( buf , sizeof ( buf ) , "%u" , current ) ; mutt_debug ( 2 , "#3 mutt_bcache_del %s\n" , buf ) ; mutt_bcache_del ( nntp_data -> bcache , buf ) ; } rc = 0 ; continue ; } hdr = ctx -> hdrs [ ctx -> msgcount ] = mutt_header_new ( ) ; hdr -> env = mutt_rfc822_read_header ( fp , hdr , 0 , 0 ) ; hdr -> received = hdr -> date_sent ; mutt_file_fclose ( & fp ) ; } hdr -> index = ctx -> msgcount ++ ; hdr -> read = false ; hdr -> old = false ; hdr -> deleted = false ; hdr -> data = mutt_mem_calloc ( 1 , sizeof ( struct NntpHeaderData ) ) ; NHDR ( hdr ) -> article_num = current ; if ( restore ) hdr -> changed = true ; else { nntp_article_status ( ctx , hdr , NULL , NHDR ( hdr ) -> article_num ) ; if ( ! hdr -> read ) nntp_parse_xref ( ctx , hdr ) ; } if ( current > nntp_data -> last_loaded ) nntp_data -> last_loaded = current ; first_over = current + 1 ; } if ( ! NntpListgroup || ! nntp_data -> nserv -> hasLISTGROUP ) current = first_over ; if ( current <= last && rc == 0 && ! nntp_data -> deleted ) { char * cmd = nntp_data -> nserv -> hasOVER ? "OVER" : "XOVER" ; snprintf ( buf , sizeof ( buf ) , "%s %u-%u\r\n" , cmd , current , last ) ; rc = nntp_fetch_lines ( nntp_data , buf , sizeof ( buf ) , NULL , parse_overview_line , & fc ) ; if ( rc > 0 ) { mutt_error ( "%s: %s" , cmd , buf ) ; } } if ( ctx -> msgcount > oldmsgcount ) mx_update_context ( ctx , ctx -> msgcount - oldmsgcount ) ; FREE ( & fc . messages ) ; if ( rc != 0 ) return - 1 ; mutt_clear_error ( ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int compare_files2 ( File fd1 , const char * filename2 ) { int error = RESULT_OK ; File fd2 ; size_t fd1_length , fd2_length ; DYNAMIC_STRING fd1_result , fd2_result ; if ( ( fd2 = my_open ( filename2 , O_RDONLY , MYF ( 0 ) ) ) < 0 ) { my_close ( fd1 , MYF ( 0 ) ) ; die ( "Failed to open second file: '%s'" , filename2 ) ; } fd1_length = ( size_t ) my_seek ( fd1 , 0 , SEEK_END , MYF ( 0 ) ) ; fd2_length = ( size_t ) my_seek ( fd2 , 0 , SEEK_END , MYF ( 0 ) ) ; if ( init_dynamic_string ( & fd1_result , 0 , fd1_length , 0 ) || init_dynamic_string ( & fd2_result , 0 , fd2_length , 0 ) ) die ( "Out of memory when allocating data for result" ) ; fd1_result . length = fd1_length ; fd2_result . length = fd2_length ; ( void ) my_seek ( fd1 , 0 , SEEK_SET , MYF ( 0 ) ) ; ( void ) my_seek ( fd2 , 0 , SEEK_SET , MYF ( 0 ) ) ; if ( my_read ( fd1 , ( uchar * ) fd1_result . str , fd1_length , MYF ( MY_WME | MY_NABP ) ) ) die ( "Error when reading data from result file" ) ; if ( my_read ( fd2 , ( uchar * ) fd2_result . str , fd2_length , MYF ( MY_WME | MY_NABP ) ) ) die ( "Error when reading data from result file" ) ; if ( global_subst && ( fd1_length != fd2_length || memcmp ( fd1_result . str , fd2_result . str , fd1_length ) ) ) { uint global_subst_from_len = strlen ( global_subst_from ) ; uint global_subst_to_len = strlen ( global_subst_to ) ; while ( replace ( & fd1_result , global_subst_from , global_subst_from_len , global_subst_to , global_subst_to_len ) == 0 ) ; } if ( fd1_result . length != fd2_result . length ) error = RESULT_LENGTH_MISMATCH ; else if ( ( memcmp ( fd1_result . str , fd2_result . str , fd1_result . length ) ) ) error = RESULT_CONTENT_MISMATCH ; my_close ( fd2 , MYF ( 0 ) ) ; dynstr_free ( & fd1_result ) ; dynstr_free ( & fd2_result ) ; return error ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
bool mysql_grant ( THD * thd , const char * db , List < LEX_USER > & list , ulong rights , bool revoke_grant ) { List_iterator < LEX_USER > str_list ( list ) ; LEX_USER * Str , * tmp_Str ; char tmp_db [ NAME_LEN + 1 ] ; bool create_new_users = 0 ; TABLE_LIST tables [ 2 ] ; bool save_binlog_row_based ; DBUG_ENTER ( "mysql_grant" ) ; if ( ! initialized ) { my_error ( ER_OPTION_PREVENTS_STATEMENT , MYF ( 0 ) , "--skip-grant-tables" ) ; DBUG_RETURN ( TRUE ) ; } if ( lower_case_table_names && db ) { strnmov ( tmp_db , db , NAME_LEN ) ; tmp_db [ NAME_LEN ] = '\0' ; my_casedn_str ( files_charset_info , tmp_db ) ; db = tmp_db ; } bzero ( ( char * ) & tables , sizeof ( tables ) ) ; tables [ 0 ] . alias = tables [ 0 ] . table_name = ( char * ) "user" ; tables [ 1 ] . alias = tables [ 1 ] . table_name = ( char * ) "db" ; tables [ 0 ] . next_local = tables [ 0 ] . next_global = tables + 1 ; tables [ 0 ] . lock_type = tables [ 1 ] . lock_type = TL_WRITE ; tables [ 0 ] . db = tables [ 1 ] . db = ( char * ) "mysql" ; save_binlog_row_based = thd -> current_stmt_binlog_row_based ; thd -> clear_current_stmt_binlog_row_based ( ) ; # ifdef HAVE_REPLICATION if ( thd -> slave_thread && rpl_filter -> is_on ( ) ) { tables [ 0 ] . updating = tables [ 1 ] . updating = 1 ; if ( ! ( thd -> spcont || rpl_filter -> tables_ok ( 0 , tables ) ) ) { thd -> current_stmt_binlog_row_based = save_binlog_row_based ; DBUG_RETURN ( FALSE ) ; } } # endif if ( simple_open_n_lock_tables ( thd , tables ) ) { close_thread_tables ( thd ) ; thd -> current_stmt_binlog_row_based = save_binlog_row_based ; DBUG_RETURN ( TRUE ) ; } if ( ! revoke_grant ) create_new_users = test_if_create_new_users ( thd ) ; rw_wrlock ( & LOCK_grant ) ; VOID ( pthread_mutex_lock ( & acl_cache -> lock ) ) ; grant_version ++ ; int result = 0 ; while ( ( tmp_Str = str_list ++ ) ) { if ( ! ( Str = get_current_user ( thd , tmp_Str ) ) ) { result = TRUE ; continue ; } if ( ! tmp_Str -> user . str && tmp_Str -> password . str ) Str -> password = tmp_Str -> password ; if ( replace_user_table ( thd , tables [ 0 ] . table , * Str , ( ! db ? rights : 0 ) , revoke_grant , create_new_users , test ( thd -> variables . sql_mode & MODE_NO_AUTO_CREATE_USER ) ) ) result = - 1 ; else if ( db ) { ulong db_rights = rights & DB_ACLS ; if ( db_rights == rights ) { if ( replace_db_table ( tables [ 1 ] . table , db , * Str , db_rights , revoke_grant ) ) result = - 1 ; } else { my_error ( ER_WRONG_USAGE , MYF ( 0 ) , "DB GRANT" , "GLOBAL PRIVILEGES" ) ; result = - 1 ; } } } VOID ( pthread_mutex_unlock ( & acl_cache -> lock ) ) ; if ( ! result ) { result = write_bin_log ( thd , TRUE , thd -> query ( ) , thd -> query_length ( ) ) ; } rw_unlock ( & LOCK_grant ) ; close_thread_tables ( thd ) ; if ( ! result ) my_ok ( 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 makeAlterConfigCommand ( PGconn * conn , const char * arrayitem , const char * type , const char * name , const char * type2 , const char * name2 ) { char * pos ; char * mine ; PQExpBuffer buf ; mine = pg_strdup ( arrayitem ) ; pos = strchr ( mine , '=' ) ; if ( pos == NULL ) { free ( mine ) ; return ; } buf = createPQExpBuffer ( ) ; * pos = 0 ; appendPQExpBuffer ( buf , "ALTER %s %s " , type , fmtId ( name ) ) ; if ( type2 != NULL && name2 != NULL ) appendPQExpBuffer ( buf , "IN %s %s " , type2 , fmtId ( name2 ) ) ; appendPQExpBuffer ( buf , "SET %s TO " , fmtId ( mine ) ) ; if ( pg_strcasecmp ( mine , "DateStyle" ) == 0 || pg_strcasecmp ( mine , "search_path" ) == 0 ) appendPQExpBufferStr ( buf , pos + 1 ) ; else appendStringLiteralConn ( buf , pos + 1 , conn ) ; appendPQExpBufferStr ( buf , "; \n" ) ; fprintf ( OPF , "%s" , buf -> data ) ; destroyPQExpBuffer ( buf ) ; free ( mine ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void set_block_size ( VP9_COMP * const cpi , int mi_row , int mi_col , BLOCK_SIZE bsize ) { if ( cpi -> common . mi_cols > mi_col && cpi -> common . mi_rows > mi_row ) { MACROBLOCKD * const xd = & cpi -> mb . e_mbd ; set_modeinfo_offsets ( & cpi -> common , xd , mi_row , mi_col ) ; xd -> mi [ 0 ] -> mbmi . sb_type = bsize ; duplicate_mode_info_in_sb ( & cpi -> common , xd , mi_row , mi_col , bsize ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
void printvars ( int length , const char * data , int status , int sttype , int quiet , FILE * fp ) { if ( rawmode ) rawprint ( sttype , length , data , status , quiet , fp ) ; else cookedprint ( sttype , length , data , status , quiet , fp ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void xhci_xfer_unmap ( XHCITransfer * xfer ) { usb_packet_unmap ( & xfer -> packet , & xfer -> sgl ) ; qemu_sglist_destroy ( & xfer -> sgl ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int gs_copypage ( gs_gstate * pgs ) { return gs_output_page ( pgs , 1 , 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void armv7m_nvic_set_pending ( void * opaque , int irq ) { nvic_state * s = ( nvic_state * ) opaque ; if ( irq >= 16 ) irq += 16 ; gic_set_pending_private ( & s -> gic , 0 , irq ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
double mcv_selectivity ( VariableStatData * vardata , FmgrInfo * opproc , Datum constval , bool varonleft , double * sumcommonp ) { double mcv_selec , sumcommon ; Datum * values ; int nvalues ; float4 * numbers ; int nnumbers ; int i ; mcv_selec = 0.0 ; sumcommon = 0.0 ; if ( HeapTupleIsValid ( vardata -> statsTuple ) && statistic_proc_security_check ( vardata , opproc -> fn_oid ) && get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_MCV , InvalidOid , NULL , & values , & nvalues , & numbers , & nnumbers ) ) { for ( i = 0 ; i < nvalues ; i ++ ) { if ( varonleft ? DatumGetBool ( FunctionCall2Coll ( opproc , DEFAULT_COLLATION_OID , values [ i ] , constval ) ) : DatumGetBool ( FunctionCall2Coll ( opproc , DEFAULT_COLLATION_OID , constval , values [ i ] ) ) ) mcv_selec += numbers [ i ] ; sumcommon += numbers [ i ] ; } free_attstatsslot ( vardata -> atttype , values , nvalues , numbers , nnumbers ) ; } * sumcommonp = sumcommon ; return mcv_selec ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_bug9735 ( ) { MYSQL_RES * res ; int rc ; myheader ( "test_bug9735" ) ; rc = mysql_query ( mysql , "drop table if exists t1" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "create table t1 (a mediumtext, b longtext) " "character set latin1" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "select * from t1" ) ; myquery ( rc ) ; res = mysql_store_result ( mysql ) ; verify_prepare_field ( res , 0 , "a" , "a" , MYSQL_TYPE_BLOB , "t1" , "t1" , current_db , ( 1U << 24 ) - 1 , 0 ) ; verify_prepare_field ( res , 1 , "b" , "b" , MYSQL_TYPE_BLOB , "t1" , "t1" , current_db , ~ 0U , 0 ) ; mysql_free_result ( res ) ; rc = mysql_query ( mysql , "drop table t1" ) ; myquery ( rc ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool _try_writable ( hb_blob_t * blob ) { if ( blob -> immutable ) return false ; if ( blob -> mode == HB_MEMORY_MODE_WRITABLE ) return true ; if ( blob -> mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE && _try_writable_inplace ( blob ) ) return true ; if ( blob -> mode == HB_MEMORY_MODE_WRITABLE ) return true ; DEBUG_MSG_FUNC ( BLOB , blob , "current data is -> %p\n" , blob -> data ) ; char * new_data ; new_data = ( char * ) malloc ( blob -> length ) ; if ( unlikely ( ! new_data ) ) return false ; DEBUG_MSG_FUNC ( BLOB , blob , "dupped successfully -> %p\n" , blob -> data ) ; memcpy ( new_data , blob -> data , blob -> length ) ; _hb_blob_destroy_user_data ( blob ) ; blob -> mode = HB_MEMORY_MODE_WRITABLE ; blob -> data = new_data ; blob -> user_data = new_data ; blob -> destroy = free ; return true ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int32_t compareFallbacks ( const void * context , const void * fb1 , const void * fb2 ) { return ( ( const _MBCSToUFallback * ) fb1 ) -> offset - ( ( const _MBCSToUFallback * ) fb2 ) -> offset ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void mspack_fmap_message ( struct mspack_file * file , const char * fmt , ... ) { cli_dbgmsg ( "%s() %s\n" , __func__ , fmt ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int validate_header ( const struct evkeyvalq * headers , const char * key , const char * value ) { const char * real_val = evhttp_find_header ( headers , key ) ; if ( real_val == NULL ) return ( - 1 ) ; if ( strcmp ( real_val , value ) != 0 ) return ( - 1 ) ; return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_NonIsoIntegrityMechanism ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_NonIsoIntegrityMechanism , NonIsoIntegrityMechanism_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int vp8_decode ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { VP8Context * ctx = avctx -> priv_data ; AVFrame * picture = data ; const void * iter = NULL ; struct vpx_image * img ; if ( vpx_codec_decode ( & ctx -> decoder , avpkt -> data , avpkt -> size , NULL , 0 ) != VPX_CODEC_OK ) { const char * error = vpx_codec_error ( & ctx -> decoder ) ; const char * detail = vpx_codec_error_detail ( & ctx -> decoder ) ; av_log ( avctx , AV_LOG_ERROR , "Failed to decode frame: %s\n" , error ) ; if ( detail ) av_log ( avctx , AV_LOG_ERROR , " Additional information: %s\n" , detail ) ; return AVERROR_INVALIDDATA ; } if ( ( img = vpx_codec_get_frame ( & ctx -> decoder , & iter ) ) ) { if ( img -> fmt != VPX_IMG_FMT_I420 ) { av_log ( avctx , AV_LOG_ERROR , "Unsupported output colorspace (%d)\n" , img -> fmt ) ; return AVERROR_INVALIDDATA ; } if ( ( int ) img -> d_w != avctx -> width || ( int ) img -> d_h != avctx -> height ) { av_log ( avctx , AV_LOG_INFO , "dimension change! %dx%d -> %dx%d\n" , avctx -> width , avctx -> height , img -> d_w , img -> d_h ) ; if ( av_image_check_size ( img -> d_w , img -> d_h , 0 , avctx ) ) return AVERROR_INVALIDDATA ; avcodec_set_dimensions ( avctx , img -> d_w , img -> d_h ) ; } picture -> data [ 0 ] = img -> planes [ 0 ] ; picture -> data [ 1 ] = img -> planes [ 1 ] ; picture -> data [ 2 ] = img -> planes [ 2 ] ; picture -> data [ 3 ] = NULL ; picture -> linesize [ 0 ] = img -> stride [ 0 ] ; picture -> linesize [ 1 ] = img -> stride [ 1 ] ; picture -> linesize [ 2 ] = img -> stride [ 2 ] ; picture -> linesize [ 3 ] = 0 ; * got_frame = 1 ; } return avpkt -> size ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int xmlrpc_split_buf ( char * buffer , char * * * argv ) { int ac = 0 ; int argvsize = 8 ; char * data , * str ; char * nexttag = NULL ; char * p ; int tagtype = 0 ; data = buffer ; * argv = smalloc ( sizeof ( char * ) * argvsize ) ; while ( ( data = strstr ( data , "<value>" ) ) ) { data += 7 ; nexttag = strchr ( data , '<' ) ; if ( nexttag == NULL ) break ; nexttag ++ ; p = strchr ( nexttag , '>' ) ; if ( p == NULL ) break ; * p ++ = '\0' ; if ( ! stricmp ( "string" , nexttag ) ) tagtype = 1 ; else tagtype = 0 ; str = p ; p = strchr ( str , '<' ) ; if ( p == NULL ) break ; * p ++ = '\0' ; if ( ac >= argvsize ) { argvsize *= 2 ; * argv = srealloc ( * argv , sizeof ( char * ) * argvsize ) ; } if ( tagtype == 1 ) ( * argv ) [ ac ++ ] = xmlrpc_decode_string ( str ) ; else ( * argv ) [ ac ++ ] = str ; data = p ; } return ac ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONRemovePCIDevice ( qemuMonitorPtr mon ATTRIBUTE_UNUSED , virDomainDevicePCIAddress * guestAddr ATTRIBUTE_UNUSED ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "pci_del not suppported in JSON mode" ) ) ; return - 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int cinvideo_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; CinVideoContext * cin = avctx -> priv_data ; int i , y , palette_type , palette_colors_count , bitmap_frame_type , bitmap_frame_size , res = 0 ; palette_type = buf [ 0 ] ; palette_colors_count = AV_RL16 ( buf + 1 ) ; bitmap_frame_type = buf [ 3 ] ; buf += 4 ; bitmap_frame_size = buf_size - 4 ; if ( bitmap_frame_size < palette_colors_count * ( 3 + ( palette_type != 0 ) ) ) return AVERROR_INVALIDDATA ; if ( palette_type == 0 ) { if ( palette_colors_count > 256 ) return AVERROR_INVALIDDATA ; for ( i = 0 ; i < palette_colors_count ; ++ i ) { cin -> palette [ i ] = bytestream_get_le24 ( & buf ) ; bitmap_frame_size -= 3 ; } } else { for ( i = 0 ; i < palette_colors_count ; ++ i ) { cin -> palette [ buf [ 0 ] ] = AV_RL24 ( buf + 1 ) ; buf += 4 ; bitmap_frame_size -= 4 ; } } switch ( bitmap_frame_type ) { case 9 : cin_decode_rle ( buf , bitmap_frame_size , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; break ; case 34 : cin_decode_rle ( buf , bitmap_frame_size , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; cin_apply_delta_data ( cin -> bitmap_table [ CIN_PRE_BMP ] , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; break ; case 35 : cin_decode_huffman ( buf , bitmap_frame_size , cin -> bitmap_table [ CIN_INT_BMP ] , cin -> bitmap_size ) ; cin_decode_rle ( cin -> bitmap_table [ CIN_INT_BMP ] , bitmap_frame_size , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; break ; case 36 : bitmap_frame_size = cin_decode_huffman ( buf , bitmap_frame_size , cin -> bitmap_table [ CIN_INT_BMP ] , cin -> bitmap_size ) ; cin_decode_rle ( cin -> bitmap_table [ CIN_INT_BMP ] , bitmap_frame_size , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; cin_apply_delta_data ( cin -> bitmap_table [ CIN_PRE_BMP ] , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; break ; case 37 : cin_decode_huffman ( buf , bitmap_frame_size , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; break ; case 38 : res = cin_decode_lzss ( buf , bitmap_frame_size , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; if ( res < 0 ) return res ; break ; case 39 : res = cin_decode_lzss ( buf , bitmap_frame_size , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; if ( res < 0 ) return res ; cin_apply_delta_data ( cin -> bitmap_table [ CIN_PRE_BMP ] , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_size ) ; break ; } if ( ( res = ff_reget_buffer ( avctx , & cin -> frame ) ) < 0 ) { av_log ( cin -> avctx , AV_LOG_ERROR , "delphinecinvideo: reget_buffer() failed to allocate a frame\n" ) ; return res ; } memcpy ( cin -> frame . data [ 1 ] , cin -> palette , sizeof ( cin -> palette ) ) ; cin -> frame . palette_has_changed = 1 ; for ( y = 0 ; y < cin -> avctx -> height ; ++ y ) memcpy ( cin -> frame . data [ 0 ] + ( cin -> avctx -> height - 1 - y ) * cin -> frame . linesize [ 0 ] , cin -> bitmap_table [ CIN_CUR_BMP ] + y * cin -> avctx -> width , cin -> avctx -> width ) ; FFSWAP ( uint8_t * , cin -> bitmap_table [ CIN_CUR_BMP ] , cin -> bitmap_table [ CIN_PRE_BMP ] ) ; if ( ( res = av_frame_ref ( data , & cin -> frame ) ) < 0 ) return res ; * got_frame = 1 ; return buf_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static size_t readfromfile ( struct Form * form , char * buffer , size_t size ) { size_t nread ; bool callback = ( form -> data -> type == FORM_CALLBACK ) ? TRUE : FALSE ; if ( callback ) { if ( form -> fread_func == ZERO_NULL ) return 0 ; else nread = form -> fread_func ( buffer , 1 , size , form -> data -> line ) ; } else { if ( ! form -> fp ) { form -> fp = fopen_read ( form -> data -> line , "rb" ) ; if ( ! form -> fp ) return ( size_t ) - 1 ; } nread = fread ( buffer , 1 , size , form -> fp ) ; } if ( ! nread ) { if ( form -> fp ) { fclose ( form -> fp ) ; form -> fp = NULL ; } form -> data = form -> data -> next ; } return nread ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) { return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ; } static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) { return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ; } static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } 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 )
1True
Categorize the following code snippet as vulnerable or not. True or False
static inline uint16_t vga_read_word_le ( VGACommonState * vga , uint32_t addr ) { uint32_t offset = addr & vga -> vbe_size_mask & ~ 1 ; uint16_t * ptr = ( uint16_t * ) ( vga -> vram_ptr + offset ) ; return lduw_le_p ( ptr ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void rm_ac3_swap_bytes ( AVStream * st , AVPacket * pkt ) { uint8_t * ptr ; int j ; if ( st -> codecpar -> codec_id == AV_CODEC_ID_AC3 ) { ptr = pkt -> data ; for ( j = 0 ; j < pkt -> size ; j += 2 ) { FFSWAP ( int , ptr [ 0 ] , ptr [ 1 ] ) ; ptr += 2 ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int _compare_path_table_joliet ( const void * v1 , const void * v2 ) { const struct isoent * p1 , * p2 ; const unsigned char * s1 , * s2 ; int cmp , l ; p1 = * ( ( const struct isoent * * ) ( uintptr_t ) v1 ) ; p2 = * ( ( const struct isoent * * ) ( uintptr_t ) v2 ) ; cmp = p1 -> parent -> dir_number - p2 -> parent -> dir_number ; if ( cmp != 0 ) return ( cmp ) ; s1 = ( const unsigned char * ) p1 -> identifier ; s2 = ( const unsigned char * ) p2 -> identifier ; l = p1 -> ext_off ; if ( l > p2 -> ext_off ) l = p2 -> ext_off ; cmp = memcmp ( s1 , s2 , l ) ; if ( cmp != 0 ) return ( cmp ) ; if ( p1 -> ext_off < p2 -> ext_off ) { s2 += l ; l = p2 -> ext_off - p1 -> ext_off ; while ( l -- ) if ( 0 != * s2 ++ ) return ( - * ( const unsigned char * ) ( s2 - 1 ) ) ; } else if ( p1 -> ext_off > p2 -> ext_off ) { s1 += l ; l = p1 -> ext_off - p2 -> ext_off ; while ( l -- ) if ( 0 != * s1 ++ ) return ( * ( const unsigned char * ) ( s1 - 1 ) ) ; } return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void initial_reordering_consonant_syllable ( const hb_ot_shape_plan_t * plan , hb_face_t * face , hb_buffer_t * buffer , unsigned int start , unsigned int end ) { const indic_shape_plan_t * indic_plan = ( const indic_shape_plan_t * ) plan -> data ; hb_glyph_info_t * info = buffer -> info ; unsigned int base = end ; bool has_reph = false ; { unsigned int limit = start ; if ( indic_plan -> config -> reph_pos != REPH_POS_DONT_CARE && indic_plan -> mask_array [ RPHF ] && start + 3 <= end && ( ( indic_plan -> config -> reph_mode == REPH_MODE_IMPLICIT && ! is_joiner ( info [ start + 2 ] ) ) || ( indic_plan -> config -> reph_mode == REPH_MODE_EXPLICIT && info [ start + 2 ] . indic_category ( ) == OT_ZWJ ) ) ) { hb_codepoint_t glyphs [ 3 ] = { info [ start ] . codepoint , info [ start + 1 ] . codepoint , indic_plan -> config -> reph_mode == REPH_MODE_EXPLICIT ? info [ start + 2 ] . codepoint : 0 } ; if ( indic_plan -> rphf . would_substitute ( glyphs , 2 , face ) || ( indic_plan -> config -> reph_mode == REPH_MODE_EXPLICIT && indic_plan -> rphf . would_substitute ( glyphs , 3 , face ) ) ) { limit += 2 ; while ( limit < end && is_joiner ( info [ limit ] ) ) limit ++ ; base = start ; has_reph = true ; } } else if ( indic_plan -> config -> reph_mode == REPH_MODE_LOG_REPHA && info [ start ] . indic_category ( ) == OT_Repha ) { limit += 1 ; while ( limit < end && is_joiner ( info [ limit ] ) ) limit ++ ; base = start ; has_reph = true ; } switch ( indic_plan -> config -> base_pos ) { default : assert ( false ) ; case BASE_POS_LAST : { unsigned int i = end ; bool seen_below = false ; do { i -- ; if ( is_consonant ( info [ i ] ) ) { if ( info [ i ] . indic_position ( ) != POS_BELOW_C && ( info [ i ] . indic_position ( ) != POS_POST_C || seen_below ) ) { base = i ; break ; } if ( info [ i ] . indic_position ( ) == POS_BELOW_C ) seen_below = true ; base = i ; } else { if ( start < i && info [ i ] . indic_category ( ) == OT_ZWJ && info [ i - 1 ] . indic_category ( ) == OT_H ) break ; } } while ( i > limit ) ; } break ; case BASE_POS_LAST_SINHALA : { if ( ! has_reph ) base = limit ; for ( unsigned int i = limit ; i < end ; i ++ ) if ( is_consonant ( info [ i ] ) ) { if ( limit < i && info [ i - 1 ] . indic_category ( ) == OT_ZWJ ) break ; else base = i ; } for ( unsigned int i = base + 1 ; i < end ; i ++ ) if ( is_consonant ( info [ i ] ) ) info [ i ] . indic_position ( ) = POS_BELOW_C ; } break ; case BASE_POS_FIRST : { assert ( indic_plan -> config -> reph_mode == REPH_MODE_VIS_REPHA ) ; assert ( ! has_reph ) ; base = start ; for ( unsigned int i = base + 1 ; i < end ; i ++ ) if ( is_consonant ( info [ i ] ) ) info [ i ] . indic_position ( ) = POS_BELOW_C ; } break ; } if ( has_reph && base == start && limit - base <= 2 ) { has_reph = false ; } } for ( unsigned int i = start ; i < base ; i ++ ) info [ i ] . indic_position ( ) = MIN ( POS_PRE_C , ( indic_position_t ) info [ i ] . indic_position ( ) ) ; if ( base < end ) info [ base ] . indic_position ( ) = POS_BASE_C ; for ( unsigned int i = base + 1 ; i < end ; i ++ ) if ( info [ i ] . indic_category ( ) == OT_M ) { for ( unsigned int j = i + 1 ; j < end ; j ++ ) if ( is_consonant ( info [ j ] ) ) { info [ j ] . indic_position ( ) = POS_FINAL_C ; break ; } break ; } if ( has_reph ) info [ start ] . indic_position ( ) = POS_RA_TO_BECOME_REPH ; if ( indic_plan -> is_old_spec ) { bool disallow_double_halants = buffer -> props . script != HB_SCRIPT_MALAYALAM ; for ( unsigned int i = base + 1 ; i < end ; i ++ ) if ( info [ i ] . indic_category ( ) == OT_H ) { unsigned int j ; for ( j = end - 1 ; j > i ; j -- ) if ( is_consonant ( info [ j ] ) || ( disallow_double_halants && info [ j ] . indic_category ( ) == OT_H ) ) break ; if ( info [ j ] . indic_category ( ) != OT_H && j > i ) { hb_glyph_info_t t = info [ i ] ; memmove ( & info [ i ] , & info [ i + 1 ] , ( j - i ) * sizeof ( info [ 0 ] ) ) ; info [ j ] = t ; } break ; } } { indic_position_t last_pos = POS_START ; for ( unsigned int i = start ; i < end ; i ++ ) { if ( ( FLAG_SAFE ( info [ i ] . indic_category ( ) ) & ( JOINER_FLAGS | FLAG ( OT_N ) | FLAG ( OT_RS ) | MEDIAL_FLAGS | HALANT_OR_COENG_FLAGS ) ) ) { info [ i ] . indic_position ( ) = last_pos ; if ( unlikely ( info [ i ] . indic_category ( ) == OT_H && info [ i ] . indic_position ( ) == POS_PRE_M ) ) { for ( unsigned int j = i ; j > start ; j -- ) if ( info [ j - 1 ] . indic_position ( ) != POS_PRE_M ) { info [ i ] . indic_position ( ) = info [ j - 1 ] . indic_position ( ) ; break ; } } } else if ( info [ i ] . indic_position ( ) != POS_SMVD ) { last_pos = ( indic_position_t ) info [ i ] . indic_position ( ) ; } } } { unsigned int last = base ; for ( unsigned int i = base + 1 ; i < end ; i ++ ) if ( is_consonant ( info [ i ] ) ) { for ( unsigned int j = last + 1 ; j < i ; j ++ ) if ( info [ j ] . indic_position ( ) < POS_SMVD ) info [ j ] . indic_position ( ) = info [ i ] . indic_position ( ) ; last = i ; } else if ( info [ i ] . indic_category ( ) == OT_M ) last = i ; } { unsigned int syllable = info [ start ] . syllable ( ) ; for ( unsigned int i = start ; i < end ; i ++ ) info [ i ] . syllable ( ) = i - start ; hb_bubble_sort ( info + start , end - start , compare_indic_order ) ; base = end ; for ( unsigned int i = start ; i < end ; i ++ ) if ( info [ i ] . indic_position ( ) == POS_BASE_C ) { base = i ; break ; } if ( indic_plan -> is_old_spec || end - base > 127 ) buffer -> merge_clusters ( base , end ) ; else { for ( unsigned int i = base ; i < end ; i ++ ) if ( info [ i ] . syllable ( ) != 255 ) { unsigned int max = i ; unsigned int j = start + info [ i ] . syllable ( ) ; while ( j != i ) { max = MAX ( max , j ) ; unsigned int next = start + info [ j ] . syllable ( ) ; info [ j ] . syllable ( ) = 255 ; j = next ; } if ( i != max ) buffer -> merge_clusters ( i , max + 1 ) ; } } for ( unsigned int i = start ; i < end ; i ++ ) info [ i ] . syllable ( ) = syllable ; } { hb_mask_t mask ; for ( unsigned int i = start ; i < end && info [ i ] . indic_position ( ) == POS_RA_TO_BECOME_REPH ; i ++ ) info [ i ] . mask |= indic_plan -> mask_array [ RPHF ] ; mask = indic_plan -> mask_array [ HALF ] ; if ( ! indic_plan -> is_old_spec && indic_plan -> config -> blwf_mode == BLWF_MODE_PRE_AND_POST ) mask |= indic_plan -> mask_array [ BLWF ] ; for ( unsigned int i = start ; i < base ; i ++ ) info [ i ] . mask |= mask ; mask = 0 ; if ( base < end ) info [ base ] . mask |= mask ; mask = indic_plan -> mask_array [ BLWF ] | indic_plan -> mask_array [ ABVF ] | indic_plan -> mask_array [ PSTF ] ; for ( unsigned int i = base + 1 ; i < end ; i ++ ) info [ i ] . mask |= mask ; } if ( indic_plan -> is_old_spec && buffer -> props . script == HB_SCRIPT_DEVANAGARI ) { for ( unsigned int i = start ; i + 1 < base ; i ++ ) if ( info [ i ] . indic_category ( ) == OT_Ra && info [ i + 1 ] . indic_category ( ) == OT_H && ( i + 2 == base || info [ i + 2 ] . indic_category ( ) != OT_ZWJ ) ) { info [ i ] . mask |= indic_plan -> mask_array [ BLWF ] ; info [ i + 1 ] . mask |= indic_plan -> mask_array [ BLWF ] ; } } unsigned int pref_len = indic_plan -> config -> pref_len ; if ( indic_plan -> mask_array [ PREF ] && base + pref_len < end ) { assert ( 1 <= pref_len && pref_len <= 2 ) ; for ( unsigned int i = base + 1 ; i + pref_len - 1 < end ; i ++ ) { hb_codepoint_t glyphs [ 2 ] ; for ( unsigned int j = 0 ; j < pref_len ; j ++ ) glyphs [ j ] = info [ i + j ] . codepoint ; if ( indic_plan -> pref . would_substitute ( glyphs , pref_len , face ) ) { for ( unsigned int j = 0 ; j < pref_len ; j ++ ) info [ i ++ ] . mask |= indic_plan -> mask_array [ PREF ] ; if ( indic_plan -> mask_array [ CFAR ] ) for ( ; i < end ; i ++ ) info [ i ] . mask |= indic_plan -> mask_array [ CFAR ] ; break ; } } } for ( unsigned int i = start + 1 ; i < end ; i ++ ) if ( is_joiner ( info [ i ] ) ) { bool non_joiner = info [ i ] . indic_category ( ) == OT_ZWNJ ; unsigned int j = i ; do { j -- ; if ( non_joiner ) info [ j ] . mask &= ~ indic_plan -> mask_array [ HALF ] ; } while ( j > start && ! is_consonant ( info [ j ] ) ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void gx_device_init ( gx_device * dev , const gx_device * proto , gs_memory_t * mem , bool internal ) { memcpy ( dev , proto , proto -> params_size ) ; dev -> memory = mem ; dev -> retained = ! internal ; rc_init ( dev , mem , ( internal ? 0 : 1 ) ) ; rc_increment ( dev -> icc_struct ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
const char * vpx_svc_get_message ( const SvcContext * svc_ctx ) { const SvcInternal * const si = get_const_svc_internal ( svc_ctx ) ; if ( svc_ctx == NULL || si == NULL ) return NULL ; return si -> message_buffer ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void setup_loopfilter ( struct loopfilter * lf , struct vp9_read_bit_buffer * rb ) { lf -> filter_level = vp9_rb_read_literal ( rb , 6 ) ; lf -> sharpness_level = vp9_rb_read_literal ( rb , 3 ) ; lf -> mode_ref_delta_update = 0 ; lf -> mode_ref_delta_enabled = vp9_rb_read_bit ( rb ) ; if ( lf -> mode_ref_delta_enabled ) { lf -> mode_ref_delta_update = vp9_rb_read_bit ( rb ) ; if ( lf -> mode_ref_delta_update ) { int i ; for ( i = 0 ; i < MAX_REF_LF_DELTAS ; i ++ ) if ( vp9_rb_read_bit ( rb ) ) lf -> ref_deltas [ i ] = vp9_rb_read_signed_literal ( rb , 6 ) ; for ( i = 0 ; i < MAX_MODE_LF_DELTAS ; i ++ ) if ( vp9_rb_read_bit ( rb ) ) lf -> mode_deltas [ i ] = vp9_rb_read_signed_literal ( rb , 6 ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int show_streams ( WriterContext * w , InputFile * ifile ) { AVFormatContext * fmt_ctx = ifile -> fmt_ctx ; int i , ret = 0 ; writer_print_section_header ( w , SECTION_ID_STREAMS ) ; for ( i = 0 ; i < ifile -> nb_streams ; i ++ ) if ( selected_streams [ i ] ) { ret = show_stream ( w , fmt_ctx , i , & ifile -> streams [ i ] , 0 ) ; if ( ret < 0 ) break ; } writer_print_section_footer ( w ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
kadm5_ret_t kadm5_get_policy ( void * server_handle , kadm5_policy_t name , kadm5_policy_ent_t entry ) { osa_policy_ent_t t ; kadm5_ret_t ret ; kadm5_server_handle_t handle = server_handle ; memset ( entry , 0 , sizeof ( * entry ) ) ; CHECK_HANDLE ( server_handle ) ; krb5_clear_error_message ( handle -> context ) ; if ( name == ( kadm5_policy_t ) NULL ) return EINVAL ; if ( strlen ( name ) == 0 ) return KADM5_BAD_POLICY ; ret = krb5_db_get_policy ( handle -> context , name , & t ) ; if ( ret == KRB5_KDB_NOENTRY ) return KADM5_UNK_POLICY ; else if ( ret ) return ret ; if ( ( entry -> policy = strdup ( t -> name ) ) == NULL ) { ret = ENOMEM ; goto cleanup ; } entry -> pw_min_life = t -> pw_min_life ; entry -> pw_max_life = t -> pw_max_life ; entry -> pw_min_length = t -> pw_min_length ; entry -> pw_min_classes = t -> pw_min_classes ; entry -> pw_history_num = t -> pw_history_num ; if ( handle -> api_version >= KADM5_API_VERSION_3 ) { entry -> pw_max_fail = t -> pw_max_fail ; entry -> pw_failcnt_interval = t -> pw_failcnt_interval ; entry -> pw_lockout_duration = t -> pw_lockout_duration ; } if ( handle -> api_version >= KADM5_API_VERSION_4 ) { entry -> attributes = t -> attributes ; entry -> max_life = t -> max_life ; entry -> max_renewable_life = t -> max_renewable_life ; if ( t -> allowed_keysalts ) { entry -> allowed_keysalts = strdup ( t -> allowed_keysalts ) ; if ( ! entry -> allowed_keysalts ) { ret = ENOMEM ; goto cleanup ; } } ret = copy_tl_data ( t -> n_tl_data , t -> tl_data , & entry -> tl_data ) ; if ( ret ) goto cleanup ; entry -> n_tl_data = t -> n_tl_data ; } ret = 0 ; cleanup : if ( ret ) kadm5_free_policy_ent ( handle , entry ) ; krb5_db_free_policy ( handle -> context , t ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void extract_job_on_progress ( AutoarExtractor * extractor , guint64 archive_current_decompressed_size , guint archive_current_decompressed_files , gpointer user_data ) { ExtractJob * extract_job = user_data ; CommonJob * common = user_data ; GFile * source_file ; char * details ; double elapsed ; double transfer_rate ; int remaining_time ; guint64 archive_total_decompressed_size ; gdouble archive_weight ; gdouble archive_decompress_progress ; guint64 job_completed_size ; gdouble job_progress ; source_file = autoar_extractor_get_source_file ( extractor ) ; nautilus_progress_info_take_status ( common -> progress , f ( _ ( "Extracting “%B”" ) , source_file ) ) ; archive_total_decompressed_size = autoar_extractor_get_total_size ( extractor ) ; archive_decompress_progress = ( gdouble ) archive_current_decompressed_size / ( gdouble ) archive_total_decompressed_size ; archive_weight = 0 ; if ( extract_job -> total_compressed_size ) { archive_weight = ( gdouble ) extract_job -> archive_compressed_size / ( gdouble ) extract_job -> total_compressed_size ; } job_progress = archive_decompress_progress * archive_weight + extract_job -> base_progress ; elapsed = g_timer_elapsed ( common -> time , NULL ) ; transfer_rate = 0 ; remaining_time = - 1 ; job_completed_size = job_progress * extract_job -> total_compressed_size ; if ( elapsed > 0 ) { transfer_rate = job_completed_size / elapsed ; } if ( transfer_rate > 0 ) { remaining_time = ( extract_job -> total_compressed_size - job_completed_size ) / transfer_rate ; } if ( elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE || transfer_rate == 0 ) { details = f ( _ ( "%S / %S" ) , job_completed_size , extract_job -> total_compressed_size ) ; } else { details = f ( ngettext ( "%S / %S \xE2\x80\x94 %T left (%S/sec)" , "%S / %S \xE2\x80\x94 %T left (%S/sec)" , seconds_count_format_time_units ( remaining_time ) ) , job_completed_size , extract_job -> total_compressed_size , remaining_time , ( goffset ) transfer_rate ) ; } nautilus_progress_info_take_details ( common -> progress , details ) ; if ( elapsed > SECONDS_NEEDED_FOR_APROXIMATE_TRANSFER_RATE ) { nautilus_progress_info_set_remaining_time ( common -> progress , remaining_time ) ; nautilus_progress_info_set_elapsed_time ( common -> progress , elapsed ) ; } nautilus_progress_info_set_progress ( common -> progress , job_progress , 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_coap_opt_proxy_scheme ( tvbuff_t * tvb , proto_item * head_item , proto_tree * subtree , gint offset , gint opt_length , int hf ) { const guint8 * str = NULL ; if ( opt_length == 0 ) { str = nullstr ; } else { str = tvb_get_string_enc ( wmem_packet_scope ( ) , tvb , offset , opt_length , ENC_ASCII ) ; } proto_tree_add_string ( subtree , hf , tvb , offset , opt_length , str ) ; proto_item_append_text ( head_item , ": %s" , str ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void set_arf_sign_bias ( VP9_COMP * cpi ) { VP9_COMMON * const cm = & cpi -> common ; int arf_sign_bias ; if ( ( cpi -> oxcf . pass == 2 ) && cpi -> multi_arf_allowed ) { const GF_GROUP * const gf_group = & cpi -> twopass . gf_group ; arf_sign_bias = cpi -> rc . source_alt_ref_active && ( ! cpi -> refresh_alt_ref_frame || ( gf_group -> rf_level [ gf_group -> index ] == GF_ARF_LOW ) ) ; } else { arf_sign_bias = ( cpi -> rc . source_alt_ref_active && ! cpi -> refresh_alt_ref_frame ) ; } cm -> ref_frame_sign_bias [ ALTREF_FRAME ] = arf_sign_bias ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
char * get_namespace_name ( Oid nspid ) { HeapTuple tp ; tp = SearchSysCache1 ( NAMESPACEOID , ObjectIdGetDatum ( nspid ) ) ; if ( HeapTupleIsValid ( tp ) ) { Form_pg_namespace nsptup = ( Form_pg_namespace ) GETSTRUCT ( tp ) ; char * result ; result = pstrdup ( NameStr ( nsptup -> nspname ) ) ; ReleaseSysCache ( tp ) ; return result ; } else return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_RoundTripDelayRequest ( 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_RoundTripDelayRequest , RoundTripDelayRequest_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _slurm_rpc_resv_update ( slurm_msg_t * msg ) { int error_code = SLURM_SUCCESS ; DEF_TIMERS ; resv_desc_msg_t * resv_desc_ptr = ( resv_desc_msg_t * ) msg -> data ; slurmctld_lock_t node_write_lock = { READ_LOCK , READ_LOCK , WRITE_LOCK , READ_LOCK , NO_LOCK } ; uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ; START_TIMER ; debug2 ( "Processing RPC: REQUEST_UPDATE_RESERVATION from uid=%d" , uid ) ; if ( ! validate_operator ( uid ) ) { error_code = ESLURM_USER_ID_MISSING ; error ( "Security violation, UPDATE_RESERVATION RPC from uid=%d" , uid ) ; } if ( error_code == SLURM_SUCCESS ) { lock_slurmctld ( node_write_lock ) ; error_code = update_resv ( resv_desc_ptr ) ; unlock_slurmctld ( node_write_lock ) ; END_TIMER2 ( "_slurm_rpc_resv_update" ) ; } if ( error_code ) { info ( "_slurm_rpc_resv_update reservation=%s: %s" , resv_desc_ptr -> name , slurm_strerror ( error_code ) ) ; slurm_send_rc_msg ( msg , error_code ) ; } else { debug2 ( "_slurm_rpc_resv_update complete for %s %s" , resv_desc_ptr -> name , TIME_STR ) ; slurm_send_rc_msg ( msg , SLURM_SUCCESS ) ; queue_job_scheduler ( ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
struct config_filter_parser * const * config_filter_find_subset ( struct config_filter_context * ctx , const struct config_filter * filter ) { ARRAY_TYPE ( config_filter_parsers ) matches ; struct config_filter tmp_mask ; unsigned int i ; t_array_init ( & matches , 8 ) ; for ( i = 0 ; ctx -> parsers [ i ] != NULL ; i ++ ) { const struct config_filter * mask = & ctx -> parsers [ i ] -> filter ; if ( filter -> service != NULL ) { if ( ! config_filter_match_service ( mask , filter ) ) continue ; } tmp_mask = * mask ; if ( filter -> local_name == NULL ) tmp_mask . local_name = NULL ; if ( filter -> local_bits == 0 ) tmp_mask . local_bits = 0 ; if ( filter -> remote_bits == 0 ) tmp_mask . remote_bits = 0 ; if ( config_filter_match_rest ( & tmp_mask , filter ) ) array_append ( & matches , & ctx -> parsers [ i ] , 1 ) ; } array_sort ( & matches , config_filter_parser_cmp_rev ) ; array_append_zero ( & matches ) ; return array_idx ( & matches , 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void pxa2xx_rtc_swal2_tick ( void * opaque ) { PXA2xxRTCState * s = ( PXA2xxRTCState * ) opaque ; s -> rtsr |= ( 1 << 10 ) ; pxa2xx_rtc_alarm_update ( s , s -> rtsr ) ; pxa2xx_rtc_int_update ( s ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_zcl_scenes_remove_all_get_scene_membership ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) { proto_tree_add_item ( tree , hf_zbee_zcl_scenes_group_id , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ; * offset += 2 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int zcvlit ( i_ctx_t * i_ctx_p ) { os_ptr op = osp ; ref * aop ; check_op ( 1 ) ; aop = ACCESS_REF ( op ) ; r_clear_attrs ( aop , a_executable ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int upx_inflate2b ( const char * src , uint32_t ssize , char * dst , uint32_t * dsize , uint32_t upx0 , uint32_t upx1 , uint32_t ep ) { int32_t backbytes , unp_offset = - 1 ; uint32_t backsize , myebx = 0 , scur = 0 , dcur = 0 , i , magic [ ] = { 0x108 , 0x110 , 0xd5 , 0 } ; int oob ; while ( 1 ) { while ( ( oob = doubleebx ( src , & myebx , & scur , ssize ) ) == 1 ) { if ( scur >= ssize || dcur >= * dsize ) return - 1 ; dst [ dcur ++ ] = src [ scur ++ ] ; } if ( oob == - 1 ) return - 1 ; backbytes = 1 ; while ( 1 ) { if ( ( oob = doubleebx ( src , & myebx , & scur , ssize ) ) == - 1 ) return - 1 ; backbytes = backbytes * 2 + oob ; if ( ( oob = doubleebx ( src , & myebx , & scur , ssize ) ) == - 1 ) return - 1 ; if ( oob ) break ; } backbytes -= 3 ; if ( backbytes >= 0 ) { if ( scur >= ssize ) return - 1 ; backbytes <<= 8 ; backbytes += ( unsigned char ) ( src [ scur ++ ] ) ; backbytes ^= 0xffffffff ; if ( ! backbytes ) break ; unp_offset = backbytes ; } if ( ( backsize = ( uint32_t ) doubleebx ( src , & myebx , & scur , ssize ) ) == 0xffffffff ) return - 1 ; if ( ( oob = doubleebx ( src , & myebx , & scur , ssize ) ) == - 1 ) return - 1 ; backsize = backsize * 2 + oob ; if ( ! backsize ) { backsize ++ ; do { if ( ( oob = doubleebx ( src , & myebx , & scur , ssize ) ) == - 1 ) return - 1 ; backsize = backsize * 2 + oob ; } while ( ( oob = doubleebx ( src , & myebx , & scur , ssize ) ) == 0 ) ; if ( oob == - 1 ) return - 1 ; backsize += 2 ; } if ( ( uint32_t ) unp_offset < 0xfffff300 ) backsize ++ ; backsize ++ ; if ( ! CLI_ISCONTAINED ( dst , * dsize , dst + dcur + unp_offset , backsize ) || ! CLI_ISCONTAINED ( dst , * dsize , dst + dcur , backsize ) || unp_offset >= 0 ) return - 1 ; for ( i = 0 ; i < backsize ; i ++ ) dst [ dcur + i ] = dst [ dcur + unp_offset + i ] ; dcur += backsize ; } return pefromupx ( src , ssize , dst , dsize , ep , upx0 , upx1 , magic , dcur ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void kadmin_getprinc ( int argc , char * argv [ ] ) { kadm5_principal_ent_rec dprinc ; krb5_principal princ = NULL ; krb5_error_code retval ; const char * polname , * noexist ; char * canon = NULL , * princstr = NULL , * modprincstr = NULL ; int i ; size_t j ; if ( ! ( argc == 2 || ( argc == 3 && ! strcmp ( "-terse" , argv [ 1 ] ) ) ) ) { fprintf ( stderr , _ ( "usage: get_principal [-terse] principal\n" ) ) ; return ; } memset ( & dprinc , 0 , sizeof ( dprinc ) ) ; retval = kadmin_parse_name ( argv [ argc - 1 ] , & princ ) ; if ( retval ) { com_err ( "get_principal" , retval , _ ( "while parsing principal" ) ) ; return ; } retval = krb5_unparse_name ( context , princ , & canon ) ; if ( retval ) { com_err ( "get_principal" , retval , _ ( "while canonicalizing principal" ) ) ; goto cleanup ; } retval = kadm5_get_principal ( handle , princ , & dprinc , KADM5_PRINCIPAL_NORMAL_MASK | KADM5_KEY_DATA ) ; if ( retval ) { com_err ( "get_principal" , retval , _ ( "while retrieving \"%s\"." ) , canon ) ; goto cleanup ; } retval = krb5_unparse_name ( context , dprinc . principal , & princstr ) ; if ( retval ) { com_err ( "get_principal" , retval , _ ( "while unparsing principal" ) ) ; goto cleanup ; } retval = krb5_unparse_name ( context , dprinc . mod_name , & modprincstr ) ; if ( retval ) { com_err ( "get_principal" , retval , _ ( "while unparsing principal" ) ) ; goto cleanup ; } if ( argc == 2 ) { printf ( _ ( "Principal: %s\n" ) , princstr ) ; printf ( _ ( "Expiration date: %s\n" ) , dprinc . princ_expire_time ? strdate ( dprinc . princ_expire_time ) : _ ( "[never]" ) ) ; printf ( _ ( "Last password change: %s\n" ) , dprinc . last_pwd_change ? strdate ( dprinc . last_pwd_change ) : _ ( "[never]" ) ) ; printf ( _ ( "Password expiration date: %s\n" ) , dprinc . pw_expiration ? strdate ( dprinc . pw_expiration ) : _ ( "[none]" ) ) ; printf ( _ ( "Maximum ticket life: %s\n" ) , strdur ( dprinc . max_life ) ) ; printf ( _ ( "Maximum renewable life: %s\n" ) , strdur ( dprinc . max_renewable_life ) ) ; printf ( _ ( "Last modified: %s (%s)\n" ) , strdate ( dprinc . mod_date ) , modprincstr ) ; printf ( _ ( "Last successful authentication: %s\n" ) , dprinc . last_success ? strdate ( dprinc . last_success ) : _ ( "[never]" ) ) ; printf ( "Last failed authentication: %s\n" , dprinc . last_failed ? strdate ( dprinc . last_failed ) : "[never]" ) ; printf ( _ ( "Failed password attempts: %d\n" ) , dprinc . fail_auth_count ) ; printf ( _ ( "Number of keys: %d\n" ) , dprinc . n_key_data ) ; for ( i = 0 ; i < dprinc . n_key_data ; i ++ ) { krb5_key_data * key_data = & dprinc . key_data [ i ] ; char enctype [ BUFSIZ ] , salttype [ BUFSIZ ] ; if ( krb5_enctype_to_name ( key_data -> key_data_type [ 0 ] , FALSE , enctype , sizeof ( enctype ) ) ) snprintf ( enctype , sizeof ( enctype ) , _ ( "<Encryption type 0x%x>" ) , key_data -> key_data_type [ 0 ] ) ; printf ( "Key: vno %d, %s, " , key_data -> key_data_kvno , enctype ) ; if ( key_data -> key_data_ver > 1 ) { if ( krb5_salttype_to_string ( key_data -> key_data_type [ 1 ] , salttype , sizeof ( salttype ) ) ) snprintf ( salttype , sizeof ( salttype ) , _ ( "<Salt type 0x%x>" ) , key_data -> key_data_type [ 1 ] ) ; printf ( "%s\n" , salttype ) ; } else printf ( _ ( "no salt\n" ) ) ; } printf ( _ ( "MKey: vno %d\n" ) , dprinc . mkvno ) ; printf ( _ ( "Attributes:" ) ) ; for ( j = 0 ; j < sizeof ( prflags ) / sizeof ( char * ) ; j ++ ) { if ( dprinc . attributes & ( krb5_flags ) 1 << j ) printf ( " %s" , prflags [ j ] ) ; } printf ( "\n" ) ; polname = ( dprinc . policy != NULL ) ? dprinc . policy : _ ( "[none]" ) ; noexist = ( dprinc . policy != NULL && ! policy_exists ( dprinc . policy ) ) ? _ ( " [does not exist]" ) : "" ; printf ( _ ( "Policy: %s%s\n" ) , polname , noexist ) ; } else { printf ( "\"%s\"\t%d\t%d\t%d\t%d\t\"%s\"\t%d\t%d\t%d\t%d\t\"%s\"" "\t%d\t%d\t%d\t%d\t%d" , princstr , dprinc . princ_expire_time , dprinc . last_pwd_change , dprinc . pw_expiration , dprinc . max_life , modprincstr , dprinc . mod_date , dprinc . attributes , dprinc . kvno , dprinc . mkvno , dprinc . policy ? dprinc . policy : "[none]" , dprinc . max_renewable_life , dprinc . last_success , dprinc . last_failed , dprinc . fail_auth_count , dprinc . n_key_data ) ; for ( i = 0 ; i < dprinc . n_key_data ; i ++ ) printf ( "\t%d\t%d\t%d\t%d" , dprinc . key_data [ i ] . key_data_ver , dprinc . key_data [ i ] . key_data_kvno , dprinc . key_data [ i ] . key_data_type [ 0 ] , dprinc . key_data [ i ] . key_data_type [ 1 ] ) ; printf ( "\n" ) ; } cleanup : krb5_free_principal ( context , princ ) ; kadm5_free_principal_ent ( handle , & dprinc ) ; free ( canon ) ; free ( princstr ) ; free ( modprincstr ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline Quantum GetPixelMagenta ( const Image * restrict image , const Quantum * restrict pixel ) { return ( pixel [ image -> channel_map [ MagentaPixelChannel ] . offset ] ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplFileInfo , func_name ) \ { \ spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; \ zend_error_handling error_handling ; \ if ( zend_parse_parameters_none ( ) == FAILURE ) { \ return ; \ } \ \ zend_replace_error_handling ( EH_THROW , spl_ce_RuntimeException , & error_handling TSRMLS_CC ) ; \ spl_filesystem_object_get_file_name ( intern TSRMLS_CC ) ; \ php_stat ( intern -> file_name , intern -> file_name_len , func_num , return_value TSRMLS_CC ) ; \ zend_restore_error_handling ( & error_handling TSRMLS_CC ) ; \ } FileInfoFunction ( getPerms , FS_PERMS ) FileInfoFunction ( getInode , FS_INODE ) FileInfoFunction ( getSize , FS_SIZE ) FileInfoFunction ( getOwner , FS_OWNER ) FileInfoFunction ( getGroup , FS_GROUP )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int SpoolssEnumPrinters_q ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) { guint32 level , flags ; dcerpc_call_value * dcv = ( dcerpc_call_value * ) di -> call_data ; static const int * hf_flags [ ] = { & hf_enumprinters_flags_network , & hf_enumprinters_flags_shared , & hf_enumprinters_flags_remote , & hf_enumprinters_flags_name , & hf_enumprinters_flags_connections , & hf_enumprinters_flags_local , & hf_enumprinters_flags_default , NULL } ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , - 1 , & flags ) ; proto_tree_add_bitmask_value ( tree , tvb , offset - 4 , hf_enumprinters_flags , ett_enumprinters_flags , hf_flags , flags ) ; offset = dissect_ndr_str_pointer_item ( tvb , offset , pinfo , tree , di , drep , NDR_POINTER_UNIQUE , "Server name" , hf_servername , 0 ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_level , & level ) ; if ( ! pinfo -> fd -> flags . visited ) { dcv -> se_data = GINT_TO_POINTER ( ( int ) level ) ; } col_append_fstr ( pinfo -> cinfo , COL_INFO , ", level %d" , level ) ; offset = dissect_spoolss_buffer ( tvb , offset , pinfo , tree , di , drep , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_offered , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * strsep ( char * * s , const char * del ) { char * d , * tok ; assert ( strlen ( del ) == 1 ) ; if ( ! s || ! * s ) return NULL ; tok = * s ; d = strstr ( tok , del ) ; if ( d ) { * d = '\0' ; * s = d + 1 ; } else * s = NULL ; return tok ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int isFileInVirtualDir ( char * filePath ) { virtualDirList * pCurVirtualDir ; size_t webDirLen ; pCurVirtualDir = pVirtualDirList ; while ( pCurVirtualDir != NULL ) { webDirLen = strlen ( pCurVirtualDir -> dirName ) ; if ( webDirLen ) { if ( pCurVirtualDir -> dirName [ webDirLen - 1 ] == '/' ) { if ( strncmp ( pCurVirtualDir -> dirName , filePath , webDirLen ) == 0 ) return ! 0 ; } else { if ( strncmp ( pCurVirtualDir -> dirName , filePath , webDirLen ) == 0 && ( filePath [ webDirLen ] == '/' || filePath [ webDirLen ] == '\0' || filePath [ webDirLen ] == '?' ) ) return ! 0 ; } } pCurVirtualDir = pCurVirtualDir -> next ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
METHOD ( certificate_t , get_validity , bool , private_x509_cert_t * this , time_t * when , time_t * not_before , time_t * not_after ) { time_t t = when ? * when : time ( NULL ) ; if ( not_before ) { * not_before = this -> notBefore ; } if ( not_after ) { * not_after = this -> notAfter ; } return ( t >= this -> notBefore && t <= this -> notAfter ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void crypto_policy_set_null_cipher_hmac_sha1_80 ( crypto_policy_t * p ) { p -> cipher_type = NULL_CIPHER ; p -> cipher_key_len = 0 ; p -> auth_type = HMAC_SHA1 ; p -> auth_key_len = 20 ; p -> auth_tag_len = 10 ; p -> sec_serv = sec_serv_auth ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( ContentSettingBubbleDialogTest , InvokeDialog_images ) { RunDialog ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int TSHttpTxnIsInternal ( TSHttpTxn txnp ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; return TSHttpSsnIsInternal ( TSHttpTxnSsnGet ( txnp ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
const EVP_CIPHER * EVP_aes_ ## keylen ## _ ## mode ( void ) \ { return & aes_ ## keylen ## _ ## mode ; } # endif # if defined ( OPENSSL_CPUID_OBJ ) && ( defined ( __arm__ ) || defined ( __arm ) || defined ( __aarch64__ ) ) # include "arm_arch.h" # if __ARM_MAX_ARCH__ >= 7 # if defined ( BSAES_ASM ) # define BSAES_CAPABLE ( OPENSSL_armcap_P & ARMV7_NEON ) # endif # if defined ( VPAES_ASM ) # define VPAES_CAPABLE ( OPENSSL_armcap_P & ARMV7_NEON ) # endif # define HWAES_CAPABLE ( OPENSSL_armcap_P & ARMV8_AES ) # define HWAES_set_encrypt_key aes_v8_set_encrypt_key # define HWAES_set_decrypt_key aes_v8_set_decrypt_key # define HWAES_encrypt aes_v8_encrypt # define HWAES_decrypt aes_v8_decrypt # define HWAES_cbc_encrypt aes_v8_cbc_encrypt # define HWAES_ctr32_encrypt_blocks aes_v8_ctr32_encrypt_blocks # endif # endif # if defined ( HWAES_CAPABLE ) int HWAES_set_encrypt_key ( const unsigned char * userKey , const int bits , AES_KEY * key ) ; int HWAES_set_decrypt_key ( const unsigned char * userKey , const int bits , AES_KEY * key ) ; void HWAES_encrypt ( const unsigned char * in , unsigned char * out , const AES_KEY * key ) ; void HWAES_decrypt ( const unsigned char * in , unsigned char * out , const AES_KEY * key ) ; void HWAES_cbc_encrypt ( const unsigned char * in , unsigned char * out , size_t length , const AES_KEY * key , unsigned char * ivec , const int enc ) ; void HWAES_ctr32_encrypt_blocks ( const unsigned char * in , unsigned char * out , size_t len , const AES_KEY * key , const unsigned char ivec [ 16 ] ) ; void HWAES_xts_encrypt ( const unsigned char * inp , unsigned char * out , size_t len , const AES_KEY * key1 , const AES_KEY * key2 , const unsigned char iv [ 16 ] ) ; void HWAES_xts_decrypt ( const unsigned char * inp , unsigned char * out , size_t len , const AES_KEY * key1 , const AES_KEY * key2 , const unsigned char iv [ 16 ] ) ; # endif # define BLOCK_CIPHER_generic_pack ( nid , keylen , flags ) \ BLOCK_CIPHER_generic ( nid , keylen , 16 , 16 , cbc , cbc , CBC , flags | EVP_CIPH_FLAG_DEFAULT_ASN1 ) \ BLOCK_CIPHER_generic ( nid , keylen , 16 , 0 , ecb , ecb , ECB , flags | EVP_CIPH_FLAG_DEFAULT_ASN1 ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , ofb128 , ofb , OFB , flags | EVP_CIPH_FLAG_DEFAULT_ASN1 ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , cfb128 , cfb , CFB , flags | EVP_CIPH_FLAG_DEFAULT_ASN1 ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , cfb1 , cfb1 , CFB , flags ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , cfb8 , cfb8 , CFB , flags ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , ctr , ctr , CTR , flags ) static int aes_init_key ( EVP_CIPHER_CTX * ctx , const unsigned char * key , const unsigned char * iv , int enc ) { int ret , mode ; EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ; mode = EVP_CIPHER_CTX_mode ( ctx ) ; if ( ( mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE ) && ! enc ) { # ifdef HWAES_CAPABLE if ( HWAES_CAPABLE ) { ret = HWAES_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ; dat -> block = ( block128_f ) HWAES_decrypt ; dat -> stream . cbc = NULL ; # ifdef HWAES_cbc_encrypt if ( mode == EVP_CIPH_CBC_MODE ) dat -> stream . cbc = ( cbc128_f ) HWAES_cbc_encrypt ; # endif } else # endif # ifdef BSAES_CAPABLE if ( BSAES_CAPABLE && mode == EVP_CIPH_CBC_MODE ) { ret = AES_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ; dat -> block = ( block128_f ) AES_decrypt ; dat -> stream . cbc = ( cbc128_f ) bsaes_cbc_encrypt ; } else # endif # ifdef VPAES_CAPABLE if ( VPAES_CAPABLE ) { ret = vpaes_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ; dat -> block = ( block128_f ) vpaes_decrypt ; dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) vpaes_cbc_encrypt : NULL ; } else # endif { ret = AES_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ; dat -> block = ( block128_f ) AES_decrypt ; dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) AES_cbc_encrypt : NULL ; } } else # ifdef HWAES_CAPABLE if ( HWAES_CAPABLE ) { ret = HWAES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ; dat -> block = ( block128_f ) HWAES_encrypt ; dat -> stream . cbc = NULL ; # ifdef HWAES_cbc_encrypt if ( mode == EVP_CIPH_CBC_MODE ) dat -> stream . cbc = ( cbc128_f ) HWAES_cbc_encrypt ; else # endif # ifdef HWAES_ctr32_encrypt_blocks if ( mode == EVP_CIPH_CTR_MODE ) dat -> stream . ctr = ( ctr128_f ) HWAES_ctr32_encrypt_blocks ; else # endif ( void ) 0 ; } else # endif # ifdef BSAES_CAPABLE if ( BSAES_CAPABLE && mode == EVP_CIPH_CTR_MODE ) { ret = AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ; dat -> block = ( block128_f ) AES_encrypt ; dat -> stream . ctr = ( ctr128_f ) bsaes_ctr32_encrypt_blocks ; } else # endif # ifdef VPAES_CAPABLE if ( VPAES_CAPABLE ) { ret = vpaes_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ; dat -> block = ( block128_f ) vpaes_encrypt ; dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) vpaes_cbc_encrypt : NULL ; } else # endif { ret = AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ; dat -> block = ( block128_f ) AES_encrypt ; dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) AES_cbc_encrypt : NULL ; # ifdef AES_CTR_ASM if ( mode == EVP_CIPH_CTR_MODE ) dat -> stream . ctr = ( ctr128_f ) AES_ctr32_encrypt ; # endif } if ( ret < 0 ) { EVPerr ( EVP_F_AES_INIT_KEY , EVP_R_AES_KEY_SETUP_FAILED ) ; return 0 ; } return 1 ; } static int aes_cbc_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ; if ( dat -> stream . cbc ) ( * dat -> stream . cbc ) ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , EVP_CIPHER_CTX_encrypting ( ctx ) ) ; else if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) CRYPTO_cbc128_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , dat -> block ) ; else CRYPTO_cbc128_decrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , dat -> block ) ; return 1 ; } static int aes_ecb_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { size_t bl = EVP_CIPHER_CTX_block_size ( ctx ) ; size_t i ; EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ; if ( len < bl ) return 1 ; for ( i = 0 , len -= bl ; i <= len ; i += bl ) ( * dat -> block ) ( in + i , out + i , & dat -> ks ) ; return 1 ; } static int aes_ofb_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ; int num = EVP_CIPHER_CTX_num ( ctx ) ; CRYPTO_ofb128_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , dat -> block ) ; EVP_CIPHER_CTX_set_num ( ctx , num ) ; return 1 ; } static int aes_cfb_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ; int num = EVP_CIPHER_CTX_num ( ctx ) ; CRYPTO_cfb128_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ; EVP_CIPHER_CTX_set_num ( ctx , num ) ; return 1 ; } static int aes_cfb8_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ; int num = EVP_CIPHER_CTX_num ( ctx ) ; CRYPTO_cfb128_8_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ; EVP_CIPHER_CTX_set_num ( ctx , num ) ; return 1 ; } static int aes_cfb1_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ; if ( EVP_CIPHER_CTX_test_flags ( ctx , EVP_CIPH_FLAG_LENGTH_BITS ) ) { int num = EVP_CIPHER_CTX_num ( ctx ) ; CRYPTO_cfb128_1_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ; EVP_CIPHER_CTX_set_num ( ctx , num ) ; return 1 ; } while ( len >= MAXBITCHUNK ) { int num = EVP_CIPHER_CTX_num ( ctx ) ; CRYPTO_cfb128_1_encrypt ( in , out , MAXBITCHUNK * 8 , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ; EVP_CIPHER_CTX_set_num ( ctx , num ) ; len -= MAXBITCHUNK ; } if ( len ) { int num = EVP_CIPHER_CTX_num ( ctx ) ; CRYPTO_cfb128_1_encrypt ( in , out , len * 8 , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ; EVP_CIPHER_CTX_set_num ( ctx , num ) ; } return 1 ; } static int aes_ctr_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { unsigned int num = EVP_CIPHER_CTX_num ( ctx ) ; EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ; if ( dat -> stream . ctr ) CRYPTO_ctr128_encrypt_ctr32 ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , EVP_CIPHER_CTX_buf_noconst ( ctx ) , & num , dat -> stream . ctr ) ; else CRYPTO_ctr128_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , EVP_CIPHER_CTX_buf_noconst ( ctx ) , & num , dat -> block ) ; EVP_CIPHER_CTX_set_num ( ctx , num ) ; return 1 ; } BLOCK_CIPHER_generic_pack ( NID_aes , 128 , 0 ) BLOCK_CIPHER_generic_pack ( NID_aes , 192 , 0 ) BLOCK_CIPHER_generic_pack ( NID_aes , 256 , 0 ) static int aes_gcm_cleanup ( EVP_CIPHER_CTX * c ) { EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , c ) ; OPENSSL_cleanse ( & gctx -> gcm , sizeof ( gctx -> gcm ) ) ; if ( gctx -> iv != EVP_CIPHER_CTX_iv_noconst ( c ) ) OPENSSL_free ( gctx -> iv ) ; return 1 ; } static void ctr64_inc ( unsigned char * counter ) { int n = 8 ; unsigned char c ; do { -- n ; c = counter [ n ] ; ++ c ; counter [ n ] = c ; if ( c ) return ; } while ( n ) ; } static int aes_gcm_ctrl ( EVP_CIPHER_CTX * c , int type , int arg , void * ptr ) { EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , c ) ; switch ( type ) { case EVP_CTRL_INIT : gctx -> key_set = 0 ; gctx -> iv_set = 0 ; gctx -> ivlen = EVP_CIPHER_CTX_iv_length ( c ) ; gctx -> iv = EVP_CIPHER_CTX_iv_noconst ( c ) ; gctx -> taglen = - 1 ; gctx -> iv_gen = 0 ; gctx -> tls_aad_len = - 1 ; return 1 ; case EVP_CTRL_AEAD_SET_IVLEN : if ( arg <= 0 ) return 0 ; if ( ( arg > EVP_MAX_IV_LENGTH ) && ( arg > gctx -> ivlen ) ) { if ( gctx -> iv != EVP_CIPHER_CTX_iv_noconst ( c ) ) OPENSSL_free ( gctx -> iv ) ; gctx -> iv = OPENSSL_malloc ( arg ) ; if ( gctx -> iv == NULL ) return 0 ; } gctx -> ivlen = arg ; return 1 ; case EVP_CTRL_AEAD_SET_TAG : if ( arg <= 0 || arg > 16 || EVP_CIPHER_CTX_encrypting ( c ) ) return 0 ; memcpy ( EVP_CIPHER_CTX_buf_noconst ( c ) , ptr , arg ) ; gctx -> taglen = arg ; return 1 ; case EVP_CTRL_AEAD_GET_TAG : if ( arg <= 0 || arg > 16 || ! EVP_CIPHER_CTX_encrypting ( c ) || gctx -> taglen < 0 ) return 0 ; memcpy ( ptr , EVP_CIPHER_CTX_buf_noconst ( c ) , arg ) ; return 1 ; case EVP_CTRL_GCM_SET_IV_FIXED : if ( arg == - 1 ) { memcpy ( gctx -> iv , ptr , gctx -> ivlen ) ; gctx -> iv_gen = 1 ; return 1 ; } if ( ( arg < 4 ) || ( gctx -> ivlen - arg ) < 8 ) return 0 ; if ( arg ) memcpy ( gctx -> iv , ptr , arg ) ; if ( EVP_CIPHER_CTX_encrypting ( c ) && RAND_bytes ( gctx -> iv + arg , gctx -> ivlen - arg ) <= 0 ) return 0 ; gctx -> iv_gen = 1 ; return 1 ; case EVP_CTRL_GCM_IV_GEN : if ( gctx -> iv_gen == 0 || gctx -> key_set == 0 ) return 0 ; CRYPTO_gcm128_setiv ( & gctx -> gcm , gctx -> iv , gctx -> ivlen ) ; if ( arg <= 0 || arg > gctx -> ivlen ) arg = gctx -> ivlen ; memcpy ( ptr , gctx -> iv + gctx -> ivlen - arg , arg ) ; ctr64_inc ( gctx -> iv + gctx -> ivlen - 8 ) ; gctx -> iv_set = 1 ; return 1 ; case EVP_CTRL_GCM_SET_IV_INV : if ( gctx -> iv_gen == 0 || gctx -> key_set == 0 || EVP_CIPHER_CTX_encrypting ( c ) ) return 0 ; memcpy ( gctx -> iv + gctx -> ivlen - arg , ptr , arg ) ; CRYPTO_gcm128_setiv ( & gctx -> gcm , gctx -> iv , gctx -> ivlen ) ; gctx -> iv_set = 1 ; return 1 ; case EVP_CTRL_AEAD_TLS1_AAD : if ( arg != EVP_AEAD_TLS1_AAD_LEN ) return 0 ; memcpy ( EVP_CIPHER_CTX_buf_noconst ( c ) , ptr , arg ) ; gctx -> tls_aad_len = arg ; { unsigned int len = EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 2 ] << 8 | EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 1 ] ; len -= EVP_GCM_TLS_EXPLICIT_IV_LEN ; if ( ! EVP_CIPHER_CTX_encrypting ( c ) ) len -= EVP_GCM_TLS_TAG_LEN ; EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 2 ] = len >> 8 ; EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 1 ] = len & 0xff ; } return EVP_GCM_TLS_TAG_LEN ; case EVP_CTRL_COPY : { EVP_CIPHER_CTX * out = ptr ; EVP_AES_GCM_CTX * gctx_out = EVP_C_DATA ( EVP_AES_GCM_CTX , out ) ; if ( gctx -> gcm . key ) { if ( gctx -> gcm . key != & gctx -> ks ) return 0 ; gctx_out -> gcm . key = & gctx_out -> ks ; } if ( gctx -> iv == EVP_CIPHER_CTX_iv_noconst ( c ) ) gctx_out -> iv = EVP_CIPHER_CTX_iv_noconst ( out ) ; else { gctx_out -> iv = OPENSSL_malloc ( gctx -> ivlen ) ; if ( gctx_out -> iv == NULL ) return 0 ; memcpy ( gctx_out -> iv , gctx -> iv , gctx -> ivlen ) ; } return 1 ; } default : return - 1 ; } } static int aes_gcm_init_key ( EVP_CIPHER_CTX * ctx , const unsigned char * key , const unsigned char * iv , int enc ) { EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , ctx ) ; if ( ! iv && ! key ) return 1 ; if ( key ) { do { # ifdef HWAES_CAPABLE if ( HWAES_CAPABLE ) { HWAES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & gctx -> ks . ks ) ; CRYPTO_gcm128_init ( & gctx -> gcm , & gctx -> ks , ( block128_f ) HWAES_encrypt ) ; # ifdef HWAES_ctr32_encrypt_blocks gctx -> ctr = ( ctr128_f ) HWAES_ctr32_encrypt_blocks ; # else gctx -> ctr = NULL ; # endif break ; } else # endif # ifdef BSAES_CAPABLE if ( BSAES_CAPABLE ) { AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & gctx -> ks . ks ) ; CRYPTO_gcm128_init ( & gctx -> gcm , & gctx -> ks , ( block128_f ) AES_encrypt ) ; gctx -> ctr = ( ctr128_f ) bsaes_ctr32_encrypt_blocks ; break ; } else # endif # ifdef VPAES_CAPABLE if ( VPAES_CAPABLE ) { vpaes_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & gctx -> ks . ks ) ; CRYPTO_gcm128_init ( & gctx -> gcm , & gctx -> ks , ( block128_f ) vpaes_encrypt ) ; gctx -> ctr = NULL ; break ; } else # endif ( void ) 0 ; AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & gctx -> ks . ks ) ; CRYPTO_gcm128_init ( & gctx -> gcm , & gctx -> ks , ( block128_f ) AES_encrypt ) ; # ifdef AES_CTR_ASM gctx -> ctr = ( ctr128_f ) AES_ctr32_encrypt ; # else gctx -> ctr = NULL ; # endif } while ( 0 ) ; if ( iv == NULL && gctx -> iv_set ) iv = gctx -> iv ; if ( iv ) { CRYPTO_gcm128_setiv ( & gctx -> gcm , iv , gctx -> ivlen ) ; gctx -> iv_set = 1 ; } gctx -> key_set = 1 ; } else { if ( gctx -> key_set ) CRYPTO_gcm128_setiv ( & gctx -> gcm , iv , gctx -> ivlen ) ; else memcpy ( gctx -> iv , iv , gctx -> ivlen ) ; gctx -> iv_set = 1 ; gctx -> iv_gen = 0 ; } return 1 ; } static int aes_gcm_tls_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , ctx ) ; int rv = - 1 ; if ( out != in || len < ( EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN ) ) return - 1 ; if ( EVP_CIPHER_CTX_ctrl ( ctx , EVP_CIPHER_CTX_encrypting ( ctx ) ? EVP_CTRL_GCM_IV_GEN : EVP_CTRL_GCM_SET_IV_INV , EVP_GCM_TLS_EXPLICIT_IV_LEN , out ) <= 0 ) goto err ; if ( CRYPTO_gcm128_aad ( & gctx -> gcm , EVP_CIPHER_CTX_buf_noconst ( ctx ) , gctx -> tls_aad_len ) ) goto err ; in += EVP_GCM_TLS_EXPLICIT_IV_LEN ; out += EVP_GCM_TLS_EXPLICIT_IV_LEN ; len -= EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN ; if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) { if ( gctx -> ctr ) { size_t bulk = 0 ; # if defined ( AES_GCM_ASM ) if ( len >= 32 && AES_GCM_ASM ( gctx ) ) { if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , NULL , NULL , 0 ) ) return - 1 ; bulk = AES_gcm_encrypt ( in , out , len , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ; gctx -> gcm . len . u [ 1 ] += bulk ; } # endif if ( CRYPTO_gcm128_encrypt_ctr32 ( & gctx -> gcm , in + bulk , out + bulk , len - bulk , gctx -> ctr ) ) goto err ; } else { size_t bulk = 0 ; # if defined ( AES_GCM_ASM2 ) if ( len >= 32 && AES_GCM_ASM2 ( gctx ) ) { if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , NULL , NULL , 0 ) ) return - 1 ; bulk = AES_gcm_encrypt ( in , out , len , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ; gctx -> gcm . len . u [ 1 ] += bulk ; } # endif if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , in + bulk , out + bulk , len - bulk ) ) goto err ; } out += len ; CRYPTO_gcm128_tag ( & gctx -> gcm , out , EVP_GCM_TLS_TAG_LEN ) ; rv = len + EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN ; } else { if ( gctx -> ctr ) { size_t bulk = 0 ; # if defined ( AES_GCM_ASM ) if ( len >= 16 && AES_GCM_ASM ( gctx ) ) { if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , NULL , NULL , 0 ) ) return - 1 ; bulk = AES_gcm_decrypt ( in , out , len , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ; gctx -> gcm . len . u [ 1 ] += bulk ; } # endif if ( CRYPTO_gcm128_decrypt_ctr32 ( & gctx -> gcm , in + bulk , out + bulk , len - bulk , gctx -> ctr ) ) goto err ; } else { size_t bulk = 0 ; # if defined ( AES_GCM_ASM2 ) if ( len >= 16 && AES_GCM_ASM2 ( gctx ) ) { if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , NULL , NULL , 0 ) ) return - 1 ; bulk = AES_gcm_decrypt ( in , out , len , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ; gctx -> gcm . len . u [ 1 ] += bulk ; } # endif if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , in + bulk , out + bulk , len - bulk ) ) goto err ; } CRYPTO_gcm128_tag ( & gctx -> gcm , EVP_CIPHER_CTX_buf_noconst ( ctx ) , EVP_GCM_TLS_TAG_LEN ) ; if ( CRYPTO_memcmp ( EVP_CIPHER_CTX_buf_noconst ( ctx ) , in + len , EVP_GCM_TLS_TAG_LEN ) ) { OPENSSL_cleanse ( out , len ) ; goto err ; } rv = len ; } err : gctx -> iv_set = 0 ; gctx -> tls_aad_len = - 1 ; return rv ; } static int aes_gcm_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , ctx ) ; if ( ! gctx -> key_set ) return - 1 ; if ( gctx -> tls_aad_len >= 0 ) return aes_gcm_tls_cipher ( ctx , out , in , len ) ; if ( ! gctx -> iv_set ) return - 1 ; if ( in ) { if ( out == NULL ) { if ( CRYPTO_gcm128_aad ( & gctx -> gcm , in , len ) ) return - 1 ; } else if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) { if ( gctx -> ctr ) { size_t bulk = 0 ; # if defined ( AES_GCM_ASM ) if ( len >= 32 && AES_GCM_ASM ( gctx ) ) { size_t res = ( 16 - gctx -> gcm . mres ) % 16 ; if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , in , out , res ) ) return - 1 ; bulk = AES_gcm_encrypt ( in + res , out + res , len - res , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ; gctx -> gcm . len . u [ 1 ] += bulk ; bulk += res ; } # endif if ( CRYPTO_gcm128_encrypt_ctr32 ( & gctx -> gcm , in + bulk , out + bulk , len - bulk , gctx -> ctr ) ) return - 1 ; } else { size_t bulk = 0 ; # if defined ( AES_GCM_ASM2 ) if ( len >= 32 && AES_GCM_ASM2 ( gctx ) ) { size_t res = ( 16 - gctx -> gcm . mres ) % 16 ; if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , in , out , res ) ) return - 1 ; bulk = AES_gcm_encrypt ( in + res , out + res , len - res , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ; gctx -> gcm . len . u [ 1 ] += bulk ; bulk += res ; } # endif if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , in + bulk , out + bulk , len - bulk ) ) return - 1 ; } } else { if ( gctx -> ctr ) { size_t bulk = 0 ; # if defined ( AES_GCM_ASM ) if ( len >= 16 && AES_GCM_ASM ( gctx ) ) { size_t res = ( 16 - gctx -> gcm . mres ) % 16 ; if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , in , out , res ) ) return - 1 ; bulk = AES_gcm_decrypt ( in + res , out + res , len - res , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ; gctx -> gcm . len . u [ 1 ] += bulk ; bulk += res ; } # endif if ( CRYPTO_gcm128_decrypt_ctr32 ( & gctx -> gcm , in + bulk , out + bulk , len - bulk , gctx -> ctr ) ) return - 1 ; } else { size_t bulk = 0 ; # if defined ( AES_GCM_ASM2 ) if ( len >= 16 && AES_GCM_ASM2 ( gctx ) ) { size_t res = ( 16 - gctx -> gcm . mres ) % 16 ; if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , in , out , res ) ) return - 1 ; bulk = AES_gcm_decrypt ( in + res , out + res , len - res , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ; gctx -> gcm . len . u [ 1 ] += bulk ; bulk += res ; } # endif if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , in + bulk , out + bulk , len - bulk ) ) return - 1 ; } } return len ; } else { if ( ! EVP_CIPHER_CTX_encrypting ( ctx ) ) { if ( gctx -> taglen < 0 ) return - 1 ; if ( CRYPTO_gcm128_finish ( & gctx -> gcm , EVP_CIPHER_CTX_buf_noconst ( ctx ) , gctx -> taglen ) != 0 ) return - 1 ; gctx -> iv_set = 0 ; return 0 ; } CRYPTO_gcm128_tag ( & gctx -> gcm , EVP_CIPHER_CTX_buf_noconst ( ctx ) , 16 ) ; gctx -> taglen = 16 ; gctx -> iv_set = 0 ; return 0 ; } } # define CUSTOM_FLAGS ( EVP_CIPH_FLAG_DEFAULT_ASN1 \ | EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_CUSTOM_CIPHER \ | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT \ | EVP_CIPH_CUSTOM_COPY ) BLOCK_CIPHER_custom ( NID_aes , 128 , 1 , 12 , gcm , GCM , EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS )
1True
Categorize the following code snippet as vulnerable or not. True or False
static void qbus_print ( Monitor * mon , BusState * bus , int indent ) { struct DeviceState * dev ; qdev_printf ( "bus: %s\n" , bus -> name ) ; indent += 2 ; qdev_printf ( "type %s\n" , bus -> info -> name ) ; QLIST_FOREACH ( dev , & bus -> children , sibling ) { qdev_print ( mon , dev , indent ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void EVP_DecodeInit ( EVP_ENCODE_CTX * ctx ) { ctx -> num = 0 ; ctx -> length = 0 ; ctx -> line_num = 0 ; ctx -> expect_nl = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gint dissect_bta2dp ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) { proto_item * ti ; proto_tree * bta2dp_tree ; proto_item * pitem ; gint offset = 0 ; dissector_handle_t codec_dissector = NULL ; bta2dp_codec_info_t bta2dp_codec_info ; sep_data_t sep_data ; gboolean no_avdtp_session ; no_avdtp_session = ( proto_btavdtp != ( gint ) GPOINTER_TO_UINT ( wmem_list_frame_data ( wmem_list_frame_prev ( wmem_list_tail ( pinfo -> layers ) ) ) ) ) ; sep_data . codec = CODEC_SBC ; sep_data . content_protection_type = 0 ; sep_data . acp_seid = 0 ; sep_data . int_seid = 0 ; sep_data . previous_media_packet_info = NULL ; sep_data . current_media_packet_info = NULL ; sep_data . stream_start_in_frame = 0 ; sep_data . stream_end_in_frame = 0 ; sep_data . stream_number = 1 ; sep_data . vendor_id = 0 ; sep_data . vendor_codec = 0 ; sep_data . configuration_length = 0 ; sep_data . configuration = NULL ; if ( force_a2dp_scms_t || force_a2dp_codec != CODEC_DEFAULT ) { if ( force_a2dp_scms_t ) sep_data . content_protection_type = 2 ; else if ( data && ! no_avdtp_session ) sep_data . content_protection_type = ( ( sep_data_t * ) data ) -> content_protection_type ; if ( force_a2dp_codec != CODEC_DEFAULT ) sep_data . codec = force_a2dp_codec ; else if ( data && ! no_avdtp_session ) sep_data . codec = ( ( sep_data_t * ) data ) -> codec ; } else { if ( data && ! no_avdtp_session ) sep_data = * ( ( sep_data_t * ) data ) ; } col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "A2DP" ) ; switch ( pinfo -> p2p_dir ) { case P2P_DIR_SENT : col_set_str ( pinfo -> cinfo , COL_INFO , "Sent " ) ; break ; case P2P_DIR_RECV : col_set_str ( pinfo -> cinfo , COL_INFO , "Rcvd " ) ; break ; case P2P_DIR_UNKNOWN : col_clear ( pinfo -> cinfo , COL_INFO ) ; break ; default : col_add_fstr ( pinfo -> cinfo , COL_INFO , "Unknown direction %d " , pinfo -> p2p_dir ) ; break ; } ti = proto_tree_add_item ( tree , proto_bta2dp , tvb , offset , - 1 , ENC_NA ) ; col_append_fstr ( pinfo -> cinfo , COL_INFO , "Audio stream - %s" , val_to_str_const ( sep_data . codec , media_codec_audio_type_vals , "unknown codec" ) ) ; bta2dp_tree = proto_item_add_subtree ( ti , ett_bta2dp ) ; pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_acp_seid , tvb , 0 , 0 , sep_data . acp_seid ) ; PROTO_ITEM_SET_GENERATED ( pitem ) ; pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_int_seid , tvb , 0 , 0 , sep_data . int_seid ) ; PROTO_ITEM_SET_GENERATED ( pitem ) ; pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_codec , tvb , 0 , 0 , sep_data . codec ) ; PROTO_ITEM_SET_GENERATED ( pitem ) ; if ( sep_data . codec == 0xFF ) { pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_vendor_id , tvb , 0 , 0 , sep_data . vendor_id ) ; PROTO_ITEM_SET_GENERATED ( pitem ) ; pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_vendor_codec_id , tvb , 0 , 0 , sep_data . vendor_codec ) ; PROTO_ITEM_SET_GENERATED ( pitem ) ; if ( sep_data . vendor_id == 0x004F && sep_data . vendor_codec == 0x0001 ) codec_dissector = aptx_handle ; } if ( sep_data . content_protection_type > 0 ) { pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_content_protection , tvb , 0 , 0 , sep_data . content_protection_type ) ; PROTO_ITEM_SET_GENERATED ( pitem ) ; } if ( sep_data . stream_start_in_frame > 0 ) { pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_stream_start_in_frame , tvb , 0 , 0 , sep_data . stream_start_in_frame ) ; PROTO_ITEM_SET_GENERATED ( pitem ) ; } if ( sep_data . stream_end_in_frame > 0 ) { pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_stream_end_in_frame , tvb , 0 , 0 , sep_data . stream_end_in_frame ) ; PROTO_ITEM_SET_GENERATED ( pitem ) ; } pitem = proto_tree_add_uint ( bta2dp_tree , hf_bta2dp_stream_number , tvb , 0 , 0 , sep_data . stream_number ) ; PROTO_ITEM_SET_GENERATED ( pitem ) ; switch ( sep_data . codec ) { case CODEC_SBC : codec_dissector = sbc_handle ; break ; case CODEC_MPEG12_AUDIO : codec_dissector = mp2t_handle ; break ; case CODEC_MPEG24_AAC : codec_dissector = mpeg_audio_handle ; break ; case CODEC_ATRAC : codec_dissector = atrac_handle ; break ; case CODEC_APT_X : codec_dissector = aptx_handle ; break ; } bta2dp_codec_info . codec_dissector = codec_dissector ; bta2dp_codec_info . configuration_length = sep_data . configuration_length ; bta2dp_codec_info . configuration = sep_data . configuration ; bta2dp_codec_info . content_protection_type = sep_data . content_protection_type ; bta2dp_codec_info . previous_media_packet_info = sep_data . previous_media_packet_info ; bta2dp_codec_info . current_media_packet_info = sep_data . current_media_packet_info ; # if RTP_PLAYER_WORKAROUND == TRUE pinfo -> srcport = sep_data . stream_number ; pinfo -> destport = sep_data . stream_number ; # endif if ( bta2dp_codec_info . content_protection_type == 0 && codec_dissector == aptx_handle ) { call_dissector_with_data ( aptx_handle , tvb , pinfo , tree , & bta2dp_codec_info ) ; } else { bluetooth_add_address ( pinfo , & pinfo -> net_dst , sep_data . stream_number , "BT A2DP" , pinfo -> num , RTP_MEDIA_AUDIO , & bta2dp_codec_info ) ; call_dissector ( rtp_handle , tvb , pinfo , tree ) ; } offset += tvb_reported_length_remaining ( tvb , offset ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static cmsBool ismiddle ( int c ) { return ( ! isseparator ( c ) && ( c != '#' ) && ( c != '\"' ) && ( c != '\'' ) && ( c > 32 ) && ( c < 127 ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) { return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ; } static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } 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 )
1True
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( AutocompleteResultTest , SortAndCullWithMatchDupsAndDemotionsByType ) { ACMatches matches ; const AutocompleteMatchTestData data [ ] = { { "http://search-what-you-typed/" , AutocompleteMatchType : : SEARCH_WHAT_YOU_TYPED } , { "http://dup-url/" , AutocompleteMatchType : : HISTORY_URL } , { "http://dup-url/" , AutocompleteMatchType : : NAVSUGGEST } , { "http://search-url/" , AutocompleteMatchType : : SEARCH_SUGGEST } , { "http://history-url/" , AutocompleteMatchType : : HISTORY_URL } , } ; PopulateAutocompleteMatchesFromTestData ( data , arraysize ( data ) , & matches ) ; { std : : map < std : : string , std : : string > params ; params [ std : : string ( OmniboxFieldTrial : : kDemoteByTypeRule ) + ":8:*" ] = "1:50" ; ASSERT_TRUE ( variations : : AssociateVariationParams ( OmniboxFieldTrial : : kBundledExperimentFieldTrialName , "C" , params ) ) ; } base : : FieldTrialList : : CreateFieldTrial ( OmniboxFieldTrial : : kBundledExperimentFieldTrialName , "C" ) ; { AutocompleteInput input ( base : : string16 ( ) , base : : string16 : : npos , std : : string ( ) , GURL ( ) , OmniboxEventProto : : INSTANT_NTP_WITH_FAKEBOX_AS_STARTING_FOCUS , false , false , false , true , false , TestSchemeClassifier ( ) ) ; AutocompleteResult result ; result . AppendMatches ( input , matches ) ; result . SortAndCull ( input , std : : string ( ) , template_url_service_ . get ( ) ) ; ASSERT_EQ ( 4u , result . size ( ) ) ; EXPECT_EQ ( "http://search-what-you-typed/" , result . match_at ( 0 ) -> destination_url . spec ( ) ) ; EXPECT_EQ ( "http://dup-url/" , result . match_at ( 1 ) -> destination_url . spec ( ) ) ; EXPECT_EQ ( AutocompleteMatchType : : NAVSUGGEST , result . match_at ( 1 ) -> type ) ; EXPECT_EQ ( "http://search-url/" , result . match_at ( 2 ) -> destination_url . spec ( ) ) ; EXPECT_EQ ( "http://history-url/" , result . match_at ( 3 ) -> destination_url . spec ( ) ) ; } }
1True
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 ) { WNV1Context * const l = avctx -> priv_data ; const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; AVFrame * const p = & l -> pic ; unsigned char * Y , * U , * V ; int i , j , ret ; int prev_y = 0 , prev_u = 0 , prev_v = 0 ; uint8_t * rbuf ; rbuf = av_malloc ( buf_size + FF_INPUT_BUFFER_PADDING_SIZE ) ; if ( ! rbuf ) { av_log ( avctx , AV_LOG_ERROR , "Cannot allocate temporary buffer\n" ) ; return AVERROR ( ENOMEM ) ; } if ( p -> data [ 0 ] ) avctx -> release_buffer ( avctx , p ) ; p -> reference = 0 ; if ( ( ret = ff_get_buffer ( avctx , p ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; av_free ( rbuf ) ; return ret ; } p -> key_frame = 1 ; for ( i = 8 ; i < buf_size ; i ++ ) rbuf [ i ] = ff_reverse [ buf [ i ] ] ; init_get_bits ( & l -> gb , rbuf + 8 , ( buf_size - 8 ) * 8 ) ; if ( buf [ 2 ] >> 4 == 6 ) l -> shift = 2 ; else { l -> shift = 8 - ( buf [ 2 ] >> 4 ) ; if ( l -> shift > 4 ) { av_log_ask_for_sample ( avctx , "Unknown WNV1 frame header value %i\n" , buf [ 2 ] >> 4 ) ; l -> shift = 4 ; } if ( l -> shift < 1 ) { av_log_ask_for_sample ( avctx , "Unknown WNV1 frame header value %i\n" , buf [ 2 ] >> 4 ) ; l -> shift = 1 ; } } Y = p -> data [ 0 ] ; U = p -> data [ 1 ] ; V = p -> data [ 2 ] ; for ( j = 0 ; j < avctx -> height ; j ++ ) { for ( i = 0 ; i < avctx -> width / 2 ; i ++ ) { Y [ i * 2 ] = wnv1_get_code ( l , prev_y ) ; prev_u = U [ i ] = wnv1_get_code ( l , prev_u ) ; prev_y = Y [ ( i * 2 ) + 1 ] = wnv1_get_code ( l , Y [ i * 2 ] ) ; prev_v = V [ i ] = wnv1_get_code ( l , prev_v ) ; } Y += p -> linesize [ 0 ] ; U += p -> linesize [ 1 ] ; V += p -> linesize [ 2 ] ; } * got_frame = 1 ; * ( AVFrame * ) data = l -> pic ; av_free ( rbuf ) ; return buf_size ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int evhttp_hostportfile ( char * url , char * * phost , u_short * pport , char * * pfile ) { static char host [ 1024 ] ; static char file [ 1024 ] ; char * p ; const char * p2 ; int len ; u_short port ; len = strlen ( HTTP_PREFIX ) ; if ( strncasecmp ( url , HTTP_PREFIX , len ) ) return ( - 1 ) ; url += len ; if ( strlcpy ( host , url , sizeof ( host ) ) >= sizeof ( host ) ) return ( - 1 ) ; p = strchr ( host , '/' ) ; if ( p != NULL ) { * p = '\0' ; p2 = p + 1 ; } else p2 = NULL ; if ( pfile != NULL ) { if ( p2 == NULL ) p2 = "" ; evutil_snprintf ( file , sizeof ( file ) , "/%s" , p2 ) ; } p = strchr ( host , ':' ) ; if ( p != NULL ) { * p = '\0' ; port = atoi ( p + 1 ) ; if ( port == 0 ) return ( - 1 ) ; } else port = HTTP_DEFAULTPORT ; if ( phost != NULL ) * phost = host ; if ( pport != NULL ) * pport = port ; if ( pfile != NULL ) * pfile = file ; return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
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 void evhttp_write_connectioncb ( struct evhttp_connection * evcon , void * arg ) { struct evhttp_request * req = TAILQ_FIRST ( & evcon -> requests ) ; assert ( req != NULL ) ; assert ( evcon -> state == EVCON_WRITING ) ; req -> kind = EVHTTP_RESPONSE ; evhttp_start_read ( evcon ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
time_t TSCacheHttpInfoReqSentTimeGet ( TSCacheHttpInfo infop ) { CacheHTTPInfo * info = ( CacheHTTPInfo * ) infop ; return info -> request_sent_time_get ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void sig_complete_unalias ( GList * * list , WINDOW_REC * window , const char * word , const char * line , int * want_space ) { g_return_if_fail ( list != NULL ) ; g_return_if_fail ( word != NULL ) ; * list = completion_get_aliases ( word ) ; if ( * list != NULL ) signal_stop ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vp9_get_preview_raw_frame ( VP9_COMP * cpi , YV12_BUFFER_CONFIG * dest , vp9_ppflags_t * flags ) { VP9_COMMON * cm = & cpi -> common ; # if ! CONFIG_VP9_POSTPROC ( void ) flags ; # endif if ( ! cm -> show_frame ) { return - 1 ; } else { int ret ; # if CONFIG_VP9_POSTPROC ret = vp9_post_proc_frame ( cm , dest , flags ) ; # else if ( cm -> frame_to_show ) { * dest = * cm -> frame_to_show ; dest -> y_width = cm -> width ; dest -> y_height = cm -> height ; dest -> uv_width = cm -> width >> cm -> subsampling_x ; dest -> uv_height = cm -> height >> cm -> subsampling_y ; ret = 0 ; } else { ret = - 1 ; } # endif vp9_clear_system_state ( ) ; return ret ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int checkHttpTxnClientIPGet ( SocketTest * test , void * data ) { sockaddr const * ptr ; in_addr_t ip ; TSHttpTxn txnp = ( TSHttpTxn ) data ; in_addr_t actual_ip = htonl ( INADDR_LOOPBACK ) ; ptr = TSHttpTxnClientAddrGet ( txnp ) ; if ( ptr == nullptr || INADDR_ANY == ( ip = ats_ip4_addr_cast ( ptr ) ) ) { test -> test_client_ip_get = false ; SDK_RPRINT ( test -> regtest , "TSHttpTxnClientIPGet" , "TestCase1" , TC_FAIL , "TSHttpTxnClientIPGet returns 0 %s" , ptr ? "address" : "pointer" ) ; return TS_EVENT_CONTINUE ; } if ( ip == actual_ip ) { test -> test_client_ip_get = true ; SDK_RPRINT ( test -> regtest , "TSHttpTxnClientIPGet" , "TestCase1" , TC_PASS , "ok [%0.8x]" , ip ) ; } else { test -> test_client_ip_get = false ; SDK_RPRINT ( test -> regtest , "TSHttpTxnClientIPGet" , "TestCase1" , TC_FAIL , "Value's Mismatch [expected %.8x got %.8x]" , actual_ip , ip ) ; } return TS_EVENT_CONTINUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int evhttp_parse_response_line ( struct evhttp_request * req , char * line ) { char * protocol ; char * number ; const char * readable = "" ; protocol = strsep ( & line , " " ) ; if ( line == NULL ) return ( - 1 ) ; number = strsep ( & line , " " ) ; if ( line != NULL ) readable = line ; if ( strcmp ( protocol , "HTTP/1.0" ) == 0 ) { req -> major = 1 ; req -> minor = 0 ; } else if ( strcmp ( protocol , "HTTP/1.1" ) == 0 ) { req -> major = 1 ; req -> minor = 1 ; } else { event_debug ( ( "%s: bad protocol \"%s\"" , __func__ , protocol ) ) ; return ( - 1 ) ; } req -> response_code = atoi ( number ) ; if ( ! evhttp_valid_response_code ( req -> response_code ) ) { event_debug ( ( "%s: bad response code \"%s\"" , __func__ , number ) ) ; return ( - 1 ) ; } if ( ( req -> response_code_line = strdup ( readable ) ) == NULL ) event_err ( 1 , "%s: strdup" , __func__ ) ; return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
bool fn_format_relative_to_data_home ( char * to , const char * name , const char * dir , const char * extension ) { char tmp_path [ FN_REFLEN ] ; if ( ! test_if_hard_path ( dir ) ) { strxnmov ( tmp_path , sizeof ( tmp_path ) - 1 , mysql_real_data_home , dir , NullS ) ; dir = tmp_path ; } return ! fn_format ( to , name , dir , extension , MY_APPEND_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
bool req_key_h ( connection_t * c ) { char from_name [ MAX_STRING_SIZE ] ; char to_name [ MAX_STRING_SIZE ] ; node_t * from , * to ; if ( sscanf ( c -> buffer , "%*d " MAX_STRING " " MAX_STRING , from_name , to_name ) != 2 ) { logger ( LOG_ERR , "Got bad %s from %s (%s)" , "REQ_KEY" , c -> name , c -> hostname ) ; return false ; } if ( ! check_id ( from_name ) || ! check_id ( to_name ) ) { logger ( LOG_ERR , "Got bad %s from %s (%s): %s" , "REQ_KEY" , c -> name , c -> hostname , "invalid name" ) ; return false ; } from = lookup_node ( from_name ) ; if ( ! from ) { logger ( LOG_ERR , "Got %s from %s (%s) origin %s which does not exist in our connection list" , "REQ_KEY" , c -> name , c -> hostname , from_name ) ; return true ; } to = lookup_node ( to_name ) ; if ( ! to ) { logger ( LOG_ERR , "Got %s from %s (%s) destination %s which does not exist in our connection list" , "REQ_KEY" , c -> name , c -> hostname , to_name ) ; return true ; } if ( to == myself ) { if ( ! send_ans_key ( from ) ) { return false ; } } else { if ( tunnelserver ) { return true ; } if ( ! to -> status . reachable ) { logger ( LOG_WARNING , "Got %s from %s (%s) destination %s which is not reachable" , "REQ_KEY" , c -> name , c -> hostname , to_name ) ; return true ; } send_request ( to -> nexthop -> connection , "%s" , c -> buffer ) ; } return true ; }
0False