Unnamed: 0 int64 0 535k | source stringlengths 43 32.1k | target stringlengths 15 6.24k |
|---|---|---|
0 | CWE-000 static int bnxt_req_msix_vecs ( struct bnxt_en_dev * edev , int ulp_id , struct bnxt_msix_entry * ent , int num_msix ) { struct net_device * dev = edev -> net ; struct bnxt * bp = netdev_priv ( dev ) ; int max_idx , max_cp_rings ; int avail_msix , idx ; int rc = 0 ; ASSERT_RTNL ( ) ; if ( ulp_id != BNXT_ROCE_ULP ) return - EINVAL ; if ( ! ( bp -> flags & BNXT_FLAG_USING_MSIX ) ) return - ENODEV ; if ( edev -> ulp_tbl [ ulp_id ] . msix_requested ) return - EAGAIN ; max_cp_rings = bnxt_get_max_func_cp_rings ( bp ) ; avail_msix = bnxt_get_avail_msix ( bp , num_msix ) ; if ( ! avail_msix ) return - ENOMEM ; if ( avail_msix > num_msix ) avail_msix = num_msix ; if ( bp -> flags & BNXT_FLAG_NEW_RM ) { idx = bp -> cp_nr_rings ; } else { max_idx = min_t ( int , bp -> total_irqs , max_cp_rings ) ; idx = max_idx - avail_msix ; } edev -> ulp_tbl [ ulp_id ] . msix_base = idx ; edev -> ulp_tbl [ ulp_id ] . msix_requested = avail_msix ; if ( bp -> total_irqs < ( idx + avail_msix ) ) { if ( netif_running ( dev ) ) { bnxt_close_nic ( bp , true , false ) ; rc = bnxt_open_nic ( bp , true , false ) ; } else { rc = bnxt_reserve_rings ( bp ) ; } } if ( rc ) { edev -> ulp_tbl [ ulp_id ] . msix_requested = 0 ; return - EAGAIN ; } if ( bp -> flags & BNXT_FLAG_NEW_RM ) { struct bnxt_hw_resc * hw_resc = & bp -> hw_resc ; avail_msix = hw_resc -> resv_cp_rings - bp -> cp_nr_rings ; edev -> ulp_tbl [ ulp_id ] . msix_requested = avail_msix ; } bnxt_fill_msix_vecs ( bp , ent ) ; <vul-start> bnxt_set_max_func_irqs ( bp , bnxt_get_max_func_irqs ( bp ) - avail_msix ) ; <vul-end> bnxt_set_max_func_cp_rings ( bp , max_cp_rings - avail_msix ) ; edev -> flags |= BNXT_EN_FLAG_MSIX_REQUESTED ; return avail_msix ; }
| <vul-start> ent ) ; <vul-end> bnxt_set_max_func_cp_rings ( bp
|
1 | CWE-000 static int read_word ( int addr , int * data ) { unsigned char request [ 8 ] ; unsigned char response [ 8 ] ; sim_interval -= UNIBUS_MEM_CYCLE ; if ( ( ten11_action_unit -> flags & UNIT_ATT ) == 0 ) { * data = 0 ; return 0 ; } if ( ten11_action_unit -> flags & UNIT_SHMEM ) { * data = ten11_M [ addr >> 1 ] ; return 0 ; } memset ( request , 0 , sizeof request ) ; build ( request , DATI ) ; build ( request , addr >> 16 ) ; build ( request , addr >> 8 ) ; build ( request , addr ) ; transaction ( request , response ) ; switch ( response [ 0 ] ) { case ACK : <vul-start> * data = response [ 4 ] ; <vul-end> <vul-start> * data |= response [ 3 ] << 8 ; <vul-end> break ; case ERR : fprintf ( stderr , "TEN11: Read error %06o\\r\\n" , addr ) ; * data = 0 ; break ; case TIMEOUT : fprintf ( stderr , "TEN11: Read timeout %06o\\r\\n" , addr ) ; * data = 0 ; break ; default : return error ( "Protocol error" ) ; } return 0 ; }
| <vul-start> = response [ 2 <vul-end> ] ; * <vul-start> |= response [ 1 <vul-end> ] << 8 <vul-start> ] << 8 ; sim_debug ( DEBUG_TEN11 , & cpu_dev , "Read word %06o\\n" , * data )
|
2 | CWE-000 static void bind_vars ( tpl_query * q , unsigned point1 , unsigned point2 ) { point1 -= q -> envs [ point1 ] . binding ; point2 -= q -> envs [ point2 ] . binding ; q -> envs [ point2 ] . binding = ( signed ) point2 - ( signed ) point1 ; <vul-start> q -> trails [ q -> trail_point + q -> trail_size ++ ] = point2 ; <vul-end> }
| <vul-start> ) point1 ; if ( ( point2 < q -> curr_frame ) || ( point2 >= ( q -> curr_frame + q -> frame_size ) ) )
|
3 | CWE-000 void rtc_clk_cpu_freq_set_fast ( rtc_cpu_freq_t cpu_freq ) { if ( cpu_freq == s_cur_freq ) { return ; } else if ( cpu_freq == RTC_CPU_FREQ_2M || s_cur_freq == RTC_CPU_FREQ_2M ) { rtc_clk_cpu_freq_set ( cpu_freq ) ; } else if ( cpu_freq == RTC_CPU_FREQ_XTAL ) { rtc_clk_cpu_freq_to_xtal ( ) ; } else if ( cpu_freq > RTC_CPU_FREQ_XTAL ) { rtc_clk_cpu_freq_to_pll ( cpu_freq ) ; <vul-start> } <vul-end> }
| <vul-start> cpu_freq ) ; rtc_clk_wait_for_slow_cycle ( ) ;
|
4 | CWE-000 static inline int static_same_rte ( struct static_route * x , struct static_route * y ) { <vul-start> return static_same_dest ( x , y ) && i_same ( x -> cmds , y -> cmds ) ; <vul-end> }
| <vul-start> && i_same ( y <vul-end> -> cmds , <vul-start> -> cmds , x <vul-end> -> cmds )
|
5 | CWE-000 <vul-start> static PHP_METHOD ( Phalcon_Db_Adapter , releaseSavepoint ) { <vul-end> zend_long ZEPHIR_LAST_CALL_STATUS ; zval * name_param = NULL , dialect , _0 , _1 , _2 ; zval name ; <vul-start> zval * this_ptr = getThis ( ) ; <vul-end> ZVAL_UNDEF ( & name ) ; ZVAL_UNDEF ( & dialect ) ; ZVAL_UNDEF ( & _0 ) ; ZVAL_UNDEF ( & _1 ) ; ZVAL_UNDEF ( & _2 ) ; ZEPHIR_MM_GROW ( ) ; zephir_fetch_params ( 1 , 1 , 0 , & name_param ) ; if ( UNEXPECTED ( Z_TYPE_P ( name_param ) != IS_STRING && Z_TYPE_P ( name_param ) != IS_NULL ) ) { zephir_throw_exception_string ( spl_ce_InvalidArgumentException , SL ( "Parameter \'name\' must be a string" ) TSRMLS_CC ) ; RETURN_MM_NULL ( ) ; } if ( EXPECTED ( Z_TYPE_P ( name_param ) == IS_STRING ) ) { zephir_get_strval ( & name , name_param ) ; } else { ZEPHIR_INIT_VAR ( & name ) ; ZVAL_EMPTY_STRING ( & name ) ; } ZEPHIR_OBS_VAR ( & dialect ) ; zephir_read_property ( & dialect , this_ptr , SL ( "_dialect" ) , PH_NOISY_CC ) ; ZEPHIR_CALL_METHOD ( & _0 , & dialect , "supportssavepoints" , NULL , 0 ) ; zephir_check_call_status ( ) ; if ( ! ( zephir_is_true ( & _0 ) ) ) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR ( phalcon_db_exception_ce , "Savepoints are not supported by this database adapter" , "phalcon/db/adapter.zep" , 1037 ) ; return ; } ZEPHIR_CALL_METHOD ( & _1 , & dialect , "supportsreleasesavepoints" , NULL , 0 ) ; zephir_check_call_status ( ) ; if ( ! ( zephir_is_true ( & _1 ) ) ) { RETURN_MM_BOOL ( 0 ) ; } ZEPHIR_CALL_METHOD ( & _2 , & dialect , "releasesavepoint" , NULL , 0 , & name ) ; zephir_check_call_status ( ) ; ZEPHIR_RETURN_CALL_METHOD ( this_ptr , "execute" , NULL , 0 , & _2 ) ; zephir_check_call_status ( ) ; RETURN_MM ( ) ; }
| <vul-start> static PHP_METHOD ( Phalcon_Assets_Collection , getAttributes ) { RETURN_MEMBER ( <vul-end> getThis ( ) <vul-start> getThis ( ) , "_attributes" <vul-end> ) ; }
|
6 | CWE-000 <vul-start> int ep_curve_opt_b ( ) { <vul-end> return core_get ( ) -> ep_opt_b ; }
| <vul-start> int ep_curve_opt_b ( void
|
7 | CWE-000 static int msm_lsm_ioctl ( struct snd_pcm_substream * substream , unsigned int cmd , void * arg ) { unsigned long flags ; int ret ; struct snd_lsm_sound_model snd_model ; int rc = 0 ; int xchg = 0 ; int size = 0 ; struct snd_lsm_event_status * event_status = NULL ; struct snd_pcm_runtime * runtime = substream -> runtime ; struct lsm_priv * prtd = runtime -> private_data ; struct snd_lsm_event_status * user = arg ; mutex_lock ( & prtd -> lsm_api_lock ) ; pr_debug ( "%s: enter cmd %x\\n" , __func__ , cmd ) ; switch ( cmd ) { case SNDRV_LSM_REG_SND_MODEL : pr_debug ( "%s: Registering sound model\\n" , __func__ ) ; if ( copy_from_user ( & snd_model , ( void * ) arg , sizeof ( struct snd_lsm_sound_model ) ) ) { rc = - EFAULT ; pr_err ( "%s: copy from user failed, size %d\\n" , __func__ , sizeof ( struct snd_lsm_sound_model ) ) ; break ; } rc = q6lsm_snd_model_buf_alloc ( prtd -> lsm_client , snd_model . data_size ) ; if ( rc ) { pr_err ( "%s: q6lsm buffer alloc failed, size %d\\n" , __func__ , snd_model . data_size ) ; break ; } if ( copy_from_user ( prtd -> lsm_client -> sound_model . data , snd_model . data , snd_model . data_size ) ) { pr_err ( "%s: copy from user data failed data %p size %d\\n" , __func__ , snd_model . data , snd_model . data_size ) ; rc = - EFAULT ; break ; } rc = q6lsm_register_sound_model ( prtd -> lsm_client , snd_model . detection_mode , snd_model . min_keyw_confidence , snd_model . min_user_confidence , snd_model . detect_failure ) ; if ( rc < 0 ) { pr_err ( "%s: q6lsm_register_sound_model failed =%d\\n" , __func__ , rc ) ; q6lsm_snd_model_buf_free ( prtd -> lsm_client ) ; } break ; case SNDRV_LSM_DEREG_SND_MODEL : pr_debug ( "%s: Deregistering sound model\\n" , __func__ ) ; rc = q6lsm_deregister_sound_model ( prtd -> lsm_client ) ; break ; case SNDRV_LSM_EVENT_STATUS : pr_debug ( "%s: Get event status\\n" , __func__ ) ; atomic_set ( & prtd -> event_wait_stop , 0 ) ; mutex_unlock ( & prtd -> lsm_api_lock ) ; <vul-start> rc = wait_event_interruptible ( prtd -> event_wait , <vul-end> ( cmpxchg ( & prtd -> event_avail , 1 , 0 ) || ( xchg = atomic_cmpxchg ( & prtd -> event_wait_stop , 1 , 0 ) ) ) ) ; mutex_lock ( & prtd -> lsm_api_lock ) ; <vul-start> pr_debug ( "%s: wait_event_interruptible %d event_wait_stop %d\\n" , <vul-end> __func__ , rc , xchg ) ; if ( ! rc && ! xchg ) { pr_debug ( "%s: New event available %ld\\n" , __func__ , prtd -> event_avail ) ; spin_lock_irqsave ( & prtd -> event_lock , flags ) ; if ( prtd -> event_status ) { size = sizeof ( * event_status ) + prtd -> event_status -> payload_size ; event_status = kmemdup ( prtd -> event_status , size , GFP_ATOMIC ) ; } spin_unlock_irqrestore ( & prtd -> event_lock , flags ) ; if ( ! event_status ) { pr_err ( "%s: Couldn\'t allocate %d bytes\\n" , __func__ , size ) ; rc = - EFAULT ; } else { if ( ! access_ok ( VERIFY_READ , user , sizeof ( struct snd_lsm_event_status ) ) ) rc = - EFAULT ; if ( user -> payload_size < event_status -> payload_size ) { pr_debug ( "%s: provided %dbytes isn\'t enough, needs %dbytes\\n" , __func__ , user -> payload_size , size ) ; rc = - ENOMEM ; } else if ( ! access_ok ( VERIFY_WRITE , arg , size ) ) { rc = - EFAULT ; } else { rc = copy_to_user ( arg , event_status , size ) ; if ( rc ) pr_err ( "%s: copy to user failed %d\\n" , __func__ , rc ) ; } kfree ( event_status ) ; } } else if ( xchg ) { pr_debug ( "%s: Wait aborted\\n" , __func__ ) ; rc = 0 ; } break ; case SNDRV_LSM_ABORT_EVENT : pr_debug ( "%s: Aborting event status wait\\n" , __func__ ) ; atomic_set ( & prtd -> event_wait_stop , 1 ) ; wake_up ( & prtd -> event_wait ) ; break ; case SNDRV_LSM_START : pr_debug ( "%s: Starting LSM client session\\n" , __func__ ) ; if ( ! prtd -> lsm_client -> started ) { ret = q6lsm_start ( prtd -> lsm_client , true ) ; if ( ! ret ) { prtd -> lsm_client -> started = true ; pr_debug ( "%s: LSM client session started\\n" , __func__ ) ; } } break ; case SNDRV_LSM_STOP : pr_debug ( "%s: Stopping LSM client session\\n" , __func__ ) ; if ( prtd -> lsm_client -> started ) { ret = q6lsm_stop ( prtd -> lsm_client , true ) ; if ( ! ret ) pr_debug ( "%s: LSM client session stopped %d\\n" , __func__ , ret ) ; prtd -> lsm_client -> started = false ; } break ; default : pr_debug ( "%s: Falling into default snd_lib_ioctl cmd 0x%x\\n" , __func__ , cmd ) ; rc = snd_pcm_lib_ioctl ( substream , cmd , arg ) ; break ; } if ( ! rc ) pr_debug ( "%s: leave (%d)\\n" , __func__ , rc ) ; else pr_err ( "%s: cmd 0x%x failed %d\\n" , __func__ , cmd , rc ) ; mutex_unlock ( & prtd -> lsm_api_lock ) ; return rc ; }
| <vul-start> ; rc = wait_event_freezable <vul-end> ( prtd -> <vul-start> ; pr_debug ( "%s: wait_event_freezable %d event_wait_stop %d\\n" <vul-end> , __func__ ,
|
8 | CWE-000 int main ( int argc , char * argv [ ] ) { int c , error , gdb_port , err ; int max_vcpus , mptgen , memflags ; struct vmctx * ctx ; size_t memsize ; char * optstr ; int option_idx = 0 ; progname = basename ( argv [ 0 ] ) ; gdb_port = 0 ; guest_ncpus = 1 ; memsize = 256 * MB ; mptgen = 1 ; memflags = 0 ; quit_vm_loop = 0 ; hugetlb = 0 ; <vul-start> if ( signal ( SIGINT , sig_handler_term ) == SIG_ERR ) <vul-end> fprintf ( stderr , "cannot register handler for SIGINT\\n" ) ; optstr = "abehuwxACHIMPSTWYvk:r:B:p:g:c:s:m:l:U:G:i:" ; while ( ( c = getopt_long ( argc , argv , optstr , long_options , & option_idx ) ) != - 1 ) { switch ( c ) { case 'a' : x2apic_mode = 0 ; break ; case 'A' : acpi = 1 ; break ; case 'b' : enable_bvmcons ( ) ; break ; case 'p' : if ( pincpu_parse ( optarg ) != 0 ) { errx ( EX_USAGE , "invalid vcpu pinning configuration \'%s\'" , optarg ) ; } break ; case 'c' : guest_ncpus = atoi ( optarg ) ; break ; case 'C' : memflags |= VM_MEM_F_INCORE ; break ; case 'g' : gdb_port = atoi ( optarg ) ; break ; case 'i' : ioc_parse ( optarg ) ; break ; case 'l' : if ( lpc_device_parse ( optarg ) != 0 ) { errx ( EX_USAGE , "invalid lpc device configuration \'%s\'" , optarg ) ; } break ; case 's' : if ( pci_parse_slot ( optarg ) != 0 ) exit ( 1 ) ; else break ; case 'S' : memflags |= VM_MEM_F_WIRED ; break ; case 'm' : error = vm_parse_memsize ( optarg , & memsize ) ; if ( error ) errx ( EX_USAGE , "invalid memsize \'%s\'" , optarg ) ; break ; case 'H' : guest_vmexit_on_hlt = 1 ; break ; case 'I' : break ; case 'P' : guest_vmexit_on_pause = 1 ; break ; case 'e' : strictio = 1 ; break ; case 'u' : vrtc_enable_localtime ( 0 ) ; break ; case 'U' : guest_uuid_str = optarg ; break ; case 'w' : strictmsr = 0 ; break ; case 'W' : virtio_msix = 0 ; break ; case 'T' : if ( check_hugetlb_support ( ) ) hugetlb = 1 ; break ; case 'x' : x2apic_mode = 1 ; break ; case 'Y' : mptgen = 0 ; break ; case 'k' : if ( acrn_parse_kernel ( optarg ) != 0 ) exit ( 1 ) ; else break ; case 'r' : if ( acrn_parse_ramdisk ( optarg ) != 0 ) exit ( 1 ) ; else break ; case 'B' : if ( acrn_parse_bootargs ( optarg ) != 0 ) exit ( 1 ) ; else break ; break ; case 'M' : ptdev_prefer_msi ( false ) ; break ; case 'v' : print_version ( ) ; break ; case CMD_OPT_VSBL : if ( acrn_parse_vsbl ( optarg ) != 0 ) { errx ( EX_USAGE , "invalid vsbl param %s" , optarg ) ; exit ( 1 ) ; } break ; case CMD_OPT_PART_INFO : if ( acrn_parse_guest_part_info ( optarg ) != 0 ) { errx ( EX_USAGE , "invalid guest partition info param %s" , optarg ) ; exit ( 1 ) ; } break ; case CMD_OPT_TRUSTY_ENABLE : trusty_enabled = 1 ; break ; case 'h' : usage ( 0 ) ; default : usage ( 1 ) ; } } argc -= optind ; argv += optind ; if ( argc != 1 ) usage ( 1 ) ; vmname = argv [ 0 ] ; for ( ; ; ) { ctx = do_open ( vmname ) ; error = vm_set_shared_io_page ( ctx , ( unsigned long ) vhm_req_buf ) ; if ( error ) goto fail ; if ( guest_ncpus < 1 ) { fprintf ( stderr , "Invalid guest vCPUs (%d)\\n" , guest_ncpus ) ; goto fail ; } max_vcpus = num_vcpus_allowed ( ctx ) ; if ( guest_ncpus > max_vcpus ) { fprintf ( stderr , "%d vCPUs requested but %d available\\n" , guest_ncpus , max_vcpus ) ; goto fail ; } vm_set_memflags ( ctx , memflags ) ; err = vm_setup_memory ( ctx , memsize , VM_MMAP_ALL ) ; if ( err ) { fprintf ( stderr , "Unable to setup memory (%d)\\n" , errno ) ; goto fail ; } err = mevent_init ( ) ; if ( err ) { fprintf ( stderr , "Unable to initialize mevent (%d)\\n" , errno ) ; goto mevent_fail ; } if ( gdb_port != 0 ) fprintf ( stderr , "dbgport not supported\\n" ) ; if ( vm_init_vdevs ( ctx ) < 0 ) { fprintf ( stderr , "Unable to init vdev (%d)\\n" , errno ) ; goto dev_fail ; } if ( mptgen ) { error = mptable_build ( ctx , guest_ncpus ) ; if ( error ) { goto vm_fail ; } } error = smbios_build ( ctx ) ; if ( error ) goto vm_fail ; if ( acpi ) { error = acpi_build ( ctx , guest_ncpus ) ; if ( error ) goto vm_fail ; } error = acrn_sw_load ( ctx ) ; if ( error ) goto vm_fail ; add_cpu ( ctx , guest_ncpus ) ; _ctx = ctx ; mevent_dispatch ( ) ; vm_pause ( ctx ) ; delete_cpu ( ctx , BSP ) ; if ( vm_get_suspend_mode ( ) != VM_SUSPEND_RESET ) break ; vm_deinit_vdevs ( ctx ) ; mevent_deinit ( ) ; vm_unsetup_memory ( ctx ) ; vm_destroy ( ctx ) ; vm_close ( ctx ) ; _ctx = 0 ; vm_set_suspend_mode ( VM_SUSPEND_NONE ) ; } vm_fail : vm_deinit_vdevs ( ctx ) ; dev_fail : mevent_deinit ( ) ; mevent_fail : vm_unsetup_memory ( ctx ) ; fail : vm_destroy ( ctx ) ; vm_close ( ctx ) ; exit ( 0 ) ; }
| <vul-start> ( signal ( SIGHUP , sig_handler_term ) == SIG_ERR ) fprintf ( stderr , "cannot register handler for SIGHUP\\n" ) ; if ( signal (
|
9 | CWE-000 CipherBlock * cipherBlockNew ( CipherMode mode , const char * cipherName , const unsigned char * pass , int passSize , const char * digestName ) { <vul-start> if ( ! openSslInitDone ) <vul-end> { ERR_load_crypto_strings ( ) ; OpenSSL_add_all_algorithms ( ) ; openSslInitDone = true ; } const EVP_CIPHER * cipher = EVP_get_cipherbyname ( cipherName ) ; if ( ! cipher ) THROW ( AssertError , "unable to load cipher \'%s\'" , cipherName ) ; const EVP_MD * digest = NULL ; if ( digestName ) digest = EVP_get_digestbyname ( digestName ) ; else digest = EVP_sha1 ( ) ; if ( ! digest ) THROW ( AssertError , "unable to load digest \'%s\'" , digestName ) ; CipherBlock * this = NULL ; MEM_CONTEXT_NEW_BEGIN ( "cipherBlock" ) { this = memNew ( sizeof ( CipherBlock ) ) ; this -> memContext = MEM_CONTEXT_NEW ( ) ; this -> mode = mode ; this -> cipher = cipher ; this -> digest = digest ; this -> passSize = passSize ; this -> pass = memNewRaw ( this -> passSize ) ; memcpy ( this -> pass , pass , this -> passSize ) ; } MEM_CONTEXT_NEW_END ( ) ; return this ; }
| <vul-start> if ( ! cipherIsInit ( ) ) cipherInit ( ) ; <vul-end> const EVP_CIPHER *
|
10 | CWE-000 void basicOperations ( struct sockaddr_in6 * targetIP ) { struct config myConf = get_bb_config ( ) ; uint64_t alloc_latency [ myConf . num_hosts ] ; uint64_t * read_latency = calloc ( NUM_ITERATIONS , sizeof ( uint64_t ) ) ; uint64_t * write_latency = calloc ( NUM_ITERATIONS , sizeof ( uint64_t ) ) ; uint64_t free_latency [ myConf . num_hosts ] ; struct in6_memaddr * r_addr = malloc ( sizeof ( struct in6_memaddr ) * NUM_ITERATIONS ) ; if ( ! r_addr ) perror ( "Allocation too large" ) ; uint64_t split = NUM_ITERATIONS / myConf . num_hosts ; <vul-start> int length ; <vul-end> for ( int i = 0 ; i < myConf . num_hosts ; i ++ ) { uint64_t start = getns ( ) ; uint64_t offset = split * i ; if ( i == myConf . num_hosts - 1 ) length = NUM_ITERATIONS - offset ; else length = split ; struct in6_addr * ipv6Pointer = gen_ip6_target ( i ) ; memcpy ( & ( targetIP -> sin6_addr ) , ipv6Pointer , sizeof ( * ipv6Pointer ) ) ; struct in6_memaddr * temp = allocate_rmem_bulk ( targetIP , length ) ; memcpy ( & r_addr [ offset ] , temp , length * sizeof ( struct in6_memaddr ) ) ; free ( temp ) ; alloc_latency [ i ] = getns ( ) - start ; } <vul-start> for ( int i = 0 ; i < NUM_ITERATIONS ; i ++ ) { <vul-end> struct in6_memaddr remoteMemory = r_addr [ i ] ; print_debug ( "Creating payload" ) ; <vul-start> char * payload = malloc ( 4096 ) ; <vul-end> snprintf ( payload , 50 , "HELLO WORLD! How are you? %d" , i ) ; uint64_t wStart = getns ( ) ; write_rmem ( targetIP , payload , & remoteMemory ) ; write_latency [ i ] = getns ( ) - wStart ; free ( payload ) ; } char test [ BLOCK_SIZE ] ; <vul-start> for ( int i = 0 ; i < NUM_ITERATIONS ; i ++ ) { <vul-end> struct in6_memaddr remoteMemory = r_addr [ i ] ; uint64_t rStart = getns ( ) ; get_rmem ( test , BLOCK_SIZE , targetIP , & remoteMemory ) ; read_latency [ i ] = getns ( ) - rStart ; <vul-start> char * payload = malloc ( 4096 ) ; <vul-end> snprintf ( payload , 50 , "HELLO WORLD! How are you? %d" , i ) ; print_debug ( "Results of memory store: %.50s" , test ) ; if ( strncmp ( test , payload , 50 ) < 0 ) { perror ( KRED "ERROR: WRONG RESULT" RESET ) ; exit ( 1 ) ; } free ( payload ) ; } <vul-start> for ( int i = 0 ; i < myConf . num_hosts ; i ++ ) { <vul-end> uint64_t fStart = getns ( ) ; uint64_t offset = split * i ; free_rmem ( targetIP , & r_addr [ offset ] ) ; free_latency [ i ] = getns ( ) - fStart ; } save_time ( "alloc_t0" , alloc_latency , myConf . num_hosts ) ; save_time ( "read_t0" , read_latency , NUM_ITERATIONS ) ; save_time ( "write_t0" , write_latency , NUM_ITERATIONS ) ; save_time ( "free_t0" , free_latency , myConf . num_hosts ) ; <vul-start> } <vul-end>
| <vul-start> ; int length ; printf ( "Allocating...\\n" ) <vul-start> start ; } printf ( "Starting write test...\\n" ) ; <vul-start> = malloc ( BLOCK_SIZE <vul-end> ) ; snprintf <vul-start> BLOCK_SIZE ] ; printf ( "Starting read test...\\n" ) ; <vul-start> = malloc ( BLOCK_SIZE <vul-end> ) ; snprintf <vul-start> ) ; } printf ( "Freeing...\\n" ) ; <vul-start> num_hosts ) ; free ( read_latency ) ; free ( write_latency ) ;
|
11 | CWE-000 int intel_hdcp_enable ( struct intel_connector * connector ) { struct intel_hdcp * hdcp = & connector -> hdcp ; <vul-start> int ret ; <vul-end> if ( ! hdcp -> shim ) return - ENOENT ; mutex_lock ( & hdcp -> mutex ) ; <vul-start> ret = _intel_hdcp_enable ( connector ) ; <vul-end> <vul-start> if ( ret ) <vul-end> goto out ; hdcp -> value = DRM_MODE_CONTENT_PROTECTION_ENABLED ; schedule_work ( & hdcp -> prop_work ) ; <vul-start> schedule_delayed_work ( & hdcp -> check_work , <vul-end> DRM_HDCP_CHECK_PERIOD_MS ) ; out : mutex_unlock ( & hdcp -> mutex ) ; return ret ; }
| <vul-start> ; int ret = - EINVAL <vul-start> mutex ) ; if ( intel_hdcp2_capable ( connector ) ) ret = _intel_hdcp2_enable ( connector ) ; if ( ret && intel_hdcp_capable ( connector ) ) { <vul-start> ; if ( ! ret ) schedule_delayed_work ( & hdcp -> check_work , DRM_HDCP_CHECK_PERIOD_MS ) ; } if ( ! ret ) { <vul-end> hdcp -> value <vul-start> prop_work ) ; } <vul-end> mutex_unlock ( &
|
12 | CWE-000 static void captureToOffset ( RContext * c , Instr * instr , int offset , bool generated ) { assert ( offset >= 0 ) ; Instr * newInstr ; Rewriter * r = c -> r ; CBB * cbb = r -> currentCapBB ; if ( cbb == 0 ) return ; Instr restoreRegInstr ; bool saveTmpReg = false ; Operand * indOp = 0 ; Operand * otherOp ; switch ( instr -> form ) { break ; case OF_1 : if ( opIsInd ( & instr -> dst ) ) { indOp = & instr -> dst ; otherOp = 0 ; } break ; case OF_2 : if ( opIsInd ( & instr -> src ) ) { indOp = & instr -> src ; otherOp = & instr -> dst ; } else if ( opIsInd ( & instr -> dst ) ) { indOp = & instr -> dst ; otherOp = & instr -> src ; } break ; default : break ; } if ( indOp && ( ( int64_t ) indOp -> val > INT32_MAX ) ) { RegIndex freeReg = getUnusedReg ( c , otherOp , & saveTmpReg ) ; Reg tmpReg = getReg ( RT_GP64 , freeReg ) ; Operand * tmpRegOp = getRegOp ( tmpReg ) ; if ( saveTmpReg ) { Instr push ; initUnaryInstr ( & restoreRegInstr , IT_POP , tmpRegOp ) ; initUnaryInstr ( & push , IT_PUSH , tmpRegOp ) ; capture ( c , & push ) ; } Instr mov ; Operand * immOp = getImmOp ( VT_64 , indOp -> val ) ; initBinaryInstr ( & mov , IT_MOV , VT_64 , tmpRegOp , immOp ) ; indOp -> val = 0 ; indOp -> reg = tmpReg ; capture ( c , & mov ) ; } if ( r -> showEmuSteps ) cprintf ( CABright | CFMagenta , "Capture \'%s\' (into %s + %d)\\n" , instr2string ( instr , 0 , c -> r , cbb -> fc ) , cbb_prettyName ( cbb ) , cbb -> count - offset ) ; ElfAddrInfo * info = addCaptureInfo ( c , offset ) ; <vul-start> if ( generated ) { <vul-end> strncpy ( info -> filePath , "<generated>" , ELF_MAX_NAMELEN ) ; info -> fileName = info -> filePath ; info -> lineno = 0 ; } if ( c -> e ) return ; if ( offset == 0 ) { newInstr = newCapInstr ( c ) ; if ( c -> e ) return ; if ( cbb -> instr == 0 ) { cbb -> instr = newInstr ; assert ( cbb -> count == 0 ) ; } if ( cbb -> info == NULL ) { cbb -> info = info ; } } else { newInstr = insertCapInstr ( c , offset ) ; if ( c -> e ) return ; } copyInstr ( newInstr , instr ) ; cbb -> count ++ ; if ( saveTmpReg ) { capture ( c , & restoreRegInstr ) ; } }
| <vul-start> ; if ( info &&
|
13 | CWE-000 <vul-start> void mlxsw_sp_port_vrf_leave ( struct mlxsw_sp_port * mlxsw_sp_port ) <vul-end> { <vul-start> struct mlxsw_sp_port * mlxsw_sp_vport ; <vul-end> mlxsw_sp_vport = mlxsw_sp_port_vport_find ( mlxsw_sp_port , 1 ) ; <vul-start> if ( WARN_ON ( ! mlxsw_sp_vport ) ) <vul-end> return ; <vul-start> mlxsw_sp_vport_vrf_leave ( mlxsw_sp_vport ) ; <vul-end> }
| <vul-start> static <vul-start> mlxsw_sp_port_vrf_leave ( struct mlxsw_sp * mlxsw_sp , struct net_device * l3_dev <vul-end> ) { struct <vul-start> ) { struct mlxsw_sp_rif * rif ; rif = mlxsw_sp_rif_find_by_dev ( mlxsw_sp , l3_dev <vul-end> ) ; if <vul-start> ; if ( ! rif <vul-end> ) return ; <vul-start> ) return ; __mlxsw_sp_inetaddr_event ( l3_dev , NETDEV_DOWN <vul-end> ) ; }
|
14 | CWE-000 void av1_fht32x16_c ( const int16_t * input , tran_low_t * output , int stride , int tx_type ) { static const transform_2d FHT [ ] = { { fdct16 , fdct32 } , { fadst16 , fdct32 } , { fdct16 , fhalfright32 } , { fadst16 , fhalfright32 } , # if CONFIG_EXT_TX { fadst16 , fdct32 } , { fdct16 , fhalfright32 } , { fadst16 , fhalfright32 } , { fadst16 , fhalfright32 } , { fadst16 , fhalfright32 } , { fidtx16 , fidtx32 } , { fdct16 , fidtx32 } , { fidtx16 , fdct32 } , { fadst16 , fidtx32 } , { fidtx16 , fhalfright32 } , { fadst16 , fidtx32 } , { fidtx16 , fhalfright32 } , # endif } ; const transform_2d ht = FHT [ tx_type ] ; const int n = 16 ; const int n2 = 32 ; tran_low_t out [ 32 * 16 ] ; tran_low_t temp_in [ 32 ] , temp_out [ 32 ] ; int i , j ; # if CONFIG_EXT_TX int16_t flipped_input [ 32 * 16 ] ; maybe_flip_input ( & input , & stride , n , n2 , flipped_input , tx_type ) ; # endif for ( i = 0 ; i < n2 ; ++ i ) { for ( j = 0 ; j < n ; ++ j ) temp_in [ j ] = ( tran_low_t ) fdct_round_shift ( input [ j * stride + i ] * Sqrt2 ) ; ht . cols ( temp_in , temp_out ) ; for ( j = 0 ; j < n ; ++ j ) out [ j * n2 + i ] = temp_out [ j ] ; } for ( i = 0 ; i < n ; ++ i ) { for ( j = 0 ; j < n2 ; ++ j ) temp_in [ j ] = out [ j + i * n2 ] ; ht . rows ( temp_in , temp_out ) ; for ( j = 0 ; j < n2 ; ++ j ) output [ j + i * n2 ] = <vul-start> ( tran_low_t ) ( ( temp_out [ j ] + 1 + ( temp_out [ j ] < 0 ) ) >> 2 ) ; <vul-end> } }
| <vul-start> n2 ] = <vul-end> temp_out [ j <vul-start> [ j ] >> 2 <vul-end> ; } }
|
15 | CWE-000 static void started_cb ( enum modules module ) { <vul-start> while ( modules [ module ] . num_dependent > 0 ) { <vul-end> <vul-start> enum modules m = modules [ module ] . dependent_m [ 0 ] . dep ; <vul-end> <vul-start> if ( modules [ module ] . num_dependent > 1 ) { <vul-end> memmove ( & modules [ module ] . dependent_m [ 0 ] , & modules [ module ] . dependent_m [ 1 ] , ( modules [ module ] . num_dependent - 1 ) * sizeof ( struct dependency ) ) ; } modules [ module ] . dependent_m = realloc ( modules [ module ] . dependent_m , ( -- modules [ module ] . num_dependent ) * sizeof ( struct dependency ) ) ; if ( is_idle ( m ) ) { <vul-start> modules [ m ] . self -> satisfied_deps ++ ; <vul-end> <vul-start> DEBUG ( "Trying to start %s module as its %s dependency was loaded...\\n" , modules [ m ] . self -> name , modules [ module ] . self -> name ) ; <vul-end> <vul-start> init_modules ( m ) ; <vul-end> } } }
| <vul-start> module ) { for ( int i = 0 ; i < MODULES_NUM ; i ++ ) { const enum dep_type type <vul-end> = modules [ <vul-start> . dependent_m [ i ] <vul-end> ; if ( <vul-start> ; if ( type != NO_DEP && is_idle ( i <vul-end> ) ) { <vul-start> { modules [ i <vul-end> ] . self <vul-start> , modules [ i <vul-end> ] . self <vul-start> ; init_modules ( i <vul-end> ) ; }
|
16 | CWE-000 int enc_jpeg2000 ( unsigned char * cin , g2int * pwidth , g2int * pheight , g2int * pnbits , g2int * ltype , g2int * ratio , g2int * retry , char * outjpc , g2int * jpclen ) { int rwcnt = 0 ; # ifdef USE_JPEG2000 int ier ; jas_image_t image ; jas_stream_t * jpcstream , * istream ; jas_image_cmpt_t cmpt , * pcmpt ; # define MAXOPTSSIZE 1024 char opts [ MAXOPTSSIZE ] ; g2int width , height , nbits ; width = * pwidth ; height = * pheight ; nbits = * pnbits ; if ( * ltype != 1 ) { opts [ 0 ] = ( char ) 0 ; } else { snprintf ( opts , MAXOPTSSIZE , "mode=real\\nrate=%f" , 1.0 / ( float ) * ratio ) ; } if ( * retry == 1 ) { strcat ( opts , "\\nnumgbits=4" ) ; } image . tlx_ = 0 ; image . tly_ = 0 ; # ifdef JAS_1_500_4 image . brx_ = ( uint_fast32_t ) width ; image . bry_ = ( uint_fast32_t ) height ; # endif # ifdef JAS_1_700_2 image . brx_ = ( jas_image_coord_t ) width ; image . bry_ = ( jas_image_coord_t ) height ; # endif image . numcmpts_ = 1 ; image . maxcmpts_ = 1 ; # ifdef JAS_1_500_4 image . colormodel_ = JAS_IMAGE_CM_GRAY ; # endif # ifdef JAS_1_700_2 image . clrspc_ = JAS_CLRSPC_SGRAY ; image . cmprof_ = 0 ; # endif <vul-start> image . inmem_ = 1 ; <vul-end> cmpt . tlx_ = 0 ; cmpt . tly_ = 0 ; cmpt . hstep_ = 1 ; cmpt . vstep_ = 1 ; # ifdef JAS_1_500_4 cmpt . width_ = ( uint_fast32_t ) width ; cmpt . height_ = ( uint_fast32_t ) height ; # endif # ifdef JAS_1_700_2 cmpt . width_ = ( jas_image_coord_t ) width ; cmpt . height_ = ( jas_image_coord_t ) height ; cmpt . type_ = JAS_IMAGE_CT_COLOR ( JAS_CLRSPC_CHANIND_GRAY_Y ) ; # endif cmpt . prec_ = nbits ; cmpt . sgnd_ = 0 ; cmpt . cps_ = ( nbits + 7 ) / 8 ; pcmpt = & cmpt ; image . cmpts_ = & pcmpt ; istream = jas_stream_memopen ( ( char * ) cin , height * width * cmpt . cps_ ) ; cmpt . stream_ = istream ; jpcstream = jas_stream_memopen ( outjpc , ( int ) ( * jpclen ) ) ; ier = jpc_encode ( & image , jpcstream , opts ) ; if ( ier != 0 ) { printf ( " jpc_encode return = %d \\n" , ier ) ; return - 3 ; } rwcnt = jpcstream -> rwcnt_ ; ier = jas_stream_close ( istream ) ; ier = jas_stream_close ( jpcstream ) ; # endif return ( rwcnt ) ; }
| <vul-start> ; # endif <vul-end> cmpt . tlx_
|
17 | CWE-000 static void goto_folder_cb ( GtkAction * action , gpointer data ) { MainWindow * mainwin = ( MainWindow * ) data ; FolderItem * to_folder ; <vul-start> to_folder = foldersel_folder_sel ( NULL , FOLDER_SEL_ALL , NULL , FALSE ) ; <vul-end> if ( to_folder ) folderview_select ( mainwin -> folderview , to_folder ) ; }
| <vul-start> NULL , FALSE , _ ( "Select folder to go to" )
|
18 | CWE-000 int main ( int argc , char * * argv ) { int nodeCount = 1 ; int i ; AddressBookList * list ; AddressBookNode * tempNode ; char tempStr [ 20 ] ; char * testPhone = "3543252366" ; showStudentInformation ( ) ; printf ( "creating list\\n" ) ; list = createAddressBookList ( ) ; <vul-start> printf ( "creating fake nodes\\n" ) ; <vul-end> for ( i = 0 ; i < nodeCount ; i ++ ) { sprintf ( tempStr , "node: %d" , i ) ; tempNode = createAddressBookNode ( i , tempStr ) ; addTelephone ( tempNode -> array , "0123456789" ) ; addTelephone ( tempNode -> array , "3423454346" ) ; addTelephone ( tempNode -> array , testPhone ) ; addTelephone ( tempNode -> array , "3196432827" ) ; removeTelephone ( tempNode -> array , testPhone ) ; insertNode ( list , tempNode ) ; } printf ( "sizeof array: %d\\n" , ( int ) sizeof ( list -> head -> array ) ) ; <vul-start> freeAddressBookList ( list ) ; <vul-end> list = commandLoad ( "sml.txt" ) ; commandDisplay ( list ) ; printf ( "\\nFREEING\\n" ) ; freeAddressBookList ( list ) ; return EXIT_SUCCESS ; }
| <vul-start> ( ) ; commandDisplay ( list ) ; <vul-start> ) ) ; commandDisplay ( list ) ;
|
19 | CWE-000 static int open_file ( AVFormatContext * avf , unsigned fileno ) { ConcatContext * cat = avf -> priv_data ; ConcatFile * file = & cat -> files [ fileno ] ; AVFormatContext * new_avf = NULL ; int ret ; AVDictionary * tmp = NULL ; new_avf = avformat_alloc_context ( ) ; if ( ! new_avf ) return AVERROR ( ENOMEM ) ; new_avf -> interrupt_callback = avf -> interrupt_callback ; if ( ( ret = ff_copy_whiteblacklists ( new_avf , avf ) ) < 0 ) return ret ; if ( cat -> options ) <vul-start> av_dict_copy ( & tmp , cat -> options , 0 ) ; <vul-end> ret = avformat_open_input ( & new_avf , file -> url , NULL , & tmp ) ; av_dict_free ( & tmp ) ; if ( ret < 0 || ( ret = avformat_find_stream_info ( new_avf , NULL ) ) < 0 ) { av_log ( avf , AV_LOG_ERROR , "Impossible to open \'%s\'\\n" , file -> url ) ; avformat_close_input ( & new_avf ) ; return ret ; } if ( ! new_avf ) return 0 ; if ( cat -> avf ) avformat_close_input ( & cat -> avf ) ; avf -> bit_rate = new_avf -> bit_rate ; cat -> avf = new_avf ; cat -> cur_file = file ; if ( file -> start_time == AV_NOPTS_VALUE ) file -> start_time = ! fileno ? 0 : cat -> files [ fileno - 1 ] . start_time + cat -> files [ fileno - 1 ] . duration ; file -> file_start_time = ( cat -> avf -> start_time == AV_NOPTS_VALUE ) ? 0 : cat -> avf -> start_time ; file -> file_inpoint = ( file -> inpoint == AV_NOPTS_VALUE ) ? file -> file_start_time : file -> inpoint ; if ( file -> duration == AV_NOPTS_VALUE && file -> outpoint != AV_NOPTS_VALUE ) file -> duration = file -> outpoint - file -> file_inpoint ; if ( cat -> segment_time_metadata ) { av_dict_set_int ( & file -> metadata , "lavf.concatdec.start_time" , file -> start_time , 0 ) ; if ( file -> duration != AV_NOPTS_VALUE ) av_dict_set_int ( & file -> metadata , "lavf.concatdec.duration" , file -> duration , 0 ) ; } if ( ( ret = match_streams ( avf ) ) < 0 ) return ret ; if ( file -> inpoint != AV_NOPTS_VALUE ) { if ( ( ret = avformat_seek_file ( cat -> avf , - 1 , INT64_MIN , file -> inpoint , file -> inpoint , 0 ) ) < 0 ) return ret ; } return 0 ; }
| <vul-start> cat -> options , 0 ) ; av_dict_set_int ( & tmp , "cur_file_no" , fileno
|
20 | CWE-000 void runAlg ( Proc * * procs , int numProcs , int preemp , int ( * nextProc ) ( Proc * * procs , int numProc , int quantum ) ) { int quantum , curNdx = - 1 , numStarted = 0 ; <vul-start> for ( quantum = 0 ; quantum < QUANT_MAX || curNdx >= 0 || numStarted > 0 ; quantum ++ ) { <vul-end> printf ( "%i " , quantum ) ; if ( curNdx >= 0 ) { ( * ( procs + curNdx ) ) -> run ++ ; if ( ( * ( procs + curNdx ) ) -> run >= ( * ( procs + curNdx ) ) -> exp ) { numStarted -- ; ( * ( procs + curNdx ) ) -> end = quantum ; procs = removeProc ( procs , numProcs , curNdx ) ; numProcs -- ; if ( quantum < QUANT_MAX ) curNdx = ( * nextProc ) ( procs , numProcs , quantum ) ; else curNdx = - 1 ; } else if ( preemp == TRUE ) curNdx = changeCurrProc ( procs , numProcs - 1 , quantum , curNdx ) ; } else { curNdx = ( * nextProc ) ( procs , numProcs , quantum ) ; <vul-start> } <vul-end> if ( curNdx > 0 && ( * ( procs + curNdx ) ) -> start < 0 ) numStarted ++ ; setProcStart ( procs , curNdx , quantum ) ; printProcName ( procs , curNdx ) ; printf ( "\\n" ) ; } }
| <vul-start> = 0 ; ( <vul-start> curNdx >= 0 ) && numProcs <vul-end> > 0 ; <vul-start> quantum ) ; if ( curNdx >= 0 ) ( * ( procs + curNdx ) ) -> run ++ ;
|
21 | CWE-000 int spParserGetMove ( const SPCommand * command ) { int locations = 0 ; locations |= spParserGetBoardLocationFromString ( command -> arguments ) ; locations <<= 8 ; <vul-start> locations |= spParserGetBoardLocationFromString ( command -> arguments + 6 ) ; <vul-end> return spParserDestroyLocationIfNeeded ( locations ) ; }
| <vul-start> |= spParserGetBoardLocationFromString ( & <vul-start> command -> arguments [ 5 ] <vul-end> ) ; return
|
22 | CWE-000 void ft_printf ( const char * format , ... ) { va_list ap ; char tmp ; va_start ( ap , format ) ; while ( * format ) { while ( * format && * format != '%' ) { ft_putchar ( * format ) ; ++ format ; } if ( * format == '%' ) { t_mods mods = { } ; int moved ; char * tmpptr = ( char * ) ( format + 1 ) ; tmp = * tmpptr ; moved = 0 ; if ( tmp == 'h' ) { if ( has_mods ( mods ) ) exit ( 0 ) ; ++ tmpptr ; ++ moved ; tmp = * tmpptr ; mods . h = 1 ; if ( tmp == 'h' ) { ++ tmpptr ; ++ moved ; mods . h = 0 ; mods . hh = 1 ; tmp = * tmpptr ; } } else if ( tmp == 'l' ) { if ( has_mods ( mods ) ) exit ( 0 ) ; ++ tmpptr ; ++ moved ; tmp = * tmpptr ; mods . l = 1 ; if ( tmp == 'l' ) { ++ tmpptr ; ++ moved ; mods . l = 0 ; mods . ll = 1 ; tmp = * tmpptr ; } } else if ( tmp == 'j' ) { if ( has_mods ( mods ) ) exit ( 0 ) ; ++ tmpptr ; ++ moved ; tmp = * tmpptr ; mods . j = 1 ; } else if ( tmp == 'z' ) { if ( has_mods ( mods ) ) exit ( 0 ) ; ++ tmpptr ; ++ moved ; tmp = * tmpptr ; mods . z = 1 ; } else if ( tmp == 'D' ) mods . l = 1 ; if ( tmp == 's' ) ft_putstr ( va_arg ( ap , char * ) ) ; if ( tmp == '%' ) ft_putchar ( '%' ) ; if ( tmp == 'd' || tmp == 'i' || tmp == 'D' ) { if ( mods . hh ) ft_putnbr ( va_arg ( ap , int ) ) ; else if ( mods . h ) ft_putnbr ( va_arg ( ap , int ) ) ; else if ( mods . l ) <vul-start> ft_putnbr ( va_arg ( ap , long int ) ) ; <vul-end> else if ( mods . ll ) <vul-start> ft_putnbr ( va_arg ( ap , long long ) ) ; <vul-end> else if ( mods . j ) <vul-start> ft_putnbr ( va_arg ( ap , intmax_t ) ) ; <vul-end> else if ( mods . z ) <vul-start> ft_putnbr ( va_arg ( ap , size_t ) ) ; <vul-end> else ft_putnbr ( va_arg ( ap , int ) ) ; } if ( tmp == 'u' ) { if ( mods . hh ) ft_putunsigned ( va_arg ( ap , unsigned int ) ) ; else if ( mods . h ) ft_putunsigned ( va_arg ( ap , unsigned int ) ) ; else if ( mods . l ) ft_putunsignedlong ( va_arg ( ap , unsigned long int ) ) ; else if ( mods . ll ) ft_putunsignedlong ( va_arg ( ap , unsigned long long int ) ) ; else if ( mods . j ) ft_putunsignedlong ( va_arg ( ap , uintmax_t ) ) ; else if ( mods . z ) ft_putunsignedlong ( va_arg ( ap , size_t ) ) ; else ft_putunsigned ( va_arg ( ap , unsigned int ) ) ; } if ( tmp == 'c' ) ft_putchar ( va_arg ( ap , int ) ) ; if ( tmp == 'p' ) { void * ptr = va_arg ( ap , void * ) ; ft_putaddr ( ptr ) ; } if ( tmp == 'x' || tmp == 'X' ) ft_putnbr_hex ( va_arg ( ap , t_ull ) , tmp ) ; if ( tmp == 'o' ) ft_putnbr_oct ( va_arg ( ap , t_ull ) ) ; if ( tmp == 'f' ) ft_putfloat ( va_arg ( ap , double ) ) ; format += moved ; format += 2 ; } } va_end ( ap ) ; }
| <vul-start> . l ) ft_putlong <vul-end> ( va_arg ( <vul-start> . ll ) ft_putlong <vul-end> ( va_arg ( <vul-start> . j ) ft_putlong <vul-end> ( va_arg ( <vul-start> . z ) ft_putlong <vul-end> ( va_arg (
|
23 | CWE-000 Texture * r_target_get_attachment ( RenderTarget * target , RenderTargetAttachment attachment ) { <vul-start> assert ( attachment >= 0 && attachment < RENDERTARGET_MAX_ATTACHMENTS ) ; <vul-end> <vul-start> return target -> attachments [ attachment ] ; <vul-end> }
| <vul-start> { assert ( target -> impl != NULL ) ; assert ( <vul-start> RENDERTARGET_MAX_ATTACHMENTS ) ; if ( ! target -> impl -> initialized ) { RenderTarget * prev_target = r_target_current ( ) ; r_target ( target ) ; gl33_sync_render_target ( ) ; r_target ( prev_target ) ; } return target -> impl <vul-end> -> attachments [
|
24 | CWE-000 static int smb1360_get_prop_batt_resistance ( struct smb1360_chip * chip ) { u8 reg [ 2 ] ; u16 temp ; int rc ; <vul-start> int64_t resistance ; <vul-end> rc = smb1360_read_bytes ( chip , SHDW_FG_ESR_ACTUAL , reg , 2 ) ; if ( rc ) { pr_err ( "Failed to read FG_ESR_ACTUAL rc=%d\\n" , rc ) ; return rc ; } temp = ( reg [ 1 ] << 8 ) | reg [ 0 ] ; resistance = float_decode ( temp ) * 2 ; pr_debug ( "reg=0x%02x resistance=%lld\\n" , temp , resistance ) ; <vul-start> return resistance ; <vul-end> }
| <vul-start> ; int64_t resistance ; if ( is_device_suspended ( chip ) ) return chip -> resistance_now <vul-start> resistance ) ; chip -> resistance_now = resistance ; return chip -> resistance_now <vul-end> ; }
|
25 | CWE-000 static int adsp_probe ( struct platform_device * pdev ) { const struct adsp_data * desc ; struct qcom_adsp * adsp ; struct rproc * rproc ; int ret ; desc = of_device_get_match_data ( & pdev -> dev ) ; if ( ! desc ) return - EINVAL ; if ( ! qcom_scm_is_available ( ) ) return - EPROBE_DEFER ; rproc = rproc_alloc ( & pdev -> dev , pdev -> name , & adsp_ops , desc -> firmware_name , sizeof ( * adsp ) ) ; if ( ! rproc ) { dev_err ( & pdev -> dev , "unable to allocate remoteproc\\n" ) ; return - ENOMEM ; } rproc -> fw_ops = & adsp_fw_ops ; adsp = ( struct qcom_adsp * ) rproc -> priv ; adsp -> dev = & pdev -> dev ; adsp -> rproc = rproc ; adsp -> pas_id = desc -> pas_id ; adsp -> crash_reason_smem = desc -> crash_reason_smem ; adsp -> has_aggre2_clk = desc -> has_aggre2_clk ; platform_set_drvdata ( pdev , adsp ) ; init_completion ( & adsp -> start_done ) ; init_completion ( & adsp -> stop_done ) ; ret = adsp_alloc_memory_region ( adsp ) ; if ( ret ) goto free_rproc ; ret = adsp_init_clock ( adsp ) ; if ( ret ) goto free_rproc ; ret = adsp_init_regulator ( adsp ) ; if ( ret ) goto free_rproc ; ret = adsp_request_irq ( adsp , pdev , "wdog" , adsp_wdog_interrupt ) ; if ( ret < 0 ) goto free_rproc ; adsp -> wdog_irq = ret ; ret = adsp_request_irq ( adsp , pdev , "fatal" , adsp_fatal_interrupt ) ; if ( ret < 0 ) goto free_rproc ; adsp -> fatal_irq = ret ; ret = adsp_request_irq ( adsp , pdev , "ready" , adsp_ready_interrupt ) ; if ( ret < 0 ) goto free_rproc ; adsp -> ready_irq = ret ; ret = adsp_request_irq ( adsp , pdev , "handover" , adsp_handover_interrupt ) ; if ( ret < 0 ) goto free_rproc ; adsp -> handover_irq = ret ; ret = adsp_request_irq ( adsp , pdev , "stop-ack" , adsp_stop_ack_interrupt ) ; if ( ret < 0 ) goto free_rproc ; adsp -> stop_ack_irq = ret ; adsp -> state = qcom_smem_state_get ( & pdev -> dev , "stop" , & adsp -> stop_bit ) ; if ( IS_ERR ( adsp -> state ) ) { ret = PTR_ERR ( adsp -> state ) ; goto free_rproc ; } <vul-start> qcom_add_smd_subdev ( rproc , & adsp -> smd_subdev ) ; <vul-end> qcom_add_ssr_subdev ( rproc , & adsp -> ssr_subdev , desc -> ssr_name ) ; ret = rproc_add ( rproc ) ; if ( ret ) goto free_rproc ; return 0 ; free_rproc : rproc_free ( rproc ) ; return ret ; }
| <vul-start> free_rproc ; } qcom_add_glink_subdev ( rproc , & adsp -> glink_subdev ) ;
|
26 | CWE-000 static int do_tpm_nv_write ( cmd_tbl_t * cmdtp , int flag , int argc , char * const argv [ ] ) { <vul-start> uint32_t index , count , err ; <vul-end> void * data ; if ( argc < 3 ) return CMD_RET_USAGE ; if ( argc != 3 + type_string_get_num_values ( argv [ 1 ] ) ) return CMD_RET_USAGE ; index = simple_strtoul ( argv [ 2 ] , NULL , 0 ) ; data = type_string_alloc ( argv [ 1 ] , & count ) ; if ( ! data ) { printf ( "Couldn\'t parse arguments\\n" ) ; return CMD_RET_USAGE ; } if ( type_string_pack ( argv [ 1 ] , argv + 3 , data ) ) { printf ( "Couldn\'t parse arguments\\n" ) ; free ( data ) ; return CMD_RET_USAGE ; } err = tpm_nv_write_value ( index , data , count ) ; free ( data ) ; return report_return_code ( err ) ; }
| <vul-start> ] ) { u32 <vul-end> index , count
|
27 | CWE-000 static void * def_msm8x16_wcd_mbhc_cal ( void ) { void * msm8x16_wcd_cal ; struct wcd_mbhc_btn_detect_cfg * btn_cfg ; u16 * btn_low , * btn_high ; msm8x16_wcd_cal = kzalloc ( WCD_MBHC_CAL_SIZE ( WCD_MBHC_DEF_BUTTONS , WCD_MBHC_DEF_RLOADS ) , GFP_KERNEL ) ; if ( ! msm8x16_wcd_cal ) { pr_err ( "%s: out of memory\\n" , __func__ ) ; return NULL ; } # define S ( X , Y ) ( ( WCD_MBHC_CAL_PLUG_TYPE_PTR ( msm8x16_wcd_cal ) -> X ) = ( Y ) ) # ifdef CONFIG_MACH_CP8675 S ( v_hs_max , 2550 ) ; # elif defined CONFIG_MACH_WT88047 S ( v_hs_max , 1700 ) ; # else S ( v_hs_max , 1500 ) ; <vul-start> # undef S <vul-end> # define S ( X , Y ) ( ( WCD_MBHC_CAL_BTN_DET_PTR ( msm8x16_wcd_cal ) -> X ) = ( Y ) ) S ( num_btn , WCD_MBHC_DEF_BUTTONS ) ; # undef S btn_cfg = WCD_MBHC_CAL_BTN_DET_PTR ( msm8x16_wcd_cal ) ; btn_low = btn_cfg -> _v_btn_low ; btn_high = ( ( void * ) & btn_cfg -> _v_btn_low ) + ( sizeof ( btn_cfg -> _v_btn_low [ 0 ] ) * btn_cfg -> num_btn ) ; # ifdef CONFIG_MACH_JALEBI btn_low [ 0 ] = 0 ; btn_high [ 0 ] = 150 ; btn_low [ 1 ] = 150 ; btn_high [ 1 ] = 150 ; btn_low [ 2 ] = 150 ; btn_high [ 2 ] = 150 ; btn_low [ 3 ] = 150 ; btn_high [ 3 ] = 150 ; btn_low [ 4 ] = 150 ; btn_high [ 4 ] = 150 ; # elif defined ( CONFIG_MACH_CP8675 ) btn_low [ 0 ] = 50 ; btn_high [ 0 ] = 50 ; btn_low [ 1 ] = 87 ; btn_high [ 1 ] = 87 ; btn_low [ 2 ] = 75 ; btn_high [ 2 ] = 75 ; btn_low [ 3 ] = 112 ; btn_high [ 3 ] = 112 ; btn_low [ 4 ] = 137 ; btn_high [ 4 ] = 137 ; # elif defined ( CONFIG_MACH_OPPO ) btn_low [ 0 ] = 25 ; btn_high [ 0 ] = 137 ; btn_low [ 1 ] = 137 ; btn_high [ 1 ] = 138 ; btn_low [ 2 ] = 138 ; btn_high [ 2 ] = 139 ; btn_low [ 3 ] = 139 ; btn_high [ 3 ] = 140 ; if ( is_project ( OPPO_15011 ) || is_project ( OPPO_15018 ) || is_project ( OPPO_15022 ) ) { btn_low [ 4 ] = 175 ; } else { btn_low [ 4 ] = 140 ; } btn_high [ 4 ] = 315 ; # elif defined ( CONFIG_MACH_WT88047 ) btn_low [ 0 ] = 25 ; btn_high [ 0 ] = 75 ; btn_low [ 1 ] = 200 ; btn_high [ 1 ] = 225 ; btn_low [ 2 ] = 325 ; btn_high [ 2 ] = 400 ; btn_low [ 3 ] = 375 ; btn_high [ 3 ] = 410 ; btn_low [ 4 ] = 430 ; btn_high [ 4 ] = 450 ; # else btn_low [ 0 ] = 75 ; btn_high [ 0 ] = 75 ; btn_low [ 1 ] = 150 ; btn_high [ 1 ] = 150 ; btn_low [ 2 ] = 237 ; btn_high [ 2 ] = 237 ; btn_low [ 3 ] = 450 ; btn_high [ 3 ] = 450 ; btn_low [ 4 ] = 500 ; btn_high [ 4 ] = 500 ; # endif return msm8x16_wcd_cal ; }
| <vul-start> ) ; # endif #
|
28 | CWE-000 void buscainterna_LFREQ ( LFREQ * l , int x , No_LFREQ * * p ) { * p = l -> ini ; <vul-start> while ( * p != NULL && ( * p ) -> info != x ) { <vul-end> * p = ( * p ) -> prox ; <vul-start> } <vul-end> return ; }
| <vul-start> -> ini ; int count = 0 ; do <vul-end> { * p <vul-start> -> prox ; count ++ ; } while ( * p != l -> ini && ( * p ) -> info != x ) ; if ( count > 1 && * p == l -> ini ) * p = NULL ; <vul-end> return ; }
|
29 | CWE-000 static acpi_status acpi_ev_delete_gpe_xrupt ( struct acpi_gpe_xrupt_info * gpe_xrupt ) { <vul-start> acpi_status status ; <vul-end> ACPI_FUNCTION_TRACE ( "ev_delete_gpe_xrupt" ) ; if ( gpe_xrupt -> interrupt_number == acpi_gbl_FADT -> sci_int ) { gpe_xrupt -> gpe_block_list_head = NULL ; return_ACPI_STATUS ( AE_OK ) ; } status = acpi_os_remove_interrupt_handler ( gpe_xrupt -> interrupt_number , acpi_ev_gpe_xrupt_handler ) ; if ( ACPI_FAILURE ( status ) ) { return_ACPI_STATUS ( status ) ; } <vul-start> acpi_os_acquire_lock ( acpi_gbl_gpe_lock , ACPI_NOT_ISR ) ; <vul-end> if ( gpe_xrupt -> previous ) { gpe_xrupt -> previous -> next = gpe_xrupt -> next ; } if ( gpe_xrupt -> next ) { gpe_xrupt -> next -> previous = gpe_xrupt -> previous ; } <vul-start> acpi_os_release_lock ( acpi_gbl_gpe_lock , ACPI_NOT_ISR ) ; <vul-end> ACPI_MEM_FREE ( gpe_xrupt ) ; return_ACPI_STATUS ( AE_OK ) ; }
| <vul-start> { acpi_status status ; u32 flags <vul-start> ) ; } flags = <vul-start> acpi_os_acquire_lock ( acpi_gbl_gpe_lock <vul-end> ) ; if <vul-start> ( acpi_gbl_gpe_lock , flags <vul-end> ) ; ACPI_MEM_FREE
|
30 | CWE-000 void * mm_malloc ( size_t size ) { # ifdef DEBUG printf ( "Calling malloc with size = %d\\n" , size ) ; # endif size_t asize ; size_t extendsize ; char * bp ; if ( size == 0 ) return NULL ; <vul-start> if ( size <= MIN_BIGBLK_SIZE ) <vul-end> asize = MIN_BIGBLK_SIZE ; else asize = DSIZE * ( ( size + ( DSIZE ) + ( DSIZE - 1 ) ) / DSIZE ) ; if ( ( bp = find_fit ( asize ) ) != NULL ) { remove_from_sizeclass ( bp ) ; place ( bp , asize ) ; # ifdef DEBUG printf ( "\\tCreated new block at %p with %d bytes\\n\\n" , bp , GET_SIZE ( HDRP ( bp ) ) ) ; traverse_lists ( ) ; traverse_blocks ( ) ; mm_check ( ) ; # endif return bp ; } extendsize = MAX ( asize , mem_pagesize ( ) ) ; if ( ( bp = extend_heap ( extendsize / WSIZE ) ) == NULL ) return NULL ; remove_from_sizeclass ( bp ) ; place ( bp , asize ) ; # ifdef DEBUG printf ( "\\tCreated new block at %p with %d bytes\\n\\n" , bp , GET_SIZE ( HDRP ( bp ) ) ) ; traverse_lists ( ) ; traverse_blocks ( ) ; # endif return bp ; }
| <vul-start> return NULL ; size += WSIZE ;
|
31 | CWE-000 void game_over ( ) { <vul-start> printf ( " _____ __ __ ______ ______ ________ _____ _ \\n" ) ; <vul-end> printf ( " / ____| /\\\\ | \\\\/ | ____| / __ \\\\ \\\\ / / ____| __ \\\\| | \\n" ) ; printf ( " | | __ / \\\\ | \\\\ / | |__ | | | \\\\ \\\\ / /| |__ | |__) | | \\n" ) ; printf ( " | | |_ | / /\\\\ \\\\ | |\\\\/| | __| | | | |\\\\ \\\\/ / | __| | _ /| | \\n" ) ; printf ( " | |__| |/ ____ \\\\| | | | |____ | |__| | \\\\ / | |____| | \\\\ \\\\|_| \\n" ) ; printf ( " \\\\_____/_/ \\\\_\\\\_| |_|______| \\\\____/ \\\\/ |______|_| \\\\_(_) \\n" ) ; printf ( " ________________________________________________________________________ \\n" ) ; printf ( "|________________________________________________________________________|\\n" ) ; }
| <vul-start> printf ( " _____ __ __ ______ ______ ________ _____ _ \\n" " / ____| /\\\\ | \\\\/ | ____| / __ \\\\ \\\\ / / ____| __ \\\\| | \\n" " | | __ / \\\\ | \\\\ / | |__ | | | \\\\ \\\\ / /| |__ | |__) | | \\n" " | | |_ | / /\\\\ \\\\ | |\\\\/| | __| | | | |\\\\ \\\\/ / | __| | _ /| | \\n" " | |__| |/ ____ \\\\| | | | |____ | |__| | \\\\ / | |____| | \\\\ \\\\|_| \\n" " \\\\_____/_/ \\\\_\\\\_| |_|______| \\\\____/ \\\\/ |______|_| \\\\_(_) \\n" " ________________________________________________________________________ \\n" <vul-end> "|________________________________________________________________________|\\n" ) ;
|
32 | CWE-000 START_TEST ( test_get_username_list_ok ) { char * url = TALIESIN_SERVER_URI "/users" ; <vul-start> json_t * j_body = json_string ( ADMIN_LOGIN ) ; <vul-end> <vul-start> int res = run_simple_authenticated_test ( & admin_req , "GET" , url , j_body , NULL , 200 , NULL , NULL , NULL ) ; <vul-end> json_decref ( j_body ) ; ck_assert_int_eq ( res , 1 ) ; }
| <vul-start> * j_body = json_pack ( "{ss}" , "username" , <vul-end> ADMIN_LOGIN ) ; <vul-start> , url , NULL <vul-end> , NULL , <vul-start> , 200 , j_body <vul-end> , NULL ,
|
33 | CWE-000 static int procfs_getonecpu ( int xcpu , struct cpu_info * ci , char * bf , size_t * len ) { size_t left , l , size ; char featurebuf [ 1024 ] , * p ; p = featurebuf ; left = sizeof ( featurebuf ) ; size = * len ; procfs_getonecpufeatures ( ci , p , & left ) ; p = bf ; left = * len ; size = 0 ; l = snprintf ( p , left , "processor\\t: %d\\n" "vendor_id\\t: %s\\n" "cpu family\\t: %d\\n" "model\\t\\t: %d\\n" "model name\\t: %s\\n" "stepping\\t: " , xcpu , ( char * ) ci -> ci_vendor , CPUID_TO_FAMILY ( ci -> ci_signature ) , CPUID_TO_MODEL ( ci -> ci_signature ) , cpu_brand_string ) ; size += l ; if ( l < left ) { left -= l ; p += l ; } else left = 0 ; if ( cpuid_level >= 0 ) l = snprintf ( p , left , "%d\\n" , CPUID_TO_STEPPING ( ci -> ci_signature ) ) ; else l = snprintf ( p , left , "unknown\\n" ) ; size += l ; if ( l < left ) { left -= l ; p += l ; } else left = 0 ; if ( ci -> ci_data . cpu_cc_freq != 0 ) { uint64_t freq , fraq ; freq = ( ci -> ci_data . cpu_cc_freq + 4999 ) / 1000000 ; fraq = ( ( ci -> ci_data . cpu_cc_freq + 4999 ) / 10000 ) % 100 ; l = snprintf ( p , left , "cpu MHz\\t\\t: %" PRIu64 ".%02" PRIu64 "\\n" , freq , fraq ) ; } else l = snprintf ( p , left , "cpu MHz\\t\\t: unknown\\n" ) ; size += l ; if ( l < left ) { left -= l ; p += l ; } else left = 0 ; l = snprintf ( p , left , "apicid\\t\\t: %d\\n" "initial apicid\\t: %d\\n" , ci -> ci_acpiid , ci -> ci_initapicid ) ; size += l ; if ( l < left ) { left -= l ; p += l ; } else left = 0 ; l = snprintf ( p , left , # ifdef __i386__ "fdiv_bug\\t: %s\\n" # endif "fpu\\t\\t: %s\\n" "fpu_exception\\t: yes\\n" "cpuid level\\t: %d\\n" "wp\\t\\t: %s\\n" "flags\\t\\t: %s\\n" "clflush size\\t: %d\\n" , # ifdef __i386__ i386_fpu_fdivbug ? "yes" : "no" , # endif i386_fpu_present ? "yes" : "no" , <vul-start> cpuid_level , <vul-end> ( rcr0 ( ) & CR0_WP ) ? "yes" : "no" , featurebuf , ci -> ci_cflush_lsize ) ; size += l ; left = * len ; * len = size ; return left < * len ? - 1 : 0 ; }
| <vul-start> : "no" , ci -> ci_max_cpuid <vul-end> , ( rcr0
|
34 | CWE-000 void key_backspace ( ) { if ( editor . col + cursor . col > 0 ) { cursor . left ( & cursor ) ; for ( int i = editor . col + cursor . col ; i < strlen ( doc . buf [ editor . row + cursor . row ] ) ; i ++ ) { doc . buf [ editor . row + cursor . row ] [ i ] = doc . buf [ editor . row + cursor . row ] [ i + 1 ] ; } } else { if ( editor . row + cursor . row > 0 ) { cursor . left ( & cursor ) ; strcpy ( & doc . buf [ editor . row + cursor . row ] [ strlen ( doc . buf [ editor . row + cursor . row ] ) ] , doc . buf [ editor . row + cursor . row + 1 ] ) ; <vul-start> for ( int i = editor . row + cursor . row + 1 ; i < doc . rows - 1 ; i ++ ) { <vul-end> memset ( doc . buf [ i ] , 0 , sizeof ( char ) * DOC_MAXIMUM_COLS ) ; strcpy ( doc . buf [ i ] , doc . buf [ i + 1 ] ) ; <vul-start> } <vul-end> doc . rows -- ; } } }
| <vul-start> ; i < DOC_MAXIMUM_ROWS <vul-end> - 1 ; <vul-start> ] ) ; memset ( doc . buf [ i + 1 ] , 0 , sizeof ( char ) * DOC_MAXIMUM_COLS ) ;
|
35 | CWE-000 static void btc_init_bluetooth ( void ) { <vul-start> bte_main_boot_entry ( btc_init_callback ) ; <vul-end> }
| <vul-start> void ) { osi_alarm_create_mux ( ) ; osi_alarm_init ( ) ;
|
36 | CWE-000 int semanage_create_store ( semanage_handle_t * sh , int create ) { <vul-start> struct stat sb ; <vul-end> int mode_mask = R_OK | W_OK | X_OK ; const char * path = semanage_files [ SEMANAGE_ROOT ] ; int fd ; if ( stat ( path , & sb ) == - 1 ) { if ( errno == ENOENT && create ) { if ( mkdir ( path , S_IRWXU ) == - 1 ) { ERR ( sh , "Could not create module store at %s." , path ) ; return - 2 ; } } else { if ( create ) ERR ( sh , "Could not read from module store at %s." , path ) ; return - 1 ; } } else { <vul-start> if ( ! S_ISDIR ( sb . st_mode ) || access ( path , mode_mask ) == - 1 ) { <vul-end> ERR ( sh , "Could not access module store at %s, or it is not a directory." , path ) ; return - 1 ; } } path = semanage_path ( SEMANAGE_ACTIVE , SEMANAGE_TOPLEVEL ) ; if ( stat ( path , & sb ) == - 1 ) { if ( errno == ENOENT && create ) { if ( mkdir ( path , S_IRWXU ) == - 1 ) { ERR ( sh , "Could not create module store, active subdirectory at %s." , path ) ; return - 2 ; } } else { ERR ( sh , "Could not read from module store, active subdirectory at %s." , path ) ; return - 1 ; } } else { <vul-start> if ( ! S_ISDIR ( sb . st_mode ) || access ( path , mode_mask ) == - 1 ) { <vul-end> ERR ( sh , "Could not access module store active subdirectory at %s, or it is not a directory." , path ) ; return - 1 ; } } path = semanage_path ( SEMANAGE_ACTIVE , SEMANAGE_MODULES ) ; if ( stat ( path , & sb ) == - 1 ) { if ( errno == ENOENT && create ) { if ( mkdir ( path , S_IRWXU ) == - 1 ) { ERR ( sh , "Could not create module store, active modules subdirectory at %s." , path ) ; return - 2 ; } } else { ERR ( sh , "Could not read from module store, active modules subdirectory at %s." , path ) ; return - 1 ; } } else { <vul-start> if ( ! S_ISDIR ( sb . st_mode ) || access ( path , mode_mask ) == - 1 ) { <vul-end> ERR ( sh , "Could not access module store active modules subdirectory at %s, or it is not a directory." , path ) ; return - 1 ; } } path = semanage_files [ SEMANAGE_READ_LOCK ] ; if ( stat ( path , & sb ) == - 1 ) { if ( errno == ENOENT && create ) { if ( ( fd = creat ( path , S_IRUSR | S_IWUSR ) ) == - 1 ) { ERR ( sh , "Could not create lock file at %s." , path ) ; return - 2 ; } close ( fd ) ; } else { ERR ( sh , "Could not read lock file at %s." , path ) ; return - 1 ; } } else { <vul-start> if ( ! S_ISREG ( sb . st_mode ) || access ( path , R_OK | W_OK ) == - 1 ) { <vul-end> ERR ( sh , "Could not access lock file at %s." , path ) ; return - 1 ; } } return 0 ; }
| <vul-start> struct stat sb <vul-end> ; const char <vul-start> . st_mode ) ) { ERR ( sh , "Module store at %s is not a directory." <vul-end> , path ) <vul-start> . st_mode ) ) { ERR ( sh , "Module store active subdirectory at %s is not a directory." <vul-end> , path ) <vul-start> . st_mode ) ) { ERR ( sh , "Module store active modules subdirectory at %s is not a directory." <vul-end> , path ) <vul-start> . st_mode ) ) { ERR ( sh , "Lock file at %s missing." <vul-end> , path )
|
37 | CWE-000 static int inno_hdmi_phy_rk3328_power_on ( struct inno_hdmi_phy * inno , const struct post_pll_config * cfg , const struct phy_config * phy_cfg ) { u32 val ; inno_update_bits ( inno , 0x02 , 1 , 0 ) ; inno_update_bits ( inno , 0xaa , 1 , 1 ) ; val = cfg -> fbdiv & 0xff ; inno_write ( inno , 0xac , val ) ; if ( cfg -> postdiv == 1 ) { inno_write ( inno , 0xaa , 2 ) ; val = ( cfg -> fbdiv >> 8 ) | cfg -> prediv ; inno_write ( inno , 0xab , val ) ; } else { val = ( cfg -> postdiv / 2 ) - 1 ; inno_write ( inno , 0xad , val ) ; val = ( cfg -> fbdiv >> 8 ) | cfg -> prediv ; inno_write ( inno , 0xab , val ) ; inno_write ( inno , 0xaa , 0x0e ) ; } for ( val = 0 ; val < 14 ; val ++ ) inno_write ( inno , 0xb5 + val , phy_cfg -> regs [ val ] ) ; inno_write ( inno , 0xc8 , 0 ) ; inno_write ( inno , 0xc9 , 0 ) ; inno_write ( inno , 0xca , 0 ) ; inno_write ( inno , 0xcb , 0 ) ; if ( phy_cfg -> tmdsclock > 340000000 ) { val = 75000000 / 100000 ; inno_write ( inno , 0xc5 , ( ( val >> 8 ) & 0xff ) | 0x80 ) ; inno_write ( inno , 0xc6 , val & 0xff ) ; inno_write ( inno , 0xc7 , 3 << 1 ) ; inno_write ( inno , 0xc5 , ( ( val >> 8 ) & 0xff ) ) ; } else if ( phy_cfg -> tmdsclock > 165000000 ) { inno_write ( inno , 0xc5 , 0x81 ) ; inno_write ( inno , 0xc8 , 0x30 ) ; inno_write ( inno , 0xc9 , 0x10 ) ; inno_write ( inno , 0xca , 0x10 ) ; inno_write ( inno , 0xcb , 0x10 ) ; } else { inno_write ( inno , 0xc5 , 0x81 ) ; } inno_update_bits ( inno , 0xaa , 1 , 0 ) ; inno_update_bits ( inno , 0xb0 , 4 , 4 ) ; inno_write ( inno , 0xb2 , 0x0f ) ; for ( val = 0 ; val < 5 ; val ++ ) { if ( inno_read ( inno , 0xaf ) & 1 ) break ; udelay ( 1000 ) ; } if ( ! ( inno_read ( inno , 0xaf ) & 1 ) ) { printf ( "HDMI PHY Post PLL unlock\\n" ) ; return - ETIMEDOUT ; } if ( phy_cfg -> tmdsclock > 340000000 ) <vul-start> udelay ( 100000 ) ; <vul-end> inno_update_bits ( inno , 0x02 , 1 , 1 ) ; return 0 ; }
| <vul-start> > 340000000 ) mdelay ( 100 <vul-end> ) ; inno_update_bits
|
38 | CWE-000 NPY_NO_EXPORT PyObject * PyArray_Nonzero ( PyArrayObject * self ) { int i , ndim = PyArray_NDIM ( self ) ; PyArrayObject * ret = NULL ; PyObject * ret_tuple ; npy_intp ret_dims [ 2 ] ; PyArray_NonzeroFunc * nonzero = PyArray_DESCR ( self ) -> f -> nonzero ; npy_intp nonzero_count ; NpyIter * iter ; NpyIter_IterNextFunc * iternext ; NpyIter_GetMultiIndexFunc * get_multi_index ; char * * dataptr ; int is_empty = 0 ; nonzero_count = PyArray_CountNonzero ( self ) ; if ( nonzero_count < 0 ) { return NULL ; } ret_dims [ 0 ] = nonzero_count ; ret_dims [ 1 ] = ( ndim == 0 ) ? 1 : ndim ; ret = ( PyArrayObject * ) PyArray_New ( & PyArray_Type , 2 , ret_dims , NPY_INTP , NULL , NULL , 0 , 0 , NULL ) ; if ( ret == NULL ) { return NULL ; } if ( ndim <= 1 ) { npy_intp * multi_index = ( npy_intp * ) PyArray_DATA ( ret ) ; char * data = PyArray_BYTES ( self ) ; npy_intp stride = ( ndim == 0 ) ? 0 : PyArray_STRIDE ( self , 0 ) ; npy_intp count = ( ndim == 0 ) ? 1 : PyArray_DIM ( self , 0 ) ; NPY_BEGIN_THREADS_DEF ; if ( nonzero_count == 0 ) { goto finish ; } NPY_BEGIN_THREADS_THRESHOLDED ( count ) ; if ( PyArray_ISBOOL ( self ) ) { if ( ( ( double ) nonzero_count / count ) <= 0.1 ) { npy_intp subsize ; npy_intp j = 0 ; while ( 1 ) { npy_memchr ( data + j * stride , 0 , stride , count - j , & subsize , 1 ) ; j += subsize ; if ( j >= count ) { break ; } * multi_index ++ = j ++ ; } } else { npy_intp j ; for ( j = 0 ; j < count ; ++ j ) { if ( * data != 0 ) { * multi_index ++ = j ; } data += stride ; } } } else { npy_intp j ; for ( j = 0 ; j < count ; ++ j ) { if ( nonzero ( data , self ) ) { * multi_index ++ = j ; } data += stride ; } } NPY_END_THREADS ; goto finish ; } iter = NpyIter_New ( self , NPY_ITER_READONLY | NPY_ITER_MULTI_INDEX | NPY_ITER_ZEROSIZE_OK | NPY_ITER_REFS_OK , NPY_CORDER , NPY_NO_CASTING , NULL ) ; if ( iter == NULL ) { Py_DECREF ( ret ) ; return NULL ; } if ( NpyIter_GetIterSize ( iter ) != 0 ) { npy_intp * multi_index ; NPY_BEGIN_THREADS_DEF ; iternext = NpyIter_GetIterNext ( iter , NULL ) ; if ( iternext == NULL ) { NpyIter_Deallocate ( iter ) ; Py_DECREF ( ret ) ; return NULL ; } get_multi_index = NpyIter_GetGetMultiIndex ( iter , NULL ) ; if ( get_multi_index == NULL ) { NpyIter_Deallocate ( iter ) ; Py_DECREF ( ret ) ; return NULL ; } NPY_BEGIN_THREADS_NDITER ( iter ) ; dataptr = NpyIter_GetDataPtrArray ( iter ) ; multi_index = ( npy_intp * ) PyArray_DATA ( ret ) ; if ( PyArray_ISBOOL ( self ) ) { do { if ( * * dataptr != 0 ) { get_multi_index ( iter , multi_index ) ; multi_index += ndim ; } } while ( iternext ( iter ) ) ; } else { do { if ( nonzero ( * dataptr , self ) ) { get_multi_index ( iter , multi_index ) ; multi_index += ndim ; } } while ( iternext ( iter ) ) ; } NPY_END_THREADS ; } NpyIter_Deallocate ( iter ) ; finish : if ( ndim == 0 ) { ndim = 1 ; } ret_tuple = PyTuple_New ( ndim ) ; if ( ret_tuple == NULL ) { Py_DECREF ( ret ) ; return NULL ; } <vul-start> for ( i = 0 ; i < ndim ; ++ i ) { <vul-end> if ( PyArray_DIMS ( ret ) [ i ] == 0 ) { is_empty = 1 ; break ; } } for ( i = 0 ; i < ndim ; ++ i ) { npy_intp stride = ndim * NPY_SIZEOF_INTP ; npy_intp data_offset = is_empty ? 0 : i * NPY_SIZEOF_INTP ; PyArrayObject * view = ( PyArrayObject * ) PyArray_New ( Py_TYPE ( ret ) , 1 , & nonzero_count , NPY_INTP , & stride , PyArray_BYTES ( ret ) + data_offset , 0 , PyArray_FLAGS ( ret ) , ( PyObject * ) ret ) ; if ( view == NULL ) { Py_DECREF ( ret ) ; Py_DECREF ( ret_tuple ) ; return NULL ; } Py_INCREF ( ret ) ; if ( PyArray_SetBaseObject ( view , ( PyObject * ) ret ) < 0 ) { Py_DECREF ( ret ) ; Py_DECREF ( ret_tuple ) ; return NULL ; } PyTuple_SET_ITEM ( ret_tuple , i , ( PyObject * ) view ) ; } Py_DECREF ( ret ) ; return ret_tuple ; }
| <vul-start> ; i < PyArray_NDIM ( ret ) <vul-end> ; ++ i
|
39 | CWE-000 void print_state ( NordicRF24 * pRadio ) { int i = 0 ; uint8_t addr_width = pRadio -> get_address_width ( ) ; uint8_t address [ 5 ] , w = 0 ; printf ( "Data Ready Interrupt: %s\\n" , pRadio -> use_interrupt_data_ready ( ) ? "true" : "false" ) ; printf ( "Data Sent Interrupt: %s\\n" , pRadio -> use_interrupt_data_sent ( ) ? "true" : "false" ) ; printf ( "Max Retry Interrupt: %s\\n" , pRadio -> use_interrupt_max_retry ( ) ? "true" : "false" ) ; printf ( "CRC Enabled: %s\\n" , pRadio -> is_crc_enabled ( ) ? "true" : "false" ) ; printf ( "Is Powered Up: %s\\n" , pRadio -> is_powered_up ( ) ? "true" : "false" ) ; printf ( "Is Receiver: %s\\n" , pRadio -> is_receiver ( ) ? "true" : "false" ) ; printf ( "2 byte CRC: %s\\n" , pRadio -> is_2_byte_crc ( ) ? "true" : "false" ) ; printf ( "Address Width: %d\\n" , addr_width ) ; printf ( "Retry Delay: %d\\n" , pRadio -> get_retry_delay ( ) ) ; printf ( "Retry Count: %d\\n" , pRadio -> get_retry_count ( ) ) ; printf ( "Channel: %d\\n" , pRadio -> get_channel ( ) ) ; printf ( "Power Level: %d\\n" , pRadio -> get_power_level ( ) ) ; printf ( "Data Rate: %d\\n" , pRadio -> get_data_rate ( ) ) ; printf ( "Continuous Carrier: %s\\n" , pRadio -> is_continuous_carrier_transmit ( ) ? "true" : "false" ) ; printf ( "Dynamic Payloads: %s\\n" , pRadio -> dynamic_payloads_enabled ( ) ? "true" : "false" ) ; printf ( "Payload ACK: %s\\n" , pRadio -> payload_ack_enabled ( ) ? "true" : "false" ) ; printf ( "TX No ACK: %s\\n" , pRadio -> tx_noack_cmd_enabled ( ) ? "true" : "false" ) ; for ( i = 0 ; i < RF24_PIPES ; i ++ ) { printf ( "Pipe %d Enabled: %s\\n" , i , pRadio -> is_pipe_enabled ( i ) ? "true" : "false" ) ; printf ( "Pipe %d ACK: %s\\n" , i , pRadio -> is_pipe_ack ( i ) ? "true" : "false" ) ; pRadio -> get_rx_address ( i , address , & addr_width ) ; printf ( "Pipe %d Address: [" , i ) ; <vul-start> for ( int j = 0 ; j < addr_width ; j ++ ) { <vul-end> printf ( " %X " , address [ j ] ) ; } printf ( "]\\n" ) ; pRadio -> get_payload_width ( i , & w ) ; printf ( "Pipe %d Payload Width: %d\\n" , i , w ) ; printf ( "Pipe %d Dynamic Payloads: %s\\n\\n" , i , pRadio -> is_dynamic_payload ( i ) ? "true" : "false" ) ; } pRadio -> get_tx_address ( address , & addr_width ) ; printf ( "Transmit Address: [" ) ; <vul-start> for ( int j = 0 ; j < addr_width ; j ++ ) { <vul-end> printf ( " %X " , address [ j ] ) ; } printf ( "]\\n" ) ; }
| <vul-start> int j = addr_width - 1 ; j >= <vul-start> 0 ; j -- <vul-end> ) { printf <vul-start> int j = addr_width - 1 ; j >= <vul-start> 0 ; j -- <vul-end> ) { printf
|
40 | CWE-000 <vul-start> bool blk_mq_dispatch_rq_list ( struct blk_mq_hw_ctx * hctx , struct list_head * list ) <vul-end> { struct request_queue * q = hctx -> queue ; struct request * rq ; LIST_HEAD ( driver_list ) ; struct list_head * dptr ; int errors , queued , ret = BLK_MQ_RQ_QUEUE_OK ; <vul-start> dptr = NULL ; <vul-end> errors = queued = 0 ; <vul-start> while ( ! list_empty ( list ) ) { <vul-end> struct blk_mq_queue_data bd ; rq = list_first_entry ( list , struct request , queuelist ) ; if ( ! blk_mq_get_driver_tag ( rq , & hctx , false ) ) { if ( ! queued && reorder_tags_to_front ( list ) ) continue ; if ( blk_mq_dispatch_wait_add ( hctx ) ) { if ( ! blk_mq_get_driver_tag ( rq , & hctx , false ) ) break ; } else { break ; } } list_del_init ( & rq -> queuelist ) ; bd . rq = rq ; bd . list = dptr ; if ( list_empty ( list ) ) bd . last = true ; else { struct request * nxt ; nxt = list_first_entry ( list , struct request , queuelist ) ; bd . last = ! blk_mq_get_driver_tag ( nxt , NULL , false ) ; } ret = q -> mq_ops -> queue_rq ( hctx , & bd ) ; switch ( ret ) { case BLK_MQ_RQ_QUEUE_OK : queued ++ ; break ; case BLK_MQ_RQ_QUEUE_BUSY : blk_mq_put_driver_tag_hctx ( hctx , rq ) ; list_add ( & rq -> queuelist , list ) ; __blk_mq_requeue_request ( rq ) ; break ; default : pr_err ( "blk-mq: bad return on queue: %d\\n" , ret ) ; case BLK_MQ_RQ_QUEUE_ERROR : errors ++ ; rq -> errors = - EIO ; blk_mq_end_request ( rq , rq -> errors ) ; break ; } if ( ret == BLK_MQ_RQ_QUEUE_BUSY ) break ; if ( ! dptr && list -> next != list -> prev ) dptr = & driver_list ; <vul-start> } <vul-end> hctx -> dispatched [ queued_to_index ( queued ) ] ++ ; if ( ! list_empty ( list ) ) { rq = list_first_entry ( list , struct request , queuelist ) ; blk_mq_put_driver_tag ( rq ) ; spin_lock ( & hctx -> lock ) ; list_splice_init ( list , & hctx -> dispatch ) ; spin_unlock ( & hctx -> lock ) ; if ( ! blk_mq_sched_needs_restart ( hctx ) && ! test_bit ( BLK_MQ_S_TAG_WAITING , & hctx -> state ) ) blk_mq_run_hw_queue ( hctx , true ) ; } return ( queued + errors ) != 0 ; }
| <vul-start> blk_mq_dispatch_rq_list ( struct request_queue * q , struct list_head * list ) { struct <vul-start> blk_mq_hw_ctx * hctx ; struct request * rq ; LIST_HEAD ( driver_list ) ; <vul-end> struct list_head * <vul-start> struct list_head * <vul-end> dptr ; int <vul-start> = BLK_MQ_RQ_QUEUE_OK ; if ( list_empty ( list ) ) return false ; <vul-start> = 0 ; do <vul-end> { struct blk_mq_queue_data <vul-start> driver_list ; } while ( ! list_empty ( list ) ) ;
|
41 | CWE-000 size_t AllocateInBitmap ( Bitmap * bitmap , size_t len ) { assert ( bitmap ) ; size_t first = FindInBitmap ( bitmap , len ) ; <vul-start> MarkInBitmap ( bitmap , first , len , true ) ; <vul-end> return first ; }
| <vul-start> len ) ; if ( first == BITMAP_INVALID_WORD_IX ) { return BITMAP_INVALID_WORD_IX ; }
|
42 | CWE-000 static FuDeviceItem * fu_device_list_find_by_id ( FuDeviceList * self , const gchar * device_id , gboolean * multiple_matches ) { FuDeviceItem * item = NULL ; gsize device_id_len ; device_id_len = strlen ( device_id ) ; for ( guint i = 0 ; i < self -> devices -> len ; i ++ ) { FuDeviceItem * item_tmp = g_ptr_array_index ( self -> devices , i ) ; const gchar * ids [ ] = { fu_device_get_id ( item_tmp -> device ) , fu_device_get_equivalent_id ( item_tmp -> device ) , NULL } ; for ( guint j = 0 ; ids [ j ] != NULL ; j ++ ) { if ( strncmp ( ids [ j ] , device_id , device_id_len ) == 0 ) { if ( item != NULL && multiple_matches != NULL ) * multiple_matches = TRUE ; item = item_tmp ; } } } for ( guint i = 0 ; i < self -> devices -> len ; i ++ ) { FuDeviceItem * item_tmp = g_ptr_array_index ( self -> devices , i ) ; <vul-start> const gchar * ids [ ] = { <vul-end> fu_device_get_id ( item_tmp -> device ) , fu_device_get_equivalent_id ( item_tmp -> device ) , NULL } ; if ( item_tmp -> device_old == NULL ) continue ; <vul-start> for ( guint j = 0 ; ids [ j ] != NULL ; j ++ ) { <vul-end> if ( strncmp ( ids [ j ] , device_id , device_id_len ) == 0 ) { if ( item != NULL && multiple_matches != NULL ) * multiple_matches = TRUE ; item = item_tmp ; } } } return item ; }
| <vul-start> * ids [ 3 ] = { <vul-end> NULL } ; <vul-start> ) continue ; ids [ 0 ] = fu_device_get_id ( item_tmp -> device_old ) ; ids [ 1 ] = fu_device_get_equivalent_id ( item_tmp -> device_old ) ;
|
43 | CWE-000 static TPM_RC StartAuthSession ( TSS2_SYS_CONTEXT * sapi_context , SESSION * session ) { TPM_RC rval ; TPM2B_ENCRYPTED_SECRET key ; char label [ ] = "ATH" ; UINT16 bytes ; int i ; key . t . size = 0 ; if ( session -> nonceOlder . t . size == 0 ) { session -> nonceOlder . t . size = GetDigestSize ( TPM_ALG_SHA1 ) ; for ( i = 0 ; i < session -> nonceOlder . t . size ; i ++ ) session -> nonceOlder . t . buffer [ i ] = 0 ; } session -> nonceNewer . t . size = session -> nonceOlder . t . size ; rval = Tss2_Sys_StartAuthSession ( sapi_context , session -> tpmKey , session -> bind , 0 , & ( session -> nonceOlder ) , & ( session -> encryptedSalt ) , session -> sessionType , & ( session -> symmetric ) , session -> authHash , & ( session -> sessionHandle ) , & ( session -> nonceNewer ) , 0 ) ; if ( rval == TPM_RC_SUCCESS ) { if ( session -> tpmKey == TPM_RH_NULL ) session -> salt . t . size = 0 ; if ( session -> bind == TPM_RH_NULL ) session -> authValueBind . t . size = 0 ; if ( session -> tpmKey == TPM_RH_NULL && session -> bind == TPM_RH_NULL ) { session -> sessionKey . b . size = 0 ; } else { bool result = string_bytes_concat_buffer ( ( TPM2B_MAX_BUFFER * ) & key , & ( session -> authValueBind . b ) ) ; if ( ! result ) { return TSS2_SYS_RC_BAD_VALUE ; } result = string_bytes_concat_buffer ( ( TPM2B_MAX_BUFFER * ) & key , & ( session -> salt . b ) ) ; if ( ! result ) { return TSS2_SYS_RC_BAD_VALUE ; } bytes = GetDigestSize ( session -> authHash ) ; if ( key . t . size == 0 ) { session -> sessionKey . t . size = 0 ; } else { <vul-start> rval = tpm_kdfa ( sapi_context , session -> authHash , & ( key . b ) , label , & ( session -> nonceNewer . b ) , <vul-end> & ( session -> nonceOlder . b ) , bytes * 8 , ( TPM2B_MAX_BUFFER * ) & ( session -> sessionKey ) ) ; } if ( rval != TPM_RC_SUCCESS ) { return ( TSS2_APP_RC_CREATE_SESSION_KEY_FAILED ) ; } } session -> nonceTpmDecrypt . b . size = 0 ; session -> nonceTpmEncrypt . b . size = 0 ; session -> nvNameChanged = 0 ; } return rval ; }
| <vul-start> = tpm_kdfa ( <vul-end> session -> authHash
|
44 | CWE-000 int ft_numlen ( int n , int base ) { int len ; <vul-start> long nb ; <vul-end> len = 0 ; nb = ( long ) n ; if ( nb <= 0 ) nb *= - 1 ; while ( nb != 0 ) { len ++ ; nb /= base ; } return ( len ) ; }
| <vul-start> ; long nb ; if ( n == 0 ) return ( 1 )
|
45 | CWE-000 int adcusb_start ( struct adcusb_device * dev ) { <vul-start> g_assert_nonnull ( dev ) ; <vul-end> <vul-start> dev -> ad_running = true ; <vul-end> dev -> ad_libusb_thread = g_thread_new ( "adcusb" , adcusb_libusb_thread , dev ) ; dev -> ad_transfer = true ; for ( int i = 0 ; i < ADCUSB_NUM_XFERS ; i ++ ) { dev -> ad_buffers [ i ] = g_malloc0 ( dev -> ad_num_descs * ADCUSB_PACKET_SIZE ) ; dev -> ad_xfers [ i ] = libusb_alloc_transfer ( ADCUSB_PACKET_SIZE ) ; dev -> ad_buffer_size = ( int ) ( ADCUSB_PACKET_SIZE * dev -> ad_num_descs ) ; libusb_fill_iso_transfer ( dev -> ad_xfers [ i ] , dev -> ad_handle , ADCUSB_EP_NUM | LIBUSB_ENDPOINT_IN , ( uint8_t * ) dev -> ad_buffers [ i ] , ADCUSB_PACKET_SIZE , ( int ) dev -> ad_num_descs , adcusb_transfer_cb , dev , 1000 ) ; libusb_set_iso_packet_lengths ( dev -> ad_xfers [ i ] , ADCUSB_PACKET_SIZE ) ; if ( libusb_submit_transfer ( dev -> ad_xfers [ i ] ) != 0 ) <vul-start> return ( - 1 ) ; <vul-end> } <vul-start> return ( 0 ) ; <vul-end> }
| <vul-start> dev ) { g_mutex_lock ( & dev -> ad_mtx ) ; <vul-start> dev ) ; if ( dev -> ad_transfer ) goto done ; if ( ! <vul-start> dev -> ad_running ) goto fail ; if ( libusb_claim_interface ( dev -> ad_handle , 1 ) != 0 ) goto fail <vul-end> ; dev -> <vul-start> != 0 ) goto fail ; } done : g_mutex_unlock ( & dev -> ad_mtx ) ; return ( 0 ) ; fail : g_mutex_unlock ( & dev -> ad_mtx ) ; <vul-start> ) ; } <vul-end>
|
46 | CWE-000 static Worker * worker_init ( void ) { Worker * result = ( Worker * ) safe_alloc ( 1 , sizeof ( Worker ) ) ; pthread_mutex_init ( & ( result -> access_lock ) , NULL ) ; <vul-start> result -> fifo_path = NULL ; <vul-end> return result ; }
| <vul-start> ; result -> fifo_in_path = NULL ; result -> fifo_out_path <vul-end> = NULL ;
|
47 | CWE-000 int initMp3 ( const char * file ) { int err = 0 ; int encoding = 0 ; if ( ( err = mpg123_init ( ) ) != MPG123_OK ) return err ; if ( ( mh = mpg123_new ( NULL , & err ) ) == NULL ) { <vul-start> return err ; <vul-end> } if ( mpg123_open ( mh , file ) != MPG123_OK || mpg123_getformat ( mh , ( long * ) & rate , ( int * ) & channels , & encoding ) != MPG123_OK ) { <vul-start> return - 1 ; <vul-end> } mpg123_format_none ( mh ) ; mpg123_format ( mh , rate , channels , encoding ) ; * buffSize = mpg123_outblock ( mh ) * 16 ; return 0 ; }
| <vul-start> NULL ) { printf ( "Error: %s\\n" , mpg123_plain_strerror ( err ) ) ; <vul-start> MPG123_OK ) { printf ( "Trouble with mpg123: %s\\n" , mpg123_strerror ( mh ) ) ;
|
48 | CWE-000 static void controlCruise ( void ) { static float accumDecay ; if ( lastRawSensorData == 0 || lastRawSensorData == 255 ) { accumDecay *= decayRate ; internalSpeedSetpoint = speedSetpoint * accumDecay + 15 * ( 1 - accumDecay ) ; } else { accumDecay = 1 ; internalSpeedSetpoint = speedSetpoint ; internalLastSensorPosition = lastSensorPosition ; } float sensorError = 0 - internalLastSensorPosition ; float dSensorError = sensorError - lastSensorError ; <vul-start> int newSpeed ; <vul-end> <vul-start> newSpeed = internalSpeedSetpoint * ( 1 - abs ( dSensorError ) * corneringDBrakeFactor - abs ( sensorError ) * corneringPBrakeFactor ) ; <vul-end> int newCurveRadius ; newCurveRadius = - sharpestCurve / ( cruiseKp * sensorError + cruiseKd * dSensorError ) ; double newSharpness ; newSharpness = cruiseKi * lastSharpness + 1 / ( ( double ) newCurveRadius ) ; if ( newSharpness > 1 / ( ( double ) sharpestCurve ) ) { newSharpness = 1 / ( ( double ) sharpestCurve ) ; } else if ( newSharpness < - 1 / ( ( double ) sharpestCurve ) ) { newSharpness = - 1 / ( ( double ) sharpestCurve ) ; } lastSharpness = newSharpness ; newCurveRadius = 1 / newSharpness ; diffDrive ( newSpeed , newCurveRadius ) ; lastSensorError = sensorError ; }
| <vul-start> - lastSensorError ; float newSpeed ; float absSensorError ; float absDSensorError ; if ( sensorError < 0 ) { absSensorError = - sensorError ; } else { absSensorError = sensorError ; } if ( dSensorError < 0 ) { absDSensorError = - dSensorError ; } else { absDSensorError = dSensorError ; } newSpeed = ( ( float ) internalSpeedSetpoint ) * ( 1 - absDSensorError <vul-end> * corneringDBrakeFactor - <vul-start> * corneringDBrakeFactor - absSensorError <vul-end> * corneringPBrakeFactor )
|
49 | CWE-000 int iwl_mvm_rm_snif_sta ( struct iwl_mvm * mvm , struct ieee80211_vif * vif ) { int ret ; <vul-start> lockdep_assert_held ( & mvm -> mutex ) ; <vul-end> ret = iwl_mvm_rm_sta_common ( mvm , mvm -> snif_sta . sta_id ) ; if ( ret ) IWL_WARN ( mvm , "Failed sending remove station\\n" ) ; return ret ; }
| <vul-start> mvm -> mutex ) ; iwl_mvm_disable_txq ( mvm , mvm -> snif_queue , mvm -> snif_queue , IWL_MAX_TID_COUNT , 0
|
50 | CWE-000 void x_ae_context_add_polygon ( X_AE_Context * context , X_Polygon3 * polygon , X_BspSurface * bspSurface , X_BoundBoxFrustumFlags geoFlags , int * edgeIds , int bspKey , _Bool inSubmodel ) { X_Vec3 clippedV [ X_POLYGON3_MAX_VERTS ] ; <vul-start> X_Polygon3 clipped = x_polygon3_make ( clippedV , X_POLYGON3_MAX_VERTS ) ; <vul-end> ++ context -> renderContext -> renderer -> totalSurfacesRendered ; int tempEdgeIds [ X_POLYGON3_MAX_VERTS ] = { 0 } ; int * clippedEdgeIds = tempEdgeIds ; if ( geoFlags == X_BOUNDBOX_TOTALLY_INSIDE_FRUSTUM ) { clipped = * polygon ; clippedEdgeIds = edgeIds ; } else if ( ! x_polygon3_clip_to_frustum_edge_ids ( polygon , context -> renderContext -> viewFrustum , & clipped , geoFlags , edgeIds , clippedEdgeIds ) ) { return ; } X_AE_Surface * surface = create_ae_surface ( context , bspSurface , bspKey ) ; surface -> inSubmodel = inSubmodel ; X_Vec2_fp16x16 v2d [ X_POLYGON3_MAX_VERTS ] ; if ( ! project_polygon3 ( & clipped , & context -> renderContext -> cam -> viewMatrix , & context -> renderContext -> cam -> viewport , surface , v2d ) ) return ; X_Vec3 camPos = x_cameraobject_get_position ( context -> renderContext -> cam ) ; <vul-start> x_ae_surface_calculate_inverse_z_gradient ( surface , & camPos , & context -> renderContext -> cam -> viewport , context -> renderContext -> viewMatrix ) ; <vul-end> emit_edges ( context , surface , v2d , clipped . totalVertices , clippedEdgeIds ) ; }
| <vul-start> , X_POLYGON3_MAX_VERTS ) ; X_Vec3 firstVertex = polygon -> vertices [ 0 ] <vul-start> renderContext -> viewMatrix , & firstVertex
|
51 | CWE-000 static int htm_decode_one ( struct htm_decode_state * state ) { uint64_t value ; unsigned int tag ; int ret ; ret = htm_decode_fetch ( state , & value ) ; if ( ret < 0 ) { return ret ; } if ( value == 0 ) return 1 ; tag = htm_uint32 ( htm_bits ( value , 0 , 19 ) ) ; if ( tag == 0xACEFF ) { ret = htm_decode_stamp ( state , value ) ; } else { ret = htm_decode_insn ( state , value ) ; if ( ret == - 2 ) { htm_rewind ( state , value ) ; } } if ( ret < 0 ) { <vul-start> printf ( "Invalid record %d %016" PRIx64 "\\n" , state -> nr , value ) ; <vul-end> if ( state -> error_count ++ > 100 ) { printf ( "Trace corrupted too badly to parse\\n" ) ; assert ( 0 ) ; } return 1 ; } else { state -> error_count = 0 ; } return 1 ; }
| <vul-start> { printf ( "Invalid record:%d offset:%li data:%016" PRIx64 " \\n" , <vul-end> state -> nr <vul-start> state -> nr , ftell ( state -> fd )
|
52 | CWE-000 int adj_graph_max_vertex_index ( adj_graph_t * graph ) { if ( graph -> max_vertex_index == - 1 ) { graph -> max_vertex_index = adj_graph_num_vertices ( graph ) - 1 ; int i_max = ( int ) ( graph -> vtx_dist [ graph -> rank + 1 ] - graph -> vtx_dist [ graph -> rank ] ) ; for ( int i = 0 ; i < i_max ; ++ i ) <vul-start> graph -> max_vertex_index = MAX ( graph -> max_vertex_index , graph -> adjacency [ i ] ) ; <vul-end> } return graph -> max_vertex_index ; }
| <vul-start> ++ i ) { for ( int j = graph -> xadj [ i ] ; j < graph -> xadj [ i + 1 ] ; ++ j ) <vul-start> -> adjacency [ j <vul-end> ] ) ; <vul-start> ] ) ; }
|
53 | CWE-000 int lxc_setup ( struct lxc_handler * handler ) { int ret ; const char * lxcpath = handler -> lxcpath , * name = handler -> name ; struct lxc_conf * lxc_conf = handler -> conf ; ret = do_rootfs_setup ( lxc_conf , name , lxcpath ) ; if ( ret < 0 ) { ERROR ( "Failed to setup rootfs" ) ; return - 1 ; } if ( handler -> nsfd [ LXC_NS_UTS ] == - 1 ) { ret = setup_utsname ( lxc_conf -> utsname ) ; if ( ret < 0 ) { ERROR ( "Failed to setup the utsname %s" , name ) ; return - 1 ; } } ret = lxc_setup_network_in_child_namespaces ( lxc_conf , & lxc_conf -> network ) ; if ( ret < 0 ) { ERROR ( "Failed to setup network" ) ; return - 1 ; } ret = lxc_network_send_name_and_ifindex_to_parent ( handler ) ; if ( ret < 0 ) { ERROR ( "Failed to send network device names and ifindices to parent" ) ; return - 1 ; } if ( lxc_conf -> autodev > 0 ) { ret = mount_autodev ( name , & lxc_conf -> rootfs , lxcpath ) ; if ( ret < 0 ) { ERROR ( "Failed to mount \\"/dev\\"" ) ; return - 1 ; } } ret = lxc_mount_auto_mounts ( lxc_conf , lxc_conf -> auto_mounts & ~ LXC_AUTO_CGROUP_MASK , handler ) ; if ( ret < 0 ) { ERROR ( "Failed to setup first automatic mounts" ) ; return - 1 ; } ret = setup_mount ( lxc_conf , & lxc_conf -> rootfs , lxc_conf -> fstab , name , lxcpath ) ; if ( ret < 0 ) { ERROR ( "Failed to setup mounts" ) ; return - 1 ; } if ( ! verify_start_hooks ( lxc_conf ) ) return - 1 ; if ( lxc_conf -> is_execute ) { <vul-start> ret = lxc_execute_bind_init ( lxc_conf ) ; <vul-end> if ( ret < 0 ) { ERROR ( "Failed to bind-mount the lxc init system" ) ; return - 1 ; } } ret = lxc_mount_auto_mounts ( lxc_conf , lxc_conf -> auto_mounts & LXC_AUTO_CGROUP_MASK , handler ) ; if ( ret < 0 ) { ERROR ( "Failed to setup remaining automatic mounts" ) ; return - 1 ; } ret = run_lxc_hooks ( name , "mount" , lxc_conf , NULL ) ; if ( ret < 0 ) { ERROR ( "Failed to run mount hooks" ) ; return - 1 ; } if ( lxc_conf -> autodev > 0 ) { ret = run_lxc_hooks ( name , "autodev" , lxc_conf , NULL ) ; if ( ret < 0 ) { ERROR ( "Failed to run autodev hooks" ) ; return - 1 ; } ret = lxc_fill_autodev ( & lxc_conf -> rootfs ) ; if ( ret < 0 ) { ERROR ( "Failed to populate \\"/dev\\"" ) ; return - 1 ; } } if ( ! lxc_list_empty ( & lxc_conf -> mount_list ) ) { ret = setup_mount_entries ( lxc_conf , & lxc_conf -> rootfs , & lxc_conf -> mount_list , name , lxcpath ) ; if ( ret < 0 ) { ERROR ( "Failed to setup mount entries" ) ; return - 1 ; } } ret = lxc_setup_console ( & lxc_conf -> rootfs , & lxc_conf -> console , lxc_conf -> ttydir ) ; if ( ret < 0 ) { ERROR ( "Failed to setup console" ) ; return - 1 ; } ret = lxc_setup_dev_symlinks ( & lxc_conf -> rootfs ) ; if ( ret < 0 ) { ERROR ( "Failed to setup \\"/dev\\" symlinks" ) ; return - 1 ; } ret = lxc_create_tmp_proc_mount ( lxc_conf ) ; if ( ret < 0 ) { ERROR ( "Failed to \\"/proc\\" LSMs" ) ; return - 1 ; } ret = setup_pivot_root ( & lxc_conf -> rootfs ) ; if ( ret < 0 ) { ERROR ( "Failed to pivot root into rootfs" ) ; return - 1 ; } ret = lxc_setup_devpts ( lxc_conf ) ; if ( ret < 0 ) { ERROR ( "Failed to setup new devpts instance" ) ; return - 1 ; } ret = lxc_create_ttys ( handler ) ; if ( ret < 0 ) return - 1 ; ret = setup_personality ( lxc_conf -> personality ) ; if ( ret < 0 ) { ERROR ( "Failed to set personality" ) ; return - 1 ; } if ( ! lxc_list_empty ( & lxc_conf -> sysctls ) ) { ret = setup_sysctl_parameters ( & lxc_conf -> sysctls ) ; if ( ret < 0 ) { ERROR ( "Failed to setup sysctl parameters" ) ; return - 1 ; } } if ( ! lxc_list_empty ( & lxc_conf -> keepcaps ) ) { if ( ! lxc_list_empty ( & lxc_conf -> caps ) ) { ERROR ( "Container requests lxc.cap.drop and " "lxc.cap.keep: either use lxc.cap.drop or " "lxc.cap.keep, not both" ) ; return - 1 ; } if ( dropcaps_except ( & lxc_conf -> keepcaps ) ) { ERROR ( "Failed to keep capabilities" ) ; return - 1 ; } } else if ( setup_caps ( & lxc_conf -> caps ) ) { ERROR ( "Failed to drop capabilities" ) ; return - 1 ; } NOTICE ( "The container \\"%s\\" is set up" , name ) ; return 0 ; }
| <vul-start> = lxc_execute_bind_init ( handler <vul-end> ) ; if
|
54 | CWE-000 static char * escape ( char * str ) { char * output = ( char * ) calloc ( strlen ( str ) * 6 , sizeof ( char ) ) ; char seq [ 7 ] ; for ( int i = 0 ; i < strlen ( str ) ; i ++ ) { switch ( str [ i ] ) { case '\\\\' : strcat ( output , "\\\\\\\\" ) ; break ; case '\\n' : strcat ( output , "\\\\n" ) ; break ; case '\\r' : strcat ( output , "\\\\r" ) ; break ; case '\\f' : strcat ( output , "\\\\f" ) ; break ; default : <vul-start> if ( ( str [ i ] >= 32 && str [ i ] <= 127 ) || ( str [ i ] >= 192 && str [ i ] <= 223 ) ) { <vul-end> output [ strlen ( output ) ] = str [ i ] ; } else { sprintf ( seq , "\\\\{%d}" , ( unsigned char ) str [ i ] ) ; strcat ( output , seq ) ; } } } return output ; }
| <vul-start> 127 ) || ( ( ( unsigned char ) str [ i ] ) <vul-end> >= 192 && <vul-start> >= 192 && ( ( unsigned char ) str [ i ] ) <vul-end> <= 223 )
|
55 | CWE-000 void start_camera_streaming ( int fd ) { # ifdef DO_PIN_CONFIG wiringPiSetupGpio ( ) ; pinModeAlt ( 0 , INPUT ) ; pinModeAlt ( 1 , INPUT ) ; pinModeAlt ( 28 , INPUT ) ; pinModeAlt ( 28 , 4 ) ; pinModeAlt ( 29 , INPUT ) ; pinModeAlt ( 29 , 4 ) ; digitalWrite ( 41 , 1 ) ; digitalWrite ( 32 , 1 ) ; # endif # define ENABLE_DATALANE_1 0x0 # define DISABLE_DATALANE_1 0x1 u8 _s_v_format = i2c_rd8 ( fd , VI_STATUS ) & 0x0F ; vcos_log_error ( "VI_STATUS to select cfg.data_lanes: %u" , _s_v_format ) ; u16 r0006 ; u8 r0148 ; u32 r0500 ; if ( _s_v_format < 12 ) { r0006 = 0x0080 ; r0148 = DISABLE_DATALANE_1 ; r0500 = 0xA3008080 ; vcos_log_error ( "Selected Sub 720p registers" ) ; } else { r0006 = 0x0008 ; r0148 = ENABLE_DATALANE_1 ; r0500 = 0xA3008082 ; vcos_log_error ( "Selected 720p+ registers" ) ; } struct cmds_t cmds [ ] = { { 0x0004 , 0x0000 , 2 } , { 0x0002 , 0x0F00 , 2 } , { 0x0000 , 1 , 0xFFFF } , { 0x0002 , 0x0000 , 2 } , { 0x0006 , r0006 , 2 } , { 0x0008 , 0x005f , 2 } , { 0x0014 , 0xFFFF , 2 } , { 0x0016 , 0x051f , 2 } , { 0x0020 , 0x8111 , 2 } , { 0x0022 , 0x0213 , 2 } , { 0x0004 , r0004 , 2 } , { 0x0140 , 0x0 , 4 } , { 0x0144 , 0x0 , 4 } , { 0x0148 , r0148 , 4 } , { 0x014C , 0x1 , 4 } , { 0x0150 , 0x1 , 4 } , { 0x0210 , 0x00002988 , 4 } , { 0x0214 , 0x00000005 , 4 } , { 0x0218 , 0x00001d04 , 4 } , { 0x021C , 0x00000002 , 4 } , { 0x0220 , 0x00000504 , 4 } , { 0x0224 , 0x00004600 , 4 } , { 0x0228 , 0x0000000A , 4 } , { 0x022C , 0x00000004 , 4 } , { 0x0234 , 0x0000001F , 4 } , { 0x0204 , 0x00000001 , 4 } , { 0x0518 , 0x00000001 , 4 } , { 0x0500 , r0500 , 4 } , { 0x8502 , 0x01 , 1 } , { 0x8512 , 0xFE , 1 } , { 0x8513 , ( uint8_t ) ~ 0x20 , 1 } , { 0x8515 , ( uint8_t ) ~ 0x02 , 1 } , { 0x8531 , 0x01 , 1 } , { 0x8540 , 0x0A8C , 2 } , { 0x8630 , 0x00041eb0 , 4 } , { 0x8670 , 0x01 , 1 } , { 0x8532 , 0x80 , 1 } , { 0x8536 , 0x40 , 1 } , { 0x853F , 0x0A , 1 } , { 0x8543 , 0x32 , 1 } , { 0x8544 , 0x10 , 1 } , { 0x8545 , 0x31 , 1 } , { 0x8546 , 0x2D , 1 } , { 0x85C7 , 0x01 , 1 } , { 0x85CB , 0x01 , 1 } , } ; # define NUM_REGS_CMD ( sizeof ( cmds ) / sizeof ( cmds [ 0 ] ) ) write_regs ( fd , cmds , NUM_REGS_CMD ) ; { u8 edid [ 256 ] ; int i , j ; unsigned char checksum = 0 ; for ( i = 0 ; i < sizeof ( TOSHH2C_DEFAULT_EDID ) / 2 ; i += 16 ) { for ( j = 0 ; j < 15 ; j ++ ) { <vul-start> edid [ i + j ] = ( ascii_to_hex ( TOSHH2C_DEFAULT_EDID [ i + j * 2 ] ) << 4 ) + <vul-end> <vul-start> ascii_to_hex ( TOSHH2C_DEFAULT_EDID [ i + j * 2 + 1 ] ) ; <vul-end> checksum -= edid [ i + j ] ; } if ( i == ( 7 * 16 ) || i == ( 15 * 16 ) ) { edid [ i + 15 ] = checksum ; checksum = 0 ; } else { checksum -= edid [ i + 15 ] ; } i2c_wr ( fd , 0x8C00 + i , & edid [ i ] , 16 ) ; } } write_regs ( fd , cmds2 , NUM_REGS_CMD2 ) ; }
| <vul-start> ( TOSHH2C_DEFAULT_EDID [ ( <vul-start> i + j ) <vul-start> ( TOSHH2C_DEFAULT_EDID [ ( <vul-start> i + j )
|
56 | CWE-000 void resize ( Client * c , int x , int y , int w , int h , Bool interact ) { int halfgap = windowgap / 2 ; <vul-start> int nc = 0 ; <vul-end> Client * cother ; Client * first = NULL ; <vul-start> Bool changed = False ; <vul-end> <vul-start> for ( cother = c -> mon -> clients ; cother ; cother = cother -> next ) <vul-end> if ( ISVISIBLE ( cother ) && ! cother -> nofocus ) { if ( first == NULL ) { first = cother ; if ( first -> bw != 0 ) { changed = True ; first -> bw = 0 ; } } else { if ( ! first -> noborder ) { if ( changed ) changed = False ; first -> bw = borderpx ; } if ( ! cother -> noborder && cother -> bw != borderpx ) { cother -> bw = borderpx ; changed = True ; } } ++ nc ; } if ( nc > 1 ) { x += halfgap ; y += halfgap ; w -= windowgap ; h -= windowgap ; } if ( changed ) arrange ( c -> mon ) ; else <vul-start> resize_nogap ( c , x , y , w , h , interact ) ; <vul-end> }
| <vul-start> ; int nc <vul-end> ; Bool changed <vul-start> Bool changed = updateborderwidth ( <vul-end> c -> mon <vul-start> c -> mon , & nc ) ; <vul-end> if ( nc <vul-start> ) ; else if ( applysizehints ( c , & x , & y , & w , & h , interact ) ) resizeclient <vul-end> ( c , <vul-start> w , h <vul-end> ) ; }
|
57 | CWE-000 static void test_getPathGradientPresetBlend ( ) { GpStatus status ; GpPathGradient * brush ; <vul-start> ARGB blend [ 1 ] ; <vul-end> <vul-start> REAL positions [ 1 ] ; <vul-end> <vul-start> GdipCreatePathGradient ( threePoints , 3 , WrapModeTileFlipX , & brush ) ; <vul-end> status = GdipGetPathGradientPresetBlend ( NULL , blend , positions , 1 ) ; assertEqualInt ( status , InvalidParameter ) ; status = GdipGetPathGradientPresetBlend ( brush , NULL , positions , 1 ) ; assertEqualInt ( status , InvalidParameter ) ; status = GdipGetPathGradientPresetBlend ( brush , blend , NULL , 1 ) ; assertEqualInt ( status , InvalidParameter ) ; status = GdipGetPathGradientPresetBlend ( brush , blend , positions , 1 ) ; assertEqualInt ( status , InvalidParameter ) ; status = GdipGetPathGradientPresetBlend ( brush , blend , positions , 0 ) ; assertEqualInt ( status , InvalidParameter ) ; status = GdipGetPathGradientPresetBlend ( brush , blend , positions , - 1 ) ; assertEqualInt ( status , OutOfMemory ) ; status = GdipGetPathGradientPresetBlend ( NULL , blend , positions , - 1 ) ; assertEqualInt ( status , InvalidParameter ) ; status = GdipGetPathGradientPresetBlend ( brush , NULL , positions , - 1 ) ; assertEqualInt ( status , InvalidParameter ) ; status = GdipGetPathGradientPresetBlend ( brush , blend , NULL , - 1 ) ; assertEqualInt ( status , OutOfMemory ) ; GdipDeleteBrush ( ( GpBrush * ) brush ) ; }
| <vul-start> ARGB blend [ 2 <vul-end> ] ; REAL <vul-start> REAL positions [ 2 <vul-end> ] ; GdipCreatePathGradient <vul-start> , & brush ) ; status = GdipGetPathGradientPresetBlend ( brush , blend , positions , 2 ) ; assertEqualInt ( status , GenericError
|
58 | CWE-000 static int ext4_tmpfile ( struct inode * dir , struct dentry * dentry , umode_t mode ) { handle_t * handle ; struct inode * inode ; int err , retries = 0 ; dquot_initialize ( dir ) ; retry : handle = ext4_journal_start ( dir , EXT4_MAXQUOTAS_INIT_BLOCKS ( dir -> i_sb ) + 4 + EXT4_XATTR_TRANS_BLOCKS ) ; if ( IS_ERR ( handle ) ) return PTR_ERR ( handle ) ; if ( IS_DIRSYNC ( dir ) ) ext4_handle_sync ( handle ) ; inode = ext4_new_inode ( handle , dir , mode , NULL , 0 , NULL ) ; err = PTR_ERR ( inode ) ; if ( ! IS_ERR ( inode ) ) { inode -> i_op = & ext4_file_inode_operations ; inode -> i_fop = & ext4_file_operations ; ext4_set_aops ( inode ) ; <vul-start> err = ext4_orphan_add ( handle , inode ) ; <vul-end> if ( err ) goto err_drop_inode ; <vul-start> mark_inode_dirty ( inode ) ; <vul-end> d_tmpfile ( dentry , inode ) ; unlock_new_inode ( inode ) ; } if ( handle ) ext4_journal_stop ( handle ) ; if ( err == - ENOSPC && ext4_should_retry_alloc ( dir -> i_sb , & retries ) ) goto retry ; return err ; err_drop_inode : ext4_journal_stop ( handle ) ; unlock_new_inode ( inode ) ; iput ( inode ) ; return err ; }
| <vul-start> inode ) ; d_tmpfile ( dentry , inode ) ; <vul-start> ; mark_inode_dirty ( <vul-end> inode ) ;
|
59 | CWE-000 int comp_regex ( char * string , char * reg ) { regex_t regex ; int err_reg = 0 ; err_reg = regcomp ( & regex , reg , REG_NOSUB | REG_EXTENDED | REG_NEWLINE ) ; if ( err_reg ) { err ( 1 , "Error initialising function regex" ) ; } err_reg = regexec ( & regex , string , 0 , NULL , 0 ) ; <vul-start> if ( ! err_reg ) <vul-end> return 1 ; else if ( err_reg == REG_NOMATCH ) return 0 ; else err ( 1 , "Error executing function regex" ) ; }
| <vul-start> 0 ) ; regfree ( & regex ) ;
|
60 | CWE-000 static void prv_launch_exit_data_write ( DictionaryIterator * out ) { s_curr_time = time ( NULL ) ; <vul-start> dict_write_int ( out , AppKeyLaunchReason , & e_launch_reason , sizeof ( int ) , true ) ; <vul-end> <vul-start> dict_write_int ( out , AppKeyLaunchTime , & e_launch_time , sizeof ( int ) , true ) ; <vul-end> dict_write_int ( out , AppKeyExitReason , & e_exit_reason , sizeof ( int ) , true ) ; <vul-start> dict_write_int ( out , AppKeyExitTime , & s_exit_time , sizeof ( int ) , true ) ; <vul-end> <vul-start> dict_write_int ( out , AppKeyDate , & s_curr_time , sizeof ( int ) , true ) ; <vul-end> }
| <vul-start> ( out , AppKeyDate , & s_curr_time <vul-end> , sizeof ( <vul-start> AppKeyLaunchTime , & s_t_launch <vul-end> , sizeof ( <vul-start> AppKeyExitTime , & s_t_exit <vul-end> , sizeof ( <vul-start> true ) ; dict_write_uint8 <vul-end> ( out , <vul-start> ( out , AppKeyLaunchReason , s_lr ) ; dict_write_uint8 ( out , AppKeyExitReason , s_er ) ; dict_write_cstring ( out , AppKeyRandomMessage , s_msg_id <vul-end> ) ; }
|
61 | CWE-000 void nfc_ncif_proc_deactivate ( UINT8 status , UINT8 deact_type , BOOLEAN is_ntf ) { tNFC_DISCOVER evt_data ; tNFC_DEACTIVATE_DEVT * p_deact ; tNFC_CONN_CB * p_cb = & nfc_cb . conn_cb [ NFC_RF_CONN_ID ] ; void * p_data ; nfc_set_state ( NFC_STATE_IDLE ) ; p_deact = & evt_data . deactivate ; p_deact -> status = status ; p_deact -> type = deact_type ; p_deact -> is_ntf = is_ntf ; while ( ( p_data = GKI_dequeue ( & p_cb -> rx_q ) ) != NULL ) { GKI_freebuf ( p_data ) ; } while ( ( p_data = GKI_dequeue ( & p_cb -> tx_q ) ) != NULL ) { GKI_freebuf ( p_data ) ; } if ( p_cb -> p_cback ) ( * p_cb -> p_cback ) ( NFC_RF_CONN_ID , NFC_DEACTIVATE_CEVT , ( tNFC_CONN * ) p_deact ) ; <vul-start> if ( nfc_cb . p_discv_cback ) <vul-end> { ( * nfc_cb . p_discv_cback ) ( NFC_DEACTIVATE_DEVT , & evt_data ) ; } }
| <vul-start> ; if ( ( nfc_cb . flags & ( NFC_FL_DISCOVER_PENDING | NFC_FL_CONTROL_REQUESTED ) ) && ( deact_type == NFC_DEACTIVATE_TYPE_DISCOVERY ) && ( is_ntf == TRUE ) ) { NFC_TRACE_DEBUG0 ( "Abnormal State, Deactivate NTF is ignored, MW is already going to Discovery state" ) ; return ; } if (
|
62 | CWE-000 static int isert_connect_request ( struct rdma_cm_id * cma_id , struct rdma_cm_event * event ) { struct iscsi_np * np = cma_id -> context ; struct isert_np * isert_np = np -> np_context ; struct isert_conn * isert_conn ; struct isert_device * device ; struct ib_device * ib_dev = cma_id -> device ; int ret = 0 ; pr_debug ( "Entering isert_connect_request cma_id: %p, context: %p\\n" , cma_id , cma_id -> context ) ; isert_conn = kzalloc ( sizeof ( struct isert_conn ) , GFP_KERNEL ) ; if ( ! isert_conn ) { pr_err ( "Unable to allocate isert_conn\\n" ) ; return - ENOMEM ; } isert_conn -> state = ISER_CONN_INIT ; INIT_LIST_HEAD ( & isert_conn -> conn_accept_node ) ; init_completion ( & isert_conn -> conn_login_comp ) ; <vul-start> init_waitqueue_head ( & isert_conn -> conn_wait ) ; <vul-end> <vul-start> init_waitqueue_head ( & isert_conn -> conn_wait_comp_err ) ; <vul-end> kref_init ( & isert_conn -> conn_kref ) ; kref_get ( & isert_conn -> conn_kref ) ; mutex_init ( & isert_conn -> conn_mutex ) ; cma_id -> context = isert_conn ; isert_conn -> conn_cm_id = cma_id ; isert_conn -> responder_resources = event -> param . conn . responder_resources ; isert_conn -> initiator_depth = event -> param . conn . initiator_depth ; pr_debug ( "Using responder_resources: %u initiator_depth: %u\\n" , isert_conn -> responder_resources , isert_conn -> initiator_depth ) ; isert_conn -> login_buf = kzalloc ( ISCSI_DEF_MAX_RECV_SEG_LEN + ISER_RX_LOGIN_SIZE , GFP_KERNEL ) ; if ( ! isert_conn -> login_buf ) { pr_err ( "Unable to allocate isert_conn->login_buf\\n" ) ; ret = - ENOMEM ; goto out ; } isert_conn -> login_req_buf = isert_conn -> login_buf ; isert_conn -> login_rsp_buf = isert_conn -> login_buf + ISCSI_DEF_MAX_RECV_SEG_LEN ; pr_debug ( "Set login_buf: %p login_req_buf: %p login_rsp_buf: %p\\n" , isert_conn -> login_buf , isert_conn -> login_req_buf , isert_conn -> login_rsp_buf ) ; isert_conn -> login_req_dma = ib_dma_map_single ( ib_dev , ( void * ) isert_conn -> login_req_buf , ISCSI_DEF_MAX_RECV_SEG_LEN , DMA_FROM_DEVICE ) ; ret = ib_dma_mapping_error ( ib_dev , isert_conn -> login_req_dma ) ; if ( ret ) { pr_err ( "ib_dma_mapping_error failed for login_req_dma: %d\\n" , ret ) ; isert_conn -> login_req_dma = 0 ; goto out_login_buf ; } isert_conn -> login_rsp_dma = ib_dma_map_single ( ib_dev , ( void * ) isert_conn -> login_rsp_buf , ISER_RX_LOGIN_SIZE , DMA_TO_DEVICE ) ; ret = ib_dma_mapping_error ( ib_dev , isert_conn -> login_rsp_dma ) ; if ( ret ) { pr_err ( "ib_dma_mapping_error failed for login_rsp_dma: %d\\n" , ret ) ; isert_conn -> login_rsp_dma = 0 ; goto out_req_dma_map ; } device = isert_device_find_by_ib_dev ( cma_id ) ; if ( IS_ERR ( device ) ) { ret = PTR_ERR ( device ) ; goto out_rsp_dma_map ; } isert_conn -> conn_device = device ; isert_conn -> conn_pd = device -> dev_pd ; isert_conn -> conn_mr = device -> dev_mr ; ret = isert_conn_setup_qp ( isert_conn , cma_id ) ; if ( ret ) goto out_conn_dev ; mutex_lock ( & isert_np -> np_accept_mutex ) ; list_add_tail ( & isert_np -> np_accept_list , & isert_conn -> conn_accept_node ) ; mutex_unlock ( & isert_np -> np_accept_mutex ) ; pr_debug ( "isert_connect_request() waking up np_accept_wq: %p\\n" , np ) ; wake_up ( & isert_np -> np_accept_wq ) ; return 0 ; out_conn_dev : isert_device_try_release ( device ) ; out_rsp_dma_map : ib_dma_unmap_single ( ib_dev , isert_conn -> login_rsp_dma , ISER_RX_LOGIN_SIZE , DMA_TO_DEVICE ) ; out_req_dma_map : ib_dma_unmap_single ( ib_dev , isert_conn -> login_req_dma , ISCSI_DEF_MAX_RECV_SEG_LEN , DMA_FROM_DEVICE ) ; out_login_buf : kfree ( isert_conn -> login_buf ) ; out : kfree ( isert_conn ) ; return ret ; }
| <vul-start> conn_login_comp ) ; init_completion <vul-end> ( & isert_conn <vul-start> conn_wait ) ; init_completion <vul-end> ( & isert_conn
|
63 | CWE-000 static inline gint process_one_element_last_access ( cache_line * cp , GHashTable * hash_table , guint64 ts ) { gpointer gp ; gp = g_hash_table_lookup ( hash_table , cp -> item ) ; gint ret ; if ( gp == NULL ) { ret = - 1 ; guint64 * value = g_new ( guint64 , 1 ) ; * value = ts ; if ( cp -> type == 'c' ) g_hash_table_insert ( hash_table , g_strdup ( ( gchar * ) ( cp -> item_p ) ) , ( gpointer ) value ) ; else if ( cp -> type == 'l' ) { guint64 * key = g_new ( guint64 , 1 ) ; * key = * ( guint64 * ) ( cp -> item_p ) ; g_hash_table_insert ( hash_table , ( gpointer ) ( key ) , ( gpointer ) value ) ; } else { printf ( "unknown cache line content type: %c\\n" , cp -> type ) ; exit ( 1 ) ; } } else { guint64 old_ts = * ( guint64 * ) gp ; ret = ( gint ) ( ts - old_ts ) ; <vul-start> * ( guint64 * ) gp = cp -> ts ; <vul-end> } return ret ; }
| <vul-start> ) gp = <vul-end> ts ; }
|
64 | CWE-000 int main ( int argc , char * argv [ ] ) { int i , flag = 0 ; if ( argc < 2 ) { printf ( 2 , "Usage: rm files...\\n" ) ; exit ( ) ; } for ( i = 1 ; i < argc ; i ++ ) { flag = unlink ( argv [ i ] ) ; if ( flag < 0 ) { if ( flag == - 2 ) <vul-start> printf ( 2 , "rm: premission deny\\n" ) ; <vul-end> else if ( flag != - 2 ) printf ( 2 , "rm: %s failed to delete\\n" , argv [ i ] ) ; break ; } else printf ( 2 , "rm sucess\\n" ) ; } exit ( ) ; }
| <vul-start> ( 2 , "rm: permission deny\\n" <vul-end> ) ; else
|
65 | CWE-000 static void init ( ) { <vul-start> unhook ++ ; <vul-end> <vul-start> libc . malloc = dlsym ( RTLD_NEXT , "malloc" ) ; <vul-end> <vul-start> libc . calloc = dlsym ( RTLD_NEXT , "calloc" ) ; <vul-end> <vul-start> libc . realloc = dlsym ( RTLD_NEXT , "realloc" ) ; <vul-end> <vul-start> libc . memalign = dlsym ( RTLD_NEXT , "memalign" ) ; <vul-end> <vul-start> libc . free = dlsym ( RTLD_NEXT , "free" ) ; <vul-end> unhook -- ; if ( ! libc . malloc || ! libc . realloc || ! libc . free || ! libc . calloc || ! libc . memalign ) fail ( "%s: dyld error: %s\\n" , __FUNCTION__ , dlerror ( ) ) ; <vul-start> atexit ( memstat_atexit ) ; <vul-end> mjfilter_add ( & memlimit ) ; mjtrace_add ( & memstat ) ; <vul-start> } <vul-end>
| <vul-start> ( ) { void * handle ; if ( unhook ) return ; unhook ++ ; handle = dlopen ( LIBC_SO , RTLD_NOW ) <vul-end> ; libc . <vul-start> = dlsym ( handle <vul-end> , "malloc" ) <vul-start> = dlsym ( handle <vul-end> , "calloc" ) <vul-start> = dlsym ( handle <vul-end> , "realloc" ) <vul-start> = dlsym ( handle <vul-end> , "memalign" ) <vul-start> = dlsym ( handle , "free" ) ; dlclose ( handle <vul-end> ) ; unhook <vul-start> ) ) ; <vul-end> mjfilter_add ( & <vul-start> memstat ) ; atexit ( memstat_atexit ) ;
|
66 | CWE-000 void games_expose_bots ( MFD * m , uchar control ) { bots_state * bs = ( bots_state * ) GAME_DATA ; uiEvent fake_event ; int i , j ; # ifdef SVGA_SUPPORT extern char convert_use_mode ; # endif for ( ; games_time_diff >= PONG_CYCLE ; games_time_diff -= PONG_CYCLE ) { games_run_bots ( bs ) ; ui_mouse_get_xy ( & fake_event . pos . x , & fake_event . pos . y ) ; games_handle_pong ( m , & fake_event ) ; } if ( ! full_game_3d ) <vul-start> draw_hires_resource_bm ( REF_IMG_bmBlankMFD , 0 , 0 ) ; <vul-end> for ( j = 0 ; j < BOTS_NUM_ROWS ; ++ j ) { gr_set_fcolor ( WHITE ) ; for ( i = 0 ; i < BOTS_NUM_COLUMNS ; ++ i ) { if ( bs -> rows [ j ] & ( 1 << i ) ) { # ifdef SVGA_SUPPORT draw_res_bm_core ( invader [ j ] + INVADER_TYPES * convert_use_mode , HPOS + BOT_WIDTH * i , BOT_HEIGHT * j + BOT_TOP - ( j == 1 ) , FALSE ) ; # else draw_res_bm ( invader [ j ] , HPOS + BOT_WIDTH * i , BOT_HEIGHT * j + BOT_TOP - ( j == 1 ) ) ; # endif } } } gr_set_fcolor ( ORANGE_YELLOW_BASE ) ; ss_rect ( bs -> p_pos - PLY_PADDLE_XRAD , MFD_VIEW_HGT - PONG_BORDER - PLY_PADDLE_YRAD * 2 , bs -> p_pos + PLY_PADDLE_XRAD , MFD_VIEW_HGT - PONG_BORDER ) ; gr_set_fcolor ( GRAY_8_BASE ) ; ss_rect ( bs -> ball_pos_x - PONG_BALL_XRAD , bs -> ball_pos_y - PONG_BALL_YRAD , bs -> ball_pos_x + PONG_BALL_XRAD , bs -> ball_pos_y + PONG_BALL_YRAD ) ; mfd_add_rect ( 0 , 0 , MFD_VIEW_WID , MFD_VIEW_HGT ) ; mfd_notify_func ( MFD_GAMES_FUNC , MFD_INFO_SLOT , FALSE , MFD_ACTIVE , FALSE ) ; return ; }
| <vul-start> ! full_game_3d ) draw_res_bm <vul-end> ( REF_IMG_bmBlankMFD ,
|
67 | CWE-000 static inline int __mr_cache_entry_put ( gnix_mr_cache_t * cache , gnix_mr_cache_entry_t * entry ) { RbtIterator iter ; int rc ; gni_return_t grc = GNI_RC_SUCCESS ; RbtIterator found ; gnix_mr_cache_entry_t * parent = NULL ; struct dlist_entry * next ; GNIX_TRACE ( FI_LOG_MR , "\\n" ) ; if ( cache -> attr . lazy_deregistration ) { __clear_notifier_events ( cache ) ; } <vul-start> if ( ofi_atomic_dec32 ( & entry -> ref_cnt ) == 0 ) { <vul-end> next = entry -> siblings . next ; dlist_remove ( & entry -> children ) ; dlist_remove ( & entry -> siblings ) ; if ( next != & entry -> siblings && dlist_empty ( next ) ) { parent = container_of ( next , gnix_mr_cache_entry_t , children ) ; grc = __mr_cache_entry_put ( cache , parent ) ; if ( OFI_UNLIKELY ( grc != GNI_RC_SUCCESS ) ) { GNIX_ERR ( FI_LOG_MR , "failed to release reference to parent, " "parent=%p refs=%d\\n" , parent , ofi_atomic_get32 ( & parent -> ref_cnt ) ) ; } } ofi_atomic_dec32 ( & cache -> inuse . elements ) ; if ( ! __entry_is_retired ( entry ) ) { iter = rbtFind ( cache -> inuse . rb_tree , & entry -> key ) ; if ( OFI_UNLIKELY ( ! iter ) ) { GNIX_ERR ( FI_LOG_MR , "failed to find entry in the inuse cache\\n" ) ; } else { rc = rbtErase ( cache -> inuse . rb_tree , iter ) ; if ( OFI_UNLIKELY ( rc != RBT_STATUS_OK ) ) { GNIX_ERR ( FI_LOG_MR , "failed to erase lru entry" " from stale tree\\n" ) ; } } } if ( cache -> attr . lazy_deregistration && ! ( __entry_is_retired ( entry ) ) ) { GNIX_DEBUG ( FI_LOG_MR , "moving key %llx:%llx to stale\\n" , entry -> key . address , entry -> key . length ) ; found = rbtFindLeftmost ( cache -> stale . rb_tree , & entry -> key , __find_overlapping_addr ) ; if ( found ) { __resolve_stale_entry_collision ( cache , found , entry ) ; } else { grc = __insert_entry_into_stale ( cache , entry ) ; } } else { GNIX_DEBUG ( FI_LOG_MR , "destroying entry, key=%llx:%llx\\n" , entry -> key . address , entry -> key . length ) ; grc = __mr_cache_entry_destroy ( cache , entry ) ; } if ( OFI_UNLIKELY ( grc != GNI_RC_SUCCESS ) ) { GNIX_INFO ( FI_LOG_MR , "dereg callback returned \'%s\'\\n" , gni_err_str [ grc ] ) ; } } return grc ; }
| <vul-start> ) ; } GNIX_DEBUG ( FI_LOG_MR , "Decrease ref cnt on entry %p\\n" , entry ) ;
|
68 | CWE-000 static void zdb_leak_init ( spa_t * spa , zdb_cb_t * zcb ) { zcb -> zcb_spa = spa ; uint64_t c , m ; if ( ! dump_opt [ 'L' ] ) { vdev_t * rvd = spa -> spa_root_vdev ; spa -> spa_normal_class -> mc_ops = & zdb_metaslab_ops ; spa -> spa_log_class -> mc_ops = & zdb_metaslab_ops ; for ( c = 0 ; c < rvd -> vdev_children ; c ++ ) { vdev_t * vd = rvd -> vdev_child [ c ] ; ASSERTV ( metaslab_group_t * mg = vd -> vdev_mg ) ; for ( m = 0 ; m < vd -> vdev_ms_count ; m ++ ) { metaslab_t * msp = vd -> vdev_ms [ m ] ; <vul-start> ASSERT3P ( msp -> ms_group , == , mg ) ; <vul-end> mutex_enter ( & msp -> ms_lock ) ; metaslab_unload ( msp ) ; if ( msp -> ms_sm != NULL ) { ( void ) fprintf ( stderr , "\\rloading space map for " "vdev %llu of %llu, " "metaslab %llu of %llu ..." , ( longlong_t ) c , ( longlong_t ) rvd -> vdev_children , ( longlong_t ) m , ( longlong_t ) vd -> vdev_ms_count ) ; msp -> ms_tree -> rt_ops = NULL ; VERIFY0 ( space_map_load ( msp -> ms_sm , msp -> ms_tree , SM_ALLOC ) ) ; if ( ! msp -> ms_loaded ) msp -> ms_loaded = B_TRUE ; } mutex_exit ( & msp -> ms_lock ) ; } } ( void ) fprintf ( stderr , "\\n" ) ; } spa_config_enter ( spa , SCL_CONFIG , FTAG , RW_READER ) ; zdb_ddt_leak_init ( spa , zcb ) ; spa_config_exit ( spa , SCL_CONFIG , FTAG ) ; }
| <vul-start> m ] ; ASSERT <vul-end> ( msp -> <vul-start> msp -> ms_group == mg || vd -> vdev_alloc_bias == VDEV_BIAS_SEGREGATE <vul-end> ) ; mutex_enter
|
69 | CWE-000 Scheme_Object * optimize_for_inline ( Optimize_Info * info , Scheme_Object * le , int argc , Scheme_App_Rec * app , Scheme_App2_Rec * app2 , Scheme_App3_Rec * app3 , int context , int optimized_rator ) { int single_use = 0 , psize = 0 ; <vul-start> Scheme_Object * prev = NULL , * orig_le = le , * le2 ; <vul-end> int already_opt = optimized_rator ; if ( ( info -> inline_fuel < 0 ) && info -> has_nonleaf ) return NULL ; if ( already_opt ) extract_tail_inside ( & le , & prev ) ; le = extract_specialized_proc ( le , le ) ; if ( ! already_opt && SCHEME_LAMBDAP ( le ) ) { return NULL ; } le2 = le ; <vul-start> le = do_lookup_constant_proc ( info , le , argc , 1 , 0 , & single_use ) ; <vul-end> if ( ! le ) { info -> has_nonleaf = 1 ; return NULL ; } if ( SCHEME_WILL_BE_LAMBDAP ( le ) ) { psize = SCHEME_WILL_BE_LAMBDA_SIZE ( le ) ; LOG_INLINE ( fprintf ( stderr , "Potential inline %d %d\\n" , psize , info -> inline_fuel * ( argc + 2 ) ) ) ; if ( psize <= ( info -> inline_fuel * ( argc + 2 ) ) ) info -> psize += psize ; info -> has_nonleaf = 1 ; return NULL ; } if ( SAME_OBJ ( le , scheme_true ) ) { int len ; const char * pname = NULL , * context ; info -> escapes = 1 ; <vul-start> le2 = do_lookup_constant_proc ( info , le2 , argc , 1 , 1 , & single_use ) ; <vul-end> if ( ! SAME_TYPE ( SCHEME_TYPE ( le2 ) , scheme_struct_proc_shape_type ) && ! SAME_TYPE ( SCHEME_TYPE ( le2 ) , scheme_struct_prop_proc_shape_type ) ) { pname = scheme_get_proc_name ( le2 , & len , 0 ) ; } context = scheme_optimize_context_to_string ( info -> context ) ; scheme_log ( info -> logger , SCHEME_LOG_WARNING , 0 , "warning%s: optimizer detects procedure incorrectly applied to %d arguments%s%s" , context , argc , pname ? ": " : "" , pname ? pname : "" ) ; return NULL ; } if ( SAME_TYPE ( SCHEME_TYPE ( le ) , scheme_ir_lambda_type ) && ( info -> inline_fuel >= 0 ) ) { Scheme_Lambda * lam = ( Scheme_Lambda * ) le ; int sz , threshold , is_leaf = 0 ; sz = lambda_body_size_plus_info ( lam , 1 , info , & is_leaf ) ; if ( is_leaf ) { sz >>= 2 ; } threshold = info -> inline_fuel * ( 2 + argc ) ; if ( ( sz >= 0 ) && ( single_use || ( sz <= threshold ) ) ) { Optimize_Info * sub_info ; sub_info = info ; le = optimize_clone ( single_use , ( Scheme_Object * ) lam , sub_info , empty_eq_hash_tree , 0 ) ; if ( le ) { LOG_INLINE ( fprintf ( stderr , "Inline %d[%d]<=%d@%d %d %s\\n" , sz , is_leaf , threshold , info -> inline_fuel , single_use , scheme_write_to_string ( lam -> name ? lam -> name : scheme_false , NULL ) ) ) ; if ( scheme_log_level_p ( info -> logger , SCHEME_LOG_DEBUG ) ) scheme_log ( info -> logger , SCHEME_LOG_DEBUG , 0 , "inlining %s size: %d threshold: %d#<separator>%s" , scheme_write_to_string ( lam -> name ? lam -> name : scheme_false , NULL ) , sz , threshold , scheme_optimize_context_to_string ( info -> context ) ) ; <vul-start> le = apply_inlined ( ( Scheme_Lambda * ) le , sub_info , argc , app , app2 , app3 , context , <vul-end> orig_le , prev , single_use ) ; return le ; } else { LOG_INLINE ( fprintf ( stderr , "No inline %s\\n" , scheme_write_to_string ( lam -> name ? lam -> name : scheme_false , NULL ) ) ) ; if ( scheme_log_level_p ( info -> logger , SCHEME_LOG_DEBUG ) ) scheme_log ( info -> logger , SCHEME_LOG_DEBUG , 0 , "no-inlining %s size: %d threshold: %d#<separator>%s" , scheme_write_to_string ( lam -> name ? lam -> name : scheme_false , NULL ) , sz , threshold , scheme_optimize_context_to_string ( info -> context ) ) ; } } else { LOG_INLINE ( fprintf ( stderr , "No fuel %s %d[%d]>%d@%d %d\\n" , scheme_write_to_string ( lam -> name ? lam -> name : scheme_false , NULL ) , sz , is_leaf , threshold , info -> inline_fuel , info -> use_psize ) ) ; if ( scheme_log_level_p ( info -> logger , SCHEME_LOG_DEBUG ) ) scheme_log ( info -> logger , SCHEME_LOG_DEBUG , 0 , "out-of-fuel %s size: %d threshold: %d#<separator>%s" , scheme_write_to_string ( lam -> name ? lam -> name : scheme_false , NULL ) , sz , threshold , scheme_optimize_context_to_string ( info -> context ) ) ; } } if ( ! scheme_check_leaf_rator ( le ) ) info -> has_nonleaf = 1 ; return NULL ; }
| <vul-start> , * le2 , * single_use_var = NULL <vul-start> , & single_use , & single_use_var <vul-start> , & single_use , & single_use_var <vul-start> ) ) ; if ( single_use_var ) SCHEME_VAR ( single_use_var ) -> optimize_used = 0 ;
|
70 | CWE-000 void initGame ( XStuff * xs , GameState * gs ) { int ww , wh ; srand ( ( unsigned int ) time ( NULL ) ) ; json_gl_init_lookup ( ) ; glerr ( "left over error on game init" ) ; # ifndef DISABLE_SOUND gs -> sound = SoundManager_alloc ( ) ; SoundManager_readConfigFile ( gs -> sound , "assets/config/sound.json" ) ; SoundManager_start ( gs -> sound ) ; # endif struct { char * name ; size_t size ; } defaultComponents [ ] = { { "meshIndex" , sizeof ( uint16_t ) } , { "position" , sizeof ( Vector ) } , { "rotation" , sizeof ( C_Rotation ) } , { "mapHeightUpdate" , sizeof ( uint8_t ) } , { "angularVelocity" , sizeof ( float ) } , { "pathFollow" , sizeof ( C_PathFollow ) } , { 0 , 0 } , } ; CES_init ( & gs -> ces ) ; for ( int i = 0 ; defaultComponents [ i ] . name != NULL ; i ++ ) { CES_addComponentManager ( & gs -> ces , ComponentManager_alloc ( defaultComponents [ i ] . name , defaultComponents [ i ] . size , 1024 * 8 , 1 ) ) ; } json_file_t * j_ces_conf = json_load_path ( "assets/config/CES.json" ) ; ComponentManager_loadConfig ( & gs -> ces , j_ces_conf -> root ) ; json_free ( j_ces_conf -> root ) ; free ( j_ces_conf ) ; waterProg = loadCombinedProgram ( "mg_water" ) ; erodeProg = loadCombinedProgram ( "mg_erode" ) ; soilProg = loadCombinedProgram ( "mg_soil" ) ; gs -> hasMoved = 1 ; gs -> lastSelectionFrame = 0 ; gs -> frameCount = 0 ; gs -> activeTool = 0 ; gs -> debugMode = 0 ; gs -> sunSpeed = 0 ; gs -> sunTheta = 2.2 ; gs -> nearClipPlane = .5 ; gs -> farClipPlane = 1700 ; ww = xs -> winAttr . width ; wh = xs -> winAttr . height ; gs -> screen . wh . x = ( float ) ww ; gs -> screen . wh . y = ( float ) wh ; gs -> screen . aspect = gs -> screen . wh . x / gs -> screen . wh . y ; gs -> screen . resized = 0 ; gs -> defaultInputHandlers = calloc ( 1 , sizeof ( * gs -> defaultInputHandlers ) ) ; gs -> defaultInputHandlers -> dragStop = main_drag_handler ; gs -> defaultInputHandlers -> keyUp = main_key_handler ; gs -> defaultInputHandlers -> perFrame = main_perframe_handler ; gs -> defaultInputHandlers -> click = main_click_handler ; InputFocusStack_PushTarget ( & gs -> ifs , gs , defaultInputHandlers ) ; initUniformBuffers ( ) ; uniformBuffer_init ( & gs -> perViewUB , sizeof ( PerViewUniforms ) ) ; uniformBuffer_init ( & gs -> perFrameUB , sizeof ( PerFrameUniforms ) ) ; initRenderLoop ( gs ) ; initRenderPipeline ( ) ; MatrixStack * view , * proj ; view = & gs -> view ; proj = & gs -> proj ; msAlloc ( 2 , view ) ; msAlloc ( 2 , proj ) ; msIdent ( view ) ; msIdent ( proj ) ; gs -> zoom = - 600.0 ; gs -> direction = 0.0f ; gs -> lookCenter . x = 128 ; gs -> lookCenter . y = 128 ; initTextures ( ) ; initStaticMeshes ( ) ; initDynamicMeshes ( ) ; initLighting ( ) ; initWaterPlane ( ) ; initDecals ( ) ; initCustomDecals ( ) ; Scene_init ( & gs -> scene ) ; gui_Init ( ) ; gt = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.01 } , 4.0f , "Arial" ) ; gt_terrain = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.04 } , 3.0f , "Arial" ) ; gt_solids = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.06 } , 3.0f , "Arial" ) ; gt_selection = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.28 } , 3.0f , "Arial" ) ; gt_decals = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.08 } , 3.0f , "Arial" ) ; gt_emitters = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.10 } , 3.0f , "Arial" ) ; gt_effects = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.10 } , 3.0f , "Arial" ) ; gt_lighting = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.12 } , 3.0f , "Arial" ) ; <vul-start> gt_shading = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.14 } , 3.0f , "Arial" ) ; <vul-end> gt_gui = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.16 } , 3.0f , "Arial" ) ; gtRenderMode = guiTextNew ( "" , ( Vector2 ) { 0.1 , 0.9 } , 6.0f , "Arial" ) ; gtSelectionDisabled = guiTextNew ( "" , ( Vector2 ) { 0.5 , 0.1 } , 6.0f , "Arial" ) ; gswTest = guiSimpleWindowNew ( ( Vector2 ) { .2 , .2 } , ( Vector2 ) { .7 , .7 } , 0 ) ; gclTest = guiColumnLayoutNew ( ( Vector2 ) { .01 , .01 } , .02 , 0 ) ; guiRegisterObject ( gclTest , NULL ) ; guiRegisterObject ( gt_terrain , gclTest ) ; guiRegisterObject ( gt_solids , gclTest ) ; guiRegisterObject ( gt_decals , gclTest ) ; <vul-start> guiRegisterObject ( gt_emitters , gclTest ) ; <vul-end> <vul-start> guiRegisterObject ( gt_effects , gclTest ) ; <vul-end> <vul-start> guiRegisterObject ( gt_lighting , gclTest ) ; <vul-end> guiRegisterObject ( gt_shading , gclTest ) ; guiRegisterObject ( gt_gui , gclTest ) ; guiRegisterObject ( gtRenderMode , NULL ) ; guiRegisterObject ( gtSelectionDisabled , NULL ) ; gs -> world = calloc ( 1 , sizeof ( * gs -> world ) ) ; gs -> world -> gs = gs ; World_init ( gs -> world ) ; }
| <vul-start> "Arial" ) ; gt_sunShadow = guiTextNew ( "gui!" , ( Vector2 ) { 0.010 , 0.14 } , 3.0f , "Arial" ) ; <vul-start> ; guiRegisterObject ( gt_effects <vul-end> , gclTest ) <vul-start> ; guiRegisterObject ( gt_lighting <vul-end> , gclTest ) <vul-start> ; guiRegisterObject ( gt_sunShadow <vul-end> , gclTest )
|
71 | CWE-000 int32_t mz_zip_time_t_to_tm ( time_t unix_time , struct tm * ptm ) { struct tm * ltm = NULL ; if ( ptm == NULL ) return MZ_PARAM_ERROR ; ltm = localtime ( & unix_time ) ; if ( ltm == NULL ) <vul-start> return MZ_INTERNAL_ERROR ; <vul-end> memcpy ( ptm , ltm , sizeof ( struct tm ) ) ; return MZ_OK ; }
| <vul-start> == NULL ) { memset ( ptm , 0 , sizeof ( struct tm ) ) ; <vul-start> return MZ_INTERNAL_ERROR ; }
|
72 | CWE-000 int xbf_init ( struct xbf_softc * sc ) { unsigned long long res ; const char * action , * prop ; char pbuf [ sizeof ( "ring-refXX" ) ] ; int i , error ; prop = "max-ring-page-order" ; error = xs_getnum ( sc -> sc_parent , sc -> sc_backend , prop , & res ) ; if ( error == 0 ) sc -> sc_xr_size = 1 << res ; if ( error == ENOENT ) { prop = "max-ring-pages" ; error = xs_getnum ( sc -> sc_parent , sc -> sc_backend , prop , & res ) ; if ( error == 0 ) sc -> sc_xr_size = res ; } if ( error ) sc -> sc_xr_size = XBF_MIN_RING_SIZE ; if ( sc -> sc_xr_size < XBF_MIN_RING_SIZE ) sc -> sc_xr_size = XBF_MIN_RING_SIZE ; if ( sc -> sc_xr_size > XBF_MAX_RING_SIZE ) sc -> sc_xr_size = XBF_MAX_RING_SIZE ; if ( ! powerof2 ( sc -> sc_xr_size ) ) sc -> sc_xr_size = 1 << ( fls ( sc -> sc_xr_size ) - 1 ) ; sc -> sc_xr_ndesc = ( ( sc -> sc_xr_size * PAGE_SIZE ) - sizeof ( struct xbf_ring ) ) / sizeof ( union xbf_ring_desc ) ; if ( ! powerof2 ( sc -> sc_xr_ndesc ) ) sc -> sc_xr_ndesc = 1 << ( fls ( sc -> sc_xr_ndesc ) - 1 ) ; if ( sc -> sc_xr_ndesc > XBF_MAX_REQS ) sc -> sc_xr_ndesc = XBF_MAX_REQS ; DPRINTF ( "%s: %u ring pages, %u requests\\n" , sc -> sc_dev . dv_xname , sc -> sc_xr_size , sc -> sc_xr_ndesc ) ; if ( xbf_ring_create ( sc ) ) return ( - 1 ) ; action = "set" ; for ( i = 0 ; i < sc -> sc_xr_size ; i ++ ) { if ( i == 0 && sc -> sc_xr_size == 1 ) snprintf ( pbuf , sizeof ( pbuf ) , "ring-ref" ) ; else <vul-start> snprintf ( pbuf , sizeof ( pbuf ) , "ring-ref%u" , i ) ; <vul-end> prop = pbuf ; if ( xs_setnum ( sc -> sc_parent , sc -> sc_node , prop , sc -> sc_xr_ref [ i ] ) ) goto errout ; } if ( sc -> sc_xr_size > 1 ) { prop = "num-ring-pages" ; if ( xs_setnum ( sc -> sc_parent , sc -> sc_node , prop , sc -> sc_xr_size ) ) goto errout ; prop = "ring-page-order" ; if ( xs_setnum ( sc -> sc_parent , sc -> sc_node , prop , fls ( sc -> sc_xr_size ) - 1 ) ) goto errout ; } prop = "event-channel" ; if ( xs_setnum ( sc -> sc_parent , sc -> sc_node , prop , sc -> sc_xih ) ) goto errout ; prop = "protocol" ; # ifdef __amd64__ if ( xs_setprop ( sc -> sc_parent , sc -> sc_node , prop , "x86_64-abi" , strlen ( "x86_64-abi" ) ) ) goto errout ; # else if ( xs_setprop ( sc -> sc_parent , sc -> sc_node , prop , "x86_32-abi" , strlen ( "x86_32-abi" ) ) ) goto errout ; # endif if ( xs_setprop ( sc -> sc_parent , sc -> sc_node , "state" , XEN_STATE_INITIALIZED , strlen ( XEN_STATE_INITIALIZED ) ) ) { printf ( "%s: failed to set state to INITIALIZED\\n" , sc -> sc_dev . dv_xname ) ; xbf_ring_destroy ( sc ) ; return ( - 1 ) ; } if ( xs_await_transition ( sc -> sc_parent , sc -> sc_backend , "state" , XEN_STATE_CONNECTED , 10000 ) ) { printf ( "%s: timed out waiting for backend to connect\\n" , sc -> sc_dev . dv_xname ) ; xbf_ring_destroy ( sc ) ; return ( - 1 ) ; } action = "read" ; prop = "sectors" ; if ( ( error = xs_getnum ( sc -> sc_parent , sc -> sc_backend , prop , & res ) ) != 0 ) goto errout ; sc -> sc_disk_size = res ; prop = "sector-size" ; if ( ( error = xs_getnum ( sc -> sc_parent , sc -> sc_backend , prop , & res ) ) != 0 ) goto errout ; sc -> sc_block_size = res ; prop = "feature-barrier" ; if ( ( error = xs_getnum ( sc -> sc_parent , sc -> sc_backend , prop , & res ) ) != 0 && error != ENOENT ) goto errout ; if ( error == 0 && res == 1 ) sc -> sc_caps |= XBF_CAP_BARRIER ; prop = "feature-flush-cache" ; if ( ( error = xs_getnum ( sc -> sc_parent , sc -> sc_backend , prop , & res ) ) != 0 && error != ENOENT ) goto errout ; if ( error == 0 && res == 1 ) sc -> sc_caps |= XBF_CAP_FLUSH ; # ifdef XBF_DEBUG if ( sc -> sc_caps ) { printf ( "%s: features:" , sc -> sc_dev . dv_xname ) ; if ( sc -> sc_caps & XBF_CAP_BARRIER ) printf ( " BARRIER" ) ; if ( sc -> sc_caps & XBF_CAP_FLUSH ) printf ( " FLUSH" ) ; printf ( "\\n" ) ; } # endif if ( xs_setprop ( sc -> sc_parent , sc -> sc_node , "state" , XEN_STATE_CONNECTED , strlen ( XEN_STATE_CONNECTED ) ) ) { printf ( "%s: failed to set state to CONNECTED\\n" , sc -> sc_dev . dv_xname ) ; return ( - 1 ) ; } sc -> sc_state = XBF_CONNECTED ; return ( 0 ) ; errout : printf ( "%s: failed to %s \\"%s\\" property (%d)\\n" , sc -> sc_dev . dv_xname , action , prop , error ) ; xbf_ring_destroy ( sc ) ; return ( - 1 ) ; }
| <vul-start> pbuf ) , "ring-ref%d" <vul-end> , i )
|
73 | CWE-000 static int read_request ( int fd , debugger_request_t * out_request ) { struct ucred cr ; int len = sizeof ( cr ) ; int status = getsockopt ( fd , SOL_SOCKET , SO_PEERCRED , & cr , & len ) ; if ( status != 0 ) { LOG ( "cannot get credentials\\n" ) ; return - 1 ; } XLOG ( "reading tid\\n" ) ; fcntl ( fd , F_SETFL , O_NONBLOCK ) ; struct pollfd pollfds [ 1 ] ; pollfds [ 0 ] . fd = fd ; pollfds [ 0 ] . events = POLLIN ; pollfds [ 0 ] . revents = 0 ; status = TEMP_FAILURE_RETRY ( poll ( pollfds , 1 , 3000 ) ) ; if ( status != 1 ) { LOG ( "timed out reading tid (from pid=%d uid=%d)\\n" , cr . pid , cr . uid ) ; return - 1 ; } debugger_msg_t msg ; memset ( & msg , 0 , sizeof ( msg ) ) ; status = TEMP_FAILURE_RETRY ( read ( fd , & msg , sizeof ( msg ) ) ) ; if ( status < 0 ) { LOG ( "read failure? %s (pid=%d uid=%d)\\n" , strerror ( errno ) , cr . pid , cr . uid ) ; return - 1 ; } if ( status == sizeof ( debugger_msg_t ) ) { XLOG ( "crash request of size %d abort_msg_address=%#08x\\n" , status , msg . abort_msg_address ) ; } else { LOG ( "invalid crash request of size %d (from pid=%d uid=%d)\\n" , status , cr . pid , cr . uid ) ; return - 1 ; } out_request -> action = msg . action ; out_request -> tid = msg . tid ; out_request -> pid = cr . pid ; out_request -> uid = cr . uid ; out_request -> gid = cr . gid ; out_request -> abort_msg_address = msg . abort_msg_address ; if ( msg . action == DEBUGGER_ACTION_CRASH ) { <vul-start> char buf [ 64 ] ; <vul-end> struct stat s ; snprintf ( buf , sizeof buf , "/proc/%d/task/%d" , out_request -> pid , out_request -> tid ) ; if ( stat ( buf , & s ) ) { LOG ( "tid %d does not exist in pid %d. ignoring debug request\\n" , <vul-start> out_request -> tid , out_request -> pid ) ; <vul-end> return - 1 ; } } else if ( cr . uid == 0 || ( cr . uid == AID_SYSTEM && msg . action == DEBUGGER_ACTION_DUMP_BACKTRACE ) ) { status = get_process_info ( out_request -> tid , & out_request -> pid , & out_request -> uid , & out_request -> gid ) ; if ( status < 0 ) { LOG ( "tid %d does not exist. ignoring explicit dump request\\n" , out_request -> tid ) ; return - 1 ; } } else { return - 1 ; } return 0 ; }
| <vul-start> DEBUGGER_ACTION_CRASH ) { if ( ! pid_contains_tid ( out_request -> pid , out_request -> tid ) ) { XLOG <vul-end> ( "tid %d does not exist in pid %d. ignoring debug request\\n" , <vul-start> ( "tid %d does not exist in pid %d. ignoring debug request\\n" , out_request -> tid , <vul-end> out_request -> pid
|
74 | CWE-000 void executeTests ( ) { if ( currentSuite -> parent ) { fail ( "Not all describe blocks have been closed." ) ; } <vul-start> traverseTests ( currentSuite ) ; <vul-end> }
| <vul-start> ) ; } if ( currentSuite -> children ) { DescribeBlock * currentDescribe = currentSuite -> children ; while ( currentDescribe -> next ) { traverseTests ( currentDescribe -> next ) ; currentDescribe = currentDescribe -> next ; } } <vul-end> }
|
75 | CWE-000 static void check_respawn ( void ) { time_t t = time ( NULL ) ; static time_t timestamp ; static int counter ; <vul-start> if ( timestamp >= t - 120 ) <vul-end> ++ counter ; else { timestamp = t ; counter = 0 ; } <vul-start> if ( counter >= 10 ) { <vul-end> unsigned int time_left = 300 ; syslog ( LOG_ERR , "Error: collectd is respawning too fast - " "disabled for %i seconds" , time_left ) ; <vul-start> while ( ( ( time_left = sleep ( time_left ) ) >= 0 ) && loop == 0 ) <vul-end> ; } return ; }
| <vul-start> if ( timestamp > <vul-end> t - 120 <vul-start> if ( counter > <vul-end> 10 ) { <vul-start> time_left ) ) > <vul-end> 0 ) &&
|
76 | CWE-000 void get_rte_attribute_type ( RangeTblEntry * rte , AttrNumber attnum , Oid * vartype , int32 * vartypmod , Oid * varcollid ) { switch ( rte -> rtekind ) { case RTE_RELATION : { HeapTuple tp ; Form_pg_attribute att_tup ; tp = SearchSysCache2 ( ATTNUM , ObjectIdGetDatum ( rte -> relid ) , Int16GetDatum ( attnum ) ) ; if ( ! HeapTupleIsValid ( tp ) ) elog ( ERROR , "cache lookup failed for attribute %d of relation %u" , attnum , rte -> relid ) ; att_tup = ( Form_pg_attribute ) GETSTRUCT ( tp ) ; if ( att_tup -> attisdropped ) ereport ( ERROR , ( errcode ( ERRCODE_UNDEFINED_COLUMN ) , errmsg ( "column \\"%s\\" of relation \\"%s\\" does not exist" , NameStr ( att_tup -> attname ) , get_rel_name ( rte -> relid ) ) ) ) ; * vartype = att_tup -> atttypid ; * vartypmod = att_tup -> atttypmod ; * varcollid = att_tup -> attcollation ; ReleaseSysCache ( tp ) ; } break ; case RTE_SUBQUERY : { TargetEntry * te = get_tle_by_resno ( rte -> subquery -> targetList , attnum ) ; if ( te == NULL || te -> resjunk ) elog ( ERROR , "subquery %s does not have attribute %d" , rte -> eref -> aliasname , attnum ) ; * vartype = exprType ( ( Node * ) te -> expr ) ; * vartypmod = exprTypmod ( ( Node * ) te -> expr ) ; * varcollid = exprCollation ( ( Node * ) te -> expr ) ; } break ; case RTE_FUNCTION : { ListCell * lc ; int atts_done = 0 ; foreach ( lc , rte -> functions ) { RangeTblFunction * rtfunc = ( RangeTblFunction * ) lfirst ( lc ) ; if ( attnum > atts_done && attnum <= atts_done + rtfunc -> funccolcount ) { TypeFuncClass functypclass ; Oid funcrettype ; TupleDesc tupdesc ; attnum -= atts_done ; functypclass = get_expr_result_type ( rtfunc -> funcexpr , & funcrettype , & tupdesc ) ; if ( functypclass == TYPEFUNC_COMPOSITE ) { Form_pg_attribute att_tup ; Assert ( tupdesc ) ; Assert ( attnum <= tupdesc -> natts ) ; att_tup = TupleDescAttr ( tupdesc , attnum - 1 ) ; if ( att_tup -> attisdropped ) ereport ( ERROR , ( errcode ( ERRCODE_UNDEFINED_COLUMN ) , errmsg ( "column \\"%s\\" of relation \\"%s\\" does not exist" , NameStr ( att_tup -> attname ) , rte -> eref -> aliasname ) ) ) ; * vartype = att_tup -> atttypid ; * vartypmod = att_tup -> atttypmod ; * varcollid = att_tup -> attcollation ; } else if ( functypclass == TYPEFUNC_SCALAR ) { * vartype = funcrettype ; * vartypmod = - 1 ; * varcollid = exprCollation ( rtfunc -> funcexpr ) ; } else if ( functypclass == TYPEFUNC_RECORD ) { * vartype = list_nth_oid ( rtfunc -> funccoltypes , attnum - 1 ) ; * vartypmod = list_nth_int ( rtfunc -> funccoltypmods , attnum - 1 ) ; * varcollid = list_nth_oid ( rtfunc -> funccolcollations , attnum - 1 ) ; } else { elog ( ERROR , "function in FROM has unsupported return type" ) ; } return ; } atts_done += rtfunc -> funccolcount ; } if ( rte -> funcordinality && attnum == atts_done + 1 ) { * vartype = INT8OID ; * vartypmod = - 1 ; * varcollid = InvalidOid ; return ; } ereport ( ERROR , ( errcode ( ERRCODE_UNDEFINED_COLUMN ) , errmsg ( "column %d of relation \\"%s\\" does not exist" , attnum , rte -> eref -> aliasname ) ) ) ; } break ; case RTE_JOIN : { Node * aliasvar ; Assert ( attnum > 0 && attnum <= list_length ( rte -> joinaliasvars ) ) ; aliasvar = ( Node * ) list_nth ( rte -> joinaliasvars , attnum - 1 ) ; Assert ( aliasvar != NULL ) ; * vartype = exprType ( aliasvar ) ; * vartypmod = exprTypmod ( aliasvar ) ; * varcollid = exprCollation ( aliasvar ) ; } break ; case RTE_TABLEFUNC : case RTE_VALUES : case RTE_CTE : case RTE_NAMEDTUPLESTORE : { Assert ( attnum > 0 && attnum <= list_length ( rte -> coltypes ) ) ; * vartype = list_nth_oid ( rte -> coltypes , attnum - 1 ) ; * vartypmod = list_nth_int ( rte -> coltypmods , attnum - 1 ) ; * varcollid = list_nth_oid ( rte -> colcollations , attnum - 1 ) ; <vul-start> } <vul-end> break ; default : elog ( ERROR , "unrecognized RTE kind: %d" , ( int ) rte -> rtekind ) ; } }
| <vul-start> 1 ) ; if ( ! OidIsValid ( * vartype ) ) ereport ( ERROR , ( errcode ( ERRCODE_UNDEFINED_COLUMN ) , errmsg ( "column %d of relation \\"%s\\" does not exist" , attnum , rte -> eref -> aliasname ) ) ) ;
|
77 | CWE-000 void P2 ( ) { <vul-start> char * xx = "hello world, I\'m P2\\n" ; <vul-end> write ( 0 , xx , 20 ) ; while ( 1 ) { for ( uint32_t x = ( 1 << 8 ) ; x < ( 1 << 24 ) ; x ++ ) { uint32_t r = weight ( x ) ; } } return ; }
| <vul-start> xx = "hello world, I\'m P2\\n" <vul-end> ; while (
|
78 | CWE-000 static int iw_softap_set_channel_range ( struct net_device * dev , int startChannel , int endChannel , int band ) { VOS_STATUS status ; int ret = 0 ; hdd_adapter_t * pHostapdAdapter = ( netdev_priv ( dev ) ) ; tHalHandle hHal = WLAN_HDD_GET_HAL_CTX ( pHostapdAdapter ) ; hdd_context_t * pHddCtx = WLAN_HDD_GET_CTX ( pHostapdAdapter ) ; <vul-start> status = WLANSAP_SetChannelRange ( hHal , startChannel , endChannel , band ) ; <vul-end> if ( VOS_STATUS_SUCCESS != status ) { ret = - EINVAL ; } pHddCtx -> is_dynamic_channel_range_set = 1 ; return ret ; }
| <vul-start> pHostapdAdapter ) ; if ( ! capable ( CAP_NET_ADMIN ) ) { VOS_TRACE ( VOS_MODULE_ID_HDD , VOS_TRACE_LEVEL_ERROR , FL ( "permission check failed" ) ) ; return - EPERM ; }
|
79 | CWE-000 struct alloc_class_collection * alloc_class_collection_new ( void ) { struct alloc_class_collection * ac = Malloc ( sizeof ( * ac ) ) ; if ( ac == NULL ) return NULL ; memset ( ac -> aclasses , 0 , sizeof ( ac -> aclasses ) ) ; ac -> last_run_max_size = MAX_RUN_SIZE ; if ( alloc_class_new ( ac , CLASS_HUGE , CHUNKSIZE , 0 , 0 ) == NULL ) goto error_alloc_class_create ; struct alloc_class * predefined_class = alloc_class_new ( ac , CLASS_RUN , MIN_RUN_SIZE , RUN_UNIT_MAX , RUN_UNIT_MAX_ALLOC ) ; if ( predefined_class == NULL ) goto error_alloc_class_create ; for ( size_t i = 0 ; i < FIRST_GENERATED_CLASS_SIZE ; ++ i ) { ac -> class_map_by_unit_size [ i ] = predefined_class -> id ; ac -> class_map_by_alloc_size [ i ] = predefined_class -> id ; } size_t size = 0 ; for ( int c = 1 ; c < MAX_ALLOC_CATEGORIES ; ++ c ) { for ( size_t i = categories [ c - 1 ] . size + 1 ; i <= categories [ c ] . size ; i += categories [ c ] . step ) { size = i + ( categories [ c ] . step - 1 ) ; if ( alloc_class_find_or_create ( ac , size * ALLOC_BLOCK_SIZE ) == NULL ) goto error_alloc_class_create ; } } uint8_t largest_aclass_slot ; for ( largest_aclass_slot = MAX_ALLOCATION_CLASSES - 1 ; largest_aclass_slot > 0 && ac -> aclasses [ largest_aclass_slot ] == NULL ; -- largest_aclass_slot ) { } struct alloc_class * c = ac -> aclasses [ largest_aclass_slot ] ; size_t real_unit_max = c -> run . bitmap_nallocs < c -> run . unit_max_alloc ? c -> run . bitmap_nallocs : c -> run . unit_max_alloc ; size_t theoretical_run_max_size = c -> unit_size * real_unit_max ; ac -> last_run_max_size = MAX_RUN_SIZE > theoretical_run_max_size ? theoretical_run_max_size : MAX_RUN_SIZE ; for ( size_t i = FIRST_GENERATED_CLASS_SIZE ; i <= ac -> last_run_max_size / ALLOC_BLOCK_SIZE ; ++ i ) { struct alloc_class * c = alloc_class_find_min_frag ( ac , i * ALLOC_BLOCK_SIZE ) ; ac -> class_map_by_unit_size [ i ] = c -> id ; size_t header_offset = CALC_SIZE_IDX ( ALLOC_BLOCK_SIZE , header_type_to_size [ c -> header_type ] ) ; ac -> class_map_by_alloc_size [ i - header_offset ] = c -> id ; ac -> class_map_by_alloc_size [ i ] = c -> id ; } <vul-start> # ifndef DEBUG <vul-end> for ( size_t i = 0 ; i < MAX_ALLOCATION_CLASSES ; ++ i ) { struct alloc_class * c = ac -> aclasses [ i ] ; <vul-start> ASSERTeq ( i , c -> id ) ; <vul-end> <vul-start> if ( c != NULL ) { <vul-end> uint8_t class_id = ac -> class_map_by_unit_size [ SIZE_TO_CLASS_MAP_INDEX ( c -> unit_size ) ] ; ASSERTeq ( class_id , c -> id ) ; } } # endif return ac ; error_alloc_class_create : alloc_class_collection_delete ( ac ) ; return NULL ; }
| <vul-start> ; } # ifdef <vul-end> DEBUG for ( <vul-start> i ] ; if ( c != NULL ) { <vul-start> id ) ; <vul-end> uint8_t class_id =
|
80 | CWE-000 static int trans_exc ( struct kvm_vcpu * vcpu , int code , unsigned long gva , <vul-start> ar_t ar , enum gacc_mode mode , enum prot_type prot ) <vul-end> { struct kvm_s390_pgm_info * pgm = & vcpu -> arch . pgm ; struct trans_exc_code_bits * tec ; memset ( pgm , 0 , sizeof ( * pgm ) ) ; pgm -> code = code ; tec = ( struct trans_exc_code_bits * ) & pgm -> trans_exc_code ; switch ( code ) { case PGM_PROTECTION : switch ( prot ) { <vul-start> case PROT_TYPE_ALC : <vul-end> tec -> b60 = 1 ; case PROT_TYPE_DAT : tec -> b61 = 1 ; <vul-start> break ; <vul-end> default : return code ; } case PGM_ASCE_TYPE : case PGM_PAGE_TRANSLATION : case PGM_REGION_FIRST_TRANS : case PGM_REGION_SECOND_TRANS : case PGM_REGION_THIRD_TRANS : case PGM_SEGMENT_TRANSLATION : tec -> addr = gva >> PAGE_SHIFT ; tec -> fsi = mode == GACC_STORE ? FSI_STORE : FSI_FETCH ; tec -> as = psw_bits ( vcpu -> arch . sie_block -> gpsw ) . as ; case PGM_ALEN_TRANSLATION : case PGM_ALE_SEQUENCE : case PGM_ASTE_VALIDITY : case PGM_ASTE_SEQUENCE : case PGM_EXTENDED_AUTHORITY : pgm -> exc_access_id = ar ; break ; } return code ; }
| <vul-start> long gva , u8 <vul-end> ar , enum <vul-start> ) { case PROT_TYPE_LA : tec -> b56 = 1 ; break ; case PROT_TYPE_KEYC : tec -> b60 = 1 ; break ; case <vul-start> 1 ; break <vul-end> ; } case
|
81 | CWE-000 static int b53_mmap_write16 ( struct b53_device * dev , u8 page , u8 reg , u16 value ) { <vul-start> u8 __iomem * regs = dev -> priv ; <vul-end> if ( WARN_ON ( reg % 2 ) ) return - EINVAL ; if ( dev -> pdata && dev -> pdata -> big_endian ) iowrite16be ( value , regs + ( page << 8 ) + reg ) ; else writew ( value , regs + ( page << 8 ) + reg ) ; return 0 ; }
| <vul-start> value ) { struct b53_mmap_priv * priv = dev -> priv ; void <vul-end> __iomem * regs <vul-start> * regs = priv -> regs <vul-end> ; if (
|
82 | CWE-000 static void attachToSlot ( ResGroupData * group , ResGroupSlotData * slot ) { <vul-start> int32 slotMemUsage ; <vul-end> int32 sharedMemUsage ; pg_atomic_add_fetch_u32 ( ( pg_atomic_uint32 * ) & slot -> nProcs , 1 ) ; <vul-start> slotMemUsage = pg_atomic_add_fetch_u32 ( ( pg_atomic_uint32 * ) & slot -> memUsage , <vul-end> <vul-start> self -> memUsage ) ; <vul-end> <vul-start> sharedMemUsage = slotMemUsage - slot -> memQuota ; <vul-end> if ( sharedMemUsage > 0 ) { sharedMemUsage = Min ( sharedMemUsage , self -> memUsage ) ; <vul-start> pg_atomic_add_fetch_u32 ( ( pg_atomic_uint32 * ) & group -> memSharedUsage , <vul-end> sharedMemUsage ) ; } <vul-start> pg_atomic_add_fetch_u32 ( ( pg_atomic_uint32 * ) & group -> memUsage , <vul-end> self -> memUsage ) ; }
| <vul-start> slot ) { <vul-end> int32 sharedMemUsage ; <vul-start> 1 ) ; S_LOCK ( & group -> lock ) ; <vul-end> slot -> memUsage <vul-start> slot -> memUsage += <vul-end> self -> memUsage <vul-start> self -> memUsage <vul-end> ; sharedMemUsage = <vul-start> ; sharedMemUsage = slot -> memUsage <vul-end> - slot -> <vul-start> memUsage ) ; <vul-end> group -> memSharedUsage <vul-start> group -> memSharedUsage += sharedMemUsage ; } group -> memUsage += self -> memUsage ; S_UNLOCK ( <vul-end> & group -> <vul-start> & group -> lock <vul-end> ) ; }
|
83 | CWE-000 void help_list ( void ) { int i ; int j ; i = 0 ; j = 0 ; cmd_title ( ) ; while ( g_builtin_list [ i ] != '\\0' ) { j ++ ; if ( i >= 0 && i < 6 ) <vul-start> printf ( "\\n(%d) Only if I\'m \\033[37;1m%s\\033[0m\\n\\n" , j , g_builtin_list [ i ] ) ; <vul-end> i ++ ; } }
| <vul-start> < 6 ) ft_printf ( 1 , <vul-end> "\\n(%d) Only if I\'m \\033[37;1m%s\\033[0m\\n\\n" , j
|
84 | CWE-000 static gboolean nm_vpn_connection_apply_config ( NMVpnConnection * self ) { NMVpnConnectionPrivate * priv = NM_VPN_CONNECTION_GET_PRIVATE ( self ) ; if ( priv -> ip_ifindex > 0 ) { nm_platform_link_set_up ( NM_PLATFORM_GET , priv -> ip_ifindex , NULL ) ; if ( priv -> ip4_config ) { if ( ! nm_ip4_config_commit ( priv -> ip4_config , priv -> ip_ifindex , TRUE , nm_vpn_connection_get_ip4_route_metric ( self ) ) ) return FALSE ; } if ( priv -> ip6_config ) { if ( ! nm_ip6_config_commit ( priv -> ip6_config , priv -> ip_ifindex , TRUE ) ) return FALSE ; } if ( priv -> mtu && priv -> mtu != nm_platform_link_get_mtu ( NM_PLATFORM_GET , priv -> ip_ifindex ) ) nm_platform_link_set_mtu ( NM_PLATFORM_GET , priv -> ip_ifindex , priv -> mtu ) ; } apply_parent_device_config ( self ) ; <vul-start> nm_default_route_manager_ip4_update_default_route ( priv -> default_route_manager , self , FALSE ) ; <vul-end> <vul-start> nm_default_route_manager_ip6_update_default_route ( priv -> default_route_manager , self , FALSE ) ; <vul-end> _LOGI ( "VPN connection: (IP Config Get) complete" ) ; if ( priv -> vpn_state < STATE_PRE_UP ) _set_vpn_state ( self , STATE_PRE_UP , NM_VPN_CONNECTION_STATE_REASON_NONE , FALSE ) ; return TRUE ; }
| <vul-start> default_route_manager , self <vul-end> ) ; nm_default_route_manager_ip6_update_default_route <vul-start> default_route_manager , self <vul-end> ) ; _LOGI
|
85 | CWE-000 GtkWidget * xed_externally_modified_saving_error_message_area_new ( const gchar * uri , const GError * error ) { GtkWidget * message_area ; GtkWidget * hbox_content ; GtkWidget * image ; GtkWidget * vbox ; gchar * primary_markup ; gchar * secondary_markup ; GtkWidget * primary_label ; GtkWidget * secondary_label ; gchar * primary_text ; const gchar * secondary_text ; gchar * full_formatted_uri ; gchar * uri_for_display ; gchar * temp_uri_for_display ; g_return_val_if_fail ( uri != NULL , NULL ) ; g_return_val_if_fail ( error != NULL , NULL ) ; g_return_val_if_fail ( error -> domain == XED_DOCUMENT_ERROR , NULL ) ; g_return_val_if_fail ( error -> code == XED_DOCUMENT_ERROR_EXTERNALLY_MODIFIED , NULL ) ; full_formatted_uri = xed_utils_uri_for_display ( uri ) ; temp_uri_for_display = xed_utils_str_middle_truncate ( full_formatted_uri , MAX_URI_IN_DIALOG_LENGTH ) ; g_free ( full_formatted_uri ) ; uri_for_display = g_markup_printf_escaped ( "<i>%s</i>" , temp_uri_for_display ) ; g_free ( temp_uri_for_display ) ; message_area = gtk_info_bar_new ( ) ; <vul-start> info_bar_add_stock_button_with_text ( GTK_INFO_BAR ( message_area ) , _ ( "S_ave Anyway" ) , <vul-end> <vul-start> GTK_STOCK_SAVE , GTK_RESPONSE_YES ) ; <vul-end> gtk_info_bar_add_button ( GTK_INFO_BAR ( message_area ) , _ ( "D_on\'t Save" ) , GTK_RESPONSE_CANCEL ) ; gtk_info_bar_set_message_type ( GTK_INFO_BAR ( message_area ) , GTK_MESSAGE_WARNING ) ; hbox_content = gtk_box_new ( GTK_ORIENTATION_HORIZONTAL , 8 ) ; <vul-start> image = gtk_image_new_from_stock ( "gtk-dialog-warning" , GTK_ICON_SIZE_DIALOG ) ; <vul-end> gtk_box_pack_start ( GTK_BOX ( hbox_content ) , image , FALSE , FALSE , 0 ) ; gtk_widget_set_halign ( image , GTK_ALIGN_CENTER ) ; gtk_widget_set_valign ( image , GTK_ALIGN_START ) ; vbox = gtk_box_new ( GTK_ORIENTATION_VERTICAL , 6 ) ; gtk_box_pack_start ( GTK_BOX ( hbox_content ) , vbox , TRUE , TRUE , 0 ) ; primary_text = g_strdup_printf ( _ ( "The file %s has been modified since reading it." ) , uri_for_display ) ; g_free ( uri_for_display ) ; primary_markup = g_strdup_printf ( "<b>%s</b>" , primary_text ) ; g_free ( primary_text ) ; primary_label = gtk_label_new ( primary_markup ) ; g_free ( primary_markup ) ; gtk_box_pack_start ( GTK_BOX ( vbox ) , primary_label , TRUE , TRUE , 0 ) ; gtk_label_set_use_markup ( GTK_LABEL ( primary_label ) , TRUE ) ; gtk_label_set_line_wrap ( GTK_LABEL ( primary_label ) , TRUE ) ; gtk_misc_set_alignment ( GTK_MISC ( primary_label ) , 0.0 , 0.5 ) ; gtk_widget_set_can_focus ( primary_label , TRUE ) ; gtk_label_set_selectable ( GTK_LABEL ( primary_label ) , TRUE ) ; secondary_text = _ ( "If you save it, all the external changes could be lost. Save it anyway?" ) ; secondary_markup = g_strdup_printf ( "<small>%s</small>" , secondary_text ) ; secondary_label = gtk_label_new ( secondary_markup ) ; g_free ( secondary_markup ) ; gtk_box_pack_start ( GTK_BOX ( vbox ) , secondary_label , TRUE , TRUE , 0 ) ; gtk_widget_set_can_focus ( secondary_label , TRUE ) ; gtk_label_set_use_markup ( GTK_LABEL ( secondary_label ) , TRUE ) ; gtk_label_set_line_wrap ( GTK_LABEL ( secondary_label ) , TRUE ) ; gtk_label_set_selectable ( GTK_LABEL ( secondary_label ) , TRUE ) ; gtk_misc_set_alignment ( GTK_MISC ( secondary_label ) , 0.0 , 0.5 ) ; gtk_widget_show_all ( hbox_content ) ; set_contents ( message_area , hbox_content ) ; return message_area ; }
| <vul-start> ( ) ; info_bar_add_button_with_text <vul-end> ( GTK_INFO_BAR ( <vul-start> "S_ave Anyway" ) , "document-save-symbolic" <vul-end> , GTK_RESPONSE_YES ) <vul-start> ; image = gtk_image_new_from_icon_name ( "dialog-warning-symbolic" <vul-end> , GTK_ICON_SIZE_DIALOG )
|
86 | CWE-000 <vul-start> err_t httpd_post_receive_data ( void * connection , struct pbuf * p ) { <vul-end> if ( ! strcmp ( req_uri , "/kyChu/print.cgi" ) ) { int i = 0 , j = 0 ; while ( i < p -> len && ( ( char * ) p -> payload ) [ i ] != '=' ) i ++ ; do { i ++ ; cache [ j ++ ] = ( ( char * ) p -> payload ) [ i ] ; } while ( i < p -> len && ( ( char * ) p -> payload ) [ i ] != '&' ) ; cache [ j - 1 ] = 0 ; printf ( "%s\\n" , cache ) ; memcpy ( req_uri , default_uri , strlen ( default_uri ) ) ; req_uri [ strlen ( default_uri ) ] = 0 ; } else if ( ! strcmp ( req_uri , "/upgrade/wifi.cgi" ) ) { <vul-start> printf ( "upload %s.\\n" , p -> payload ) ; <vul-end> memcpy ( req_uri , default_uri , strlen ( default_uri ) ) ; req_uri [ strlen ( default_uri ) ] = 0 ; } else if ( ! strcmp ( req_uri , "/upgrade/fc.cgi" ) ) { memcpy ( req_uri , default_uri , strlen ( default_uri ) ) ; req_uri [ strlen ( default_uri ) ] = 0 ; } return ERR_OK ; }
| <vul-start> p ) { ( ( char * ) p -> payload ) [ p -> len ] = 0 ; printf ( "payload is %s.\\n" , p -> payload ) ; <vul-start> ) ) { <vul-end> memcpy ( req_uri
|
87 | CWE-000 static inline void disable_rx ( C161_Serial * ser ) { if ( ser -> ifh_is_active ) { <vul-start> FIO_RemoveFileHandler ( & ser -> input_fh ) ; <vul-end> } ser -> ifh_is_active = 0 ; }
| <vul-start> ifh_is_active ) { AsyncManager_PollStop ( <vul-end> ser -> input_fh
|
88 | CWE-000 static inline u_int <vul-start> mtp_get_subzone ( const char * desc ) <vul-end> { return ( 0 ) ; }
| <vul-start> u_int mtp_get_subzone ( struct malloc_type * mtp <vul-end> ) { return
|
89 | CWE-000 int main ( int argc , char * * argv ) { int i , max , offset ; byte dec [ 256 ] = { 0 } , enc [ 256 ] = { 0 } ; char string [ 2048 ] = { 0 } ; offset = 8 ; if ( argc > 2 ) { if ( argv [ 1 ] [ 0 ] == 'd' ) { <vul-start> if ( strlen ( argv [ 2 ] ) > 256 * 8 ) return - 1 ; <vul-end> memcpy ( string , argv [ 2 ] , strlen ( argv [ 2 ] ) ) ; for ( i = 0 ; i < strlen ( string ) - 3 ; i += 8 ) enc [ i / 8 ] = str2byte ( & string [ i ] ) ; max = i / 8 ; memcpy ( & dec , & enc , 256 ) ; dec [ offset + 0 ] = enc [ offset + 0 ] ; dec [ offset + 1 ] = ( ~ enc [ offset + 1 ] ) ^ 0x89 ; for ( i = offset + 2 ; i < max ; i ++ ) dec [ i ] = ( enc [ i - 1 ] + 0xdc ) ^ enc [ i ] ; dec [ offset + i ] = enc [ offset + i ] ^ dec [ offset + 2 ] ; dec [ max - 1 ] = 0 ; dec [ max - 2 ] = 0 ; for ( i = 0 ; i < max ; i ++ ) print_binary ( dec [ i ] ) ; } else { <vul-start> if ( strlen ( argv [ 2 ] ) > 256 * 8 ) return - 1 ; <vul-end> memcpy ( string , argv [ 2 ] , strlen ( argv [ 2 ] ) ) ; for ( i = 0 ; i < strlen ( string ) - 3 ; i += 8 ) dec [ i / 8 ] = str2byte ( & string [ i ] ) ; max = i / 8 ; memcpy ( & enc , & dec , 256 ) ; enc [ offset + 0 ] = dec [ offset + 0 ] ; enc [ offset + 1 ] = ~ ( dec [ offset + 1 ] ^ 0x89 ) ; for ( i = offset + 2 ; i < max ; i ++ ) enc [ i ] = ( enc [ i - 1 ] + 0xdc ) ^ dec [ i ] ; enc [ offset + i ] = dec [ offset + i ] ^ dec [ offset + 2 ] ; enc [ max - 1 ] = 0 ; enc [ max - 2 ] = 0 ; for ( i = 0 ; i < max ; i ++ ) print_binary ( enc [ i ] ) ; } } else printf ( "Usage: %s <d/e> <bit sequence>\\n\\td - decode\\n\\te - encode\\n\\tbit sequence as string of 0 and 1.\\n" , argv [ 0 ] ) ; return 0 ; }
| <vul-start> 256 * 8 || strlen ( argv [ 2 ] ) < 4 <vul-start> 256 * 8 || strlen ( argv [ 2 ] ) < 4
|
90 | CWE-000 <vul-start> static int receivedata ( struct spi_slave * slave , u8 * buffer , u32 size ) <vul-end> { u32 read_data , base ; int ret ; base = container_of ( slave , struct img_spi_slave , slave ) -> base ; write32 ( base + SPFI_INT_CLEAR_REG_OFFSET , SPFI_GDEX32BIT_MASK ) ; while ( size >= sizeof ( u32 ) ) { ret = wait_status ( base + SPFI_INT_STATUS_REG_OFFSET , SPFI_GDEX32BIT_SHIFT ) ; if ( ret ) return ret ; read_data = read32 ( base + SPFI_GET_LONG_REG_OFFSET ) ; memcpy ( buffer , & read_data , sizeof ( u32 ) ) ; buffer += sizeof ( u32 ) ; size -= sizeof ( u32 ) ; write32 ( base + SPFI_INT_CLEAR_REG_OFFSET , SPFI_GDEX32BIT_MASK ) ; } write32 ( base + SPFI_INT_CLEAR_REG_OFFSET , SPFI_GDEX8BIT_MASK ) ; while ( size ) { ret = wait_status ( base + SPFI_INT_STATUS_REG_OFFSET , SPFI_GDEX8BIT_SHIFT ) ; if ( ret ) return ret ; * buffer = read32 ( base + SPFI_GET_BYTE_REG_OFFSET ) ; buffer ++ ; size -- ; write32 ( base + SPFI_INT_CLEAR_REG_OFFSET , SPFI_GDEX8BIT_MASK ) ; } return SPIM_OK ; }
| <vul-start> int receivedata ( const
|
91 | CWE-000 static void spapr_memory_pre_plug ( HotplugHandler * hotplug_dev , DeviceState * dev , Error * * errp ) { const sPAPRMachineClass * smc = SPAPR_MACHINE_GET_CLASS ( hotplug_dev ) ; sPAPRMachineState * spapr = SPAPR_MACHINE ( hotplug_dev ) ; PCDIMMDevice * dimm = PC_DIMM ( dev ) ; PCDIMMDeviceClass * ddc = PC_DIMM_GET_CLASS ( dimm ) ; MemoryRegion * mr ; uint64_t size ; Object * memdev ; hwaddr pagesize ; if ( ! smc -> dr_lmb_enabled ) { error_setg ( errp , "Memory hotplug not supported for this machine" ) ; return ; } mr = ddc -> get_memory_region ( dimm , errp ) ; if ( ! mr ) { return ; } size = memory_region_size ( mr ) ; if ( size % SPAPR_MEMORY_BLOCK_SIZE ) { error_setg ( errp , "Hotplugged memory size must be a multiple of " <vul-start> "%lld MB" , SPAPR_MEMORY_BLOCK_SIZE / M_BYTE ) ; <vul-end> return ; } memdev = object_property_get_link ( OBJECT ( dimm ) , PC_DIMM_MEMDEV_PROP , & error_abort ) ; pagesize = host_memory_backend_pagesize ( MEMORY_BACKEND ( memdev ) ) ; spapr_check_pagesize ( spapr , pagesize , errp ) ; }
| <vul-start> , SPAPR_MEMORY_BLOCK_SIZE / MiB <vul-end> ) ; return
|
92 | CWE-000 static inline void ipv6_store_devconf ( struct ipv6_devconf * cnf , __s32 * array , int bytes ) { BUG_ON ( bytes < ( DEVCONF_MAX * 4 ) ) ; memset ( array , 0 , bytes ) ; array [ DEVCONF_FORWARDING ] = cnf -> forwarding ; array [ DEVCONF_HOPLIMIT ] = cnf -> hop_limit ; array [ DEVCONF_MTU6 ] = cnf -> mtu6 ; array [ DEVCONF_ACCEPT_RA ] = cnf -> accept_ra ; array [ DEVCONF_ACCEPT_REDIRECTS ] = cnf -> accept_redirects ; array [ DEVCONF_AUTOCONF ] = cnf -> autoconf ; array [ DEVCONF_DAD_TRANSMITS ] = cnf -> dad_transmits ; array [ DEVCONF_RTR_SOLICITS ] = cnf -> rtr_solicits ; array [ DEVCONF_RTR_SOLICIT_INTERVAL ] = jiffies_to_msecs ( cnf -> rtr_solicit_interval ) ; array [ DEVCONF_RTR_SOLICIT_MAX_INTERVAL ] = jiffies_to_msecs ( cnf -> rtr_solicit_max_interval ) ; array [ DEVCONF_RTR_SOLICIT_DELAY ] = jiffies_to_msecs ( cnf -> rtr_solicit_delay ) ; array [ DEVCONF_FORCE_MLD_VERSION ] = cnf -> force_mld_version ; array [ DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL ] = jiffies_to_msecs ( cnf -> mldv1_unsolicited_report_interval ) ; array [ DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL ] = jiffies_to_msecs ( cnf -> mldv2_unsolicited_report_interval ) ; array [ DEVCONF_USE_TEMPADDR ] = cnf -> use_tempaddr ; array [ DEVCONF_TEMP_VALID_LFT ] = cnf -> temp_valid_lft ; array [ DEVCONF_TEMP_PREFERED_LFT ] = cnf -> temp_prefered_lft ; array [ DEVCONF_REGEN_MAX_RETRY ] = cnf -> regen_max_retry ; array [ DEVCONF_MAX_DESYNC_FACTOR ] = cnf -> max_desync_factor ; array [ DEVCONF_MAX_ADDRESSES ] = cnf -> max_addresses ; array [ DEVCONF_ACCEPT_RA_DEFRTR ] = cnf -> accept_ra_defrtr ; array [ DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT ] = cnf -> accept_ra_min_hop_limit ; array [ DEVCONF_ACCEPT_RA_PINFO ] = cnf -> accept_ra_pinfo ; # ifdef CONFIG_IPV6_ROUTER_PREF array [ DEVCONF_ACCEPT_RA_RTR_PREF ] = cnf -> accept_ra_rtr_pref ; array [ DEVCONF_RTR_PROBE_INTERVAL ] = jiffies_to_msecs ( cnf -> rtr_probe_interval ) ; # ifdef CONFIG_IPV6_ROUTE_INFO <vul-start> array [ DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN ] = cnf -> accept_ra_rt_info_max_plen ; <vul-end> # endif # endif array [ DEVCONF_ACCEPT_RA_RT_TABLE ] = cnf -> accept_ra_rt_table ; array [ DEVCONF_PROXY_NDP ] = cnf -> proxy_ndp ; array [ DEVCONF_ACCEPT_SOURCE_ROUTE ] = cnf -> accept_source_route ; # ifdef CONFIG_IPV6_OPTIMISTIC_DAD array [ DEVCONF_OPTIMISTIC_DAD ] = cnf -> optimistic_dad ; array [ DEVCONF_USE_OPTIMISTIC ] = cnf -> use_optimistic ; # endif # ifdef CONFIG_IPV6_MROUTE array [ DEVCONF_MC_FORWARDING ] = cnf -> mc_forwarding ; # endif array [ DEVCONF_DISABLE_IPV6 ] = cnf -> disable_ipv6 ; array [ DEVCONF_ACCEPT_DAD ] = cnf -> accept_dad ; array [ DEVCONF_FORCE_TLLAO ] = cnf -> force_tllao ; array [ DEVCONF_NDISC_NOTIFY ] = cnf -> ndisc_notify ; array [ DEVCONF_SUPPRESS_FRAG_NDISC ] = cnf -> suppress_frag_ndisc ; array [ DEVCONF_ACCEPT_RA_FROM_LOCAL ] = cnf -> accept_ra_from_local ; array [ DEVCONF_ACCEPT_RA_MTU ] = cnf -> accept_ra_mtu ; array [ DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN ] = cnf -> ignore_routes_with_linkdown ; array [ DEVCONF_USE_OIF_ADDRS_ONLY ] = cnf -> use_oif_addrs_only ; array [ DEVCONF_DROP_UNICAST_IN_L2_MULTICAST ] = cnf -> drop_unicast_in_l2_multicast ; array [ DEVCONF_DROP_UNSOLICITED_NA ] = cnf -> drop_unsolicited_na ; array [ DEVCONF_KEEP_ADDR_ON_DOWN ] = cnf -> keep_addr_on_down ; }
| <vul-start> CONFIG_IPV6_ROUTE_INFO array [ DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN ] = cnf -> accept_ra_rt_info_min_plen ; array [
|
93 | CWE-000 void stat_update ( batch_request * preq , struct stat_cntl * cntl ) { svr_job * pjob ; struct batch_reply * preply ; struct brp_status * pstatus ; svrattrl * sattrl ; int oldsid ; int bad = 0 ; time_t time_now = time ( NULL ) ; char * msg_ptr = NULL ; char log_buf [ LOCAL_LOG_BUF_SIZE ] ; preply = & preq -> rq_reply ; if ( ( preply -> brp_choice != BATCH_REPLY_CHOICE_Queue ) && ( preply -> brp_un . brp_txt . brp_str != NULL ) ) { msg_ptr = strstr ( preply -> brp_un . brp_txt . brp_str , PBS_MSG_EQUAL ) ; if ( msg_ptr != NULL ) msg_ptr += strlen ( PBS_MSG_EQUAL ) ; } if ( preply -> brp_choice == BATCH_REPLY_CHOICE_Status ) { pstatus = ( struct brp_status * ) GET_NEXT ( preply -> brp_un . brp_status ) ; while ( pstatus != NULL ) { if ( ( pjob = svr_find_job ( pstatus -> brp_objname , FALSE ) ) != NULL ) { mutex_mgr job_mutex ( pjob -> ji_mutex , true ) ; sattrl = ( svrattrl * ) GET_NEXT ( pstatus -> brp_attr ) ; oldsid = pjob -> get_long_attr ( JOB_ATR_session_id ) ; modify_job_attr ( pjob , sattrl , ATR_DFLAG_MGWR | ATR_DFLAG_SvWR , & bad ) ; if ( oldsid != pjob -> get_long_attr ( JOB_ATR_session_id ) ) { svr_job_save ( pjob ) ; } # ifdef USESAVEDRESOURCES else { svr_job_save ( pjob ) ; } # endif pjob -> ji_momstat = time_now ; } pstatus = ( struct brp_status * ) GET_NEXT ( pstatus -> brp_stlink ) ; } } else if ( ( preply -> brp_choice == BATCH_REPLY_CHOICE_Text ) && ( preply -> brp_code == PBSE_UNKJOBID ) && ( msg_ptr != NULL ) && ( ! strcmp ( msg_ptr , preq -> rq_ind . rq_status . rq_id ) ) ) { if ( ( pjob = svr_find_job ( preq -> rq_ind . rq_status . rq_id , FALSE ) ) != NULL ) { mutex_mgr job_mutex ( pjob -> ji_mutex , true ) ; <vul-start> if ( pjob -> ji_qs . ji_state != JOB_STATE_RUNNING ) <vul-end> { if ( LOGLEVEL >= 6 ) { snprintf ( log_buf , sizeof ( log_buf ) , "stat_update(): job %s is no longer in running state. Ignoring unknown job id reply from mom." , preq -> rq_ind . rq_status . rq_id ) ; log_event ( PBSEVENT_SYSTEM , PBS_EVENTCLASS_JOB , __func__ , log_buf ) ; } } else { snprintf ( log_buf , sizeof ( log_buf ) , "mother superior no longer recognizes %s as a valid job, aborting. Last reported time was %ld" , preq -> rq_ind . rq_status . rq_id , pjob -> ji_last_reported_time ) ; log_event ( PBSEVENT_JOB , PBS_EVENTCLASS_JOB , __func__ , log_buf ) ; svr_setjobstate ( pjob , JOB_STATE_QUEUED , JOB_SUBSTATE_ABORT , FALSE ) ; rel_resc ( pjob ) ; job_mutex . set_unlock_on_exit ( false ) ; job_abt ( & pjob , "Job does not exist on node" ) ; } } } else { if ( preply -> brp_choice == BATCH_REPLY_CHOICE_Queue ) { snprintf ( log_buf , sizeof ( log_buf ) , "Unexpected reply: reply was on queue" ) ; log_event ( PBSEVENT_JOB , PBS_EVENTCLASS_JOB , __func__ , log_buf ) ; } else { snprintf ( log_buf , sizeof ( log_buf ) , "Poll job request failed for job %s" , preq -> rq_ind . rq_status . rq_id ) ; log_err ( preply -> brp_code , __func__ , log_buf ) ; } } cntl -> sc_conn = - 1 ; if ( cntl -> sc_post ) cntl -> sc_post ( cntl ) ; return ; }
| <vul-start> ( pjob -> get_state ( ) <vul-end> != JOB_STATE_RUNNING )
|
94 | CWE-000 pgp_seckey_t * pgp_decrypt_seckey ( const pgp_key_t * key , FILE * passfp ) { <vul-start> pgp_stream_t * stream ; <vul-end> const int printerrors = 1 ; decrypt_t decrypt ; if ( key -> packetc == 0 ) { <vul-start> return ( pgp_seckey_t * ) & key -> key . seckey ; <vul-end> } ( void ) memset ( & decrypt , 0x0 , sizeof ( decrypt ) ) ; decrypt . key = key ; stream = pgp_new ( sizeof ( * stream ) ) ; pgp_key_reader_set ( stream , key ) ; pgp_set_callback ( stream , decrypt_cb_empty , & decrypt ) ; stream -> readinfo . accumulate = 1 ; pgp_parse ( stream , ! printerrors ) ; if ( decrypt . seckey != NULL ) { pgp_stream_delete ( stream ) ; return decrypt . seckey ; } pgp_stream_delete ( stream ) ; decrypt . passfp = passfp ; stream = pgp_new ( sizeof ( * stream ) ) ; pgp_key_reader_set ( stream , key ) ; pgp_set_callback ( stream , decrypt_cb , & decrypt ) ; stream -> readinfo . accumulate = 1 ; pgp_parse ( stream , ! printerrors ) ; pgp_stream_delete ( stream ) ; return decrypt . seckey ; }
| <vul-start> passfp ) { if ( <vul-end> key -> key <vul-start> key . seckey . decrypt_cb == NULL ) { return NULL ; } return key -> key . seckey . decrypt_cb ( key , passfp ) <vul-end> ; }
|
95 | CWE-000 static void print_last_error ( void ) { DWORD errorMessageID = GetLastError ( ) ; if ( errorMessageID != 0 ) { LPSTR messageBuffer = NULL ; size_t size = FormatMessageA ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS , NULL , errorMessageID , MAKELANGID ( LANG_NEUTRAL , SUBLANG_DEFAULT ) , ( LPSTR ) & messageBuffer , 0 , NULL ) ; <vul-start> printf ( "Last error: %s\\n" , messageBuffer ) ; <vul-end> LocalFree ( messageBuffer ) ; } }
| <vul-start> NULL ) ; pDEBUG <vul-end> ( "Last error: %s\\n" ,
|
96 | CWE-000 AWS_TEST_CASE ( mqtt_topic_tree_unsubscribe , s_mqtt_topic_tree_unsubscribe_fn ) static int s_mqtt_topic_tree_unsubscribe_fn ( struct aws_allocator * allocator , void * ctx ) { ( void ) ctx ; struct aws_mqtt_topic_tree tree ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_init ( & tree , allocator ) ) ; struct aws_string * topic_a_a = aws_string_new_from_array ( allocator , s_topic_a_a . ptr , s_topic_a_a . len ) ; struct aws_string * topic_a_a_a = aws_string_new_from_array ( allocator , s_topic_a_a_a . ptr , s_topic_a_a_a . len ) ; struct aws_string * topic_a_a_b = aws_string_new_from_array ( allocator , s_topic_a_a_b . ptr , s_topic_a_a_b . len ) ; AWS_VARIABLE_LENGTH_ARRAY ( uint8_t , transaction_buf , aws_mqtt_topic_tree_action_size * 3 ) ; struct aws_array_list transaction ; aws_array_list_init_static ( & transaction , transaction_buf , 3 , aws_mqtt_topic_tree_action_size ) ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_insert ( & tree , topic_a_a_a , AWS_MQTT_QOS_AT_MOST_ONCE , & on_publish , NULL , NULL ) ) ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_remove ( & tree , & s_topic_a_a_a ) ) ; topic_a_a_a = aws_string_new_from_array ( allocator , s_topic_a_a_a . ptr , s_topic_a_a_a . len ) ; ASSERT_UINT_EQUALS ( 0 , aws_hash_table_get_entry_count ( & tree . root -> subtopics ) ) ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_transaction_insert ( & tree , & transaction , topic_a_a_a , AWS_MQTT_QOS_AT_MOST_ONCE , & on_publish , NULL , NULL ) ) ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_transaction_insert ( & tree , & transaction , topic_a_a , AWS_MQTT_QOS_AT_MOST_ONCE , & on_publish , NULL , NULL ) ) ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_transaction_insert ( & tree , & transaction , topic_a_a_b , AWS_MQTT_QOS_AT_MOST_ONCE , & on_publish , NULL , NULL ) ) ; aws_mqtt_topic_tree_transaction_commit ( & tree , & transaction ) ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_transaction_remove ( & tree , & transaction , & s_topic_a_a_a ) ) ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_transaction_remove ( & tree , & transaction , & s_topic_a_a ) ) ; aws_mqtt_topic_tree_transaction_commit ( & tree , & transaction ) ; struct aws_mqtt_packet_publish publish ; aws_mqtt_packet_publish_init ( & publish , false , AWS_MQTT_QOS_AT_MOST_ONCE , false , s_topic_a_a_a , 1 , s_topic_a_a_a ) ; <vul-start> was_called = false ; <vul-end> ASSERT_SUCCESS ( aws_mqtt_topic_tree_publish ( & tree , & publish ) ) ; <vul-start> ASSERT_FALSE ( was_called ) ; <vul-end> publish . topic_name = s_topic_a_a_b ; was_called = false ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_publish ( & tree , & publish ) ) ; ASSERT_TRUE ( was_called ) ; aws_mqtt_topic_tree_clean_up ( & tree ) ; return AWS_OP_SUCCESS ; }
| <vul-start> s_topic_a_a_a ) ; times_called = 0 ; ASSERT_SUCCESS ( aws_mqtt_topic_tree_publish ( & tree , & publish ) ) ; ASSERT_INT_EQUALS ( times_called , 0 ) ; publish . topic_name = s_topic_a_a_b ; times_called <vul-end> = false ; <vul-start> ) ) ; ASSERT_INT_EQUALS ( times_called , 1 <vul-end> ) ; aws_mqtt_topic_tree_clean_up
|
97 | CWE-000 static void emit_got ( MonoAotCompile * acfg ) { char symbol [ MAX_SYMBOL_SIZE ] ; if ( acfg -> aot_opts . llvm_only ) return ; sprintf ( symbol , "%s" , acfg -> got_symbol ) ; # ifdef TARGET_MACH emit_unset_mode ( acfg ) ; fprintf ( acfg -> fp , ".section __DATA, __bss\\n" ) ; emit_alignment ( acfg , 8 ) ; if ( acfg -> llvm ) <vul-start> emit_info_symbol ( acfg , "jit_got" ) ; <vul-end> fprintf ( acfg -> fp , ".lcomm %s, %d\\n" , acfg -> got_symbol , ( int ) ( acfg -> got_offset * sizeof ( gpointer ) ) ) ; # else emit_section_change ( acfg , ".bss" , 0 ) ; emit_alignment ( acfg , 8 ) ; if ( acfg -> aot_opts . write_symbols ) emit_local_symbol ( acfg , symbol , "got_end" , FALSE ) ; emit_label ( acfg , symbol ) ; if ( acfg -> llvm ) emit_info_symbol ( acfg , "jit_got" , FALSE ) ; if ( acfg -> got_offset > 0 ) emit_zero_bytes ( acfg , ( int ) ( acfg -> got_offset * sizeof ( gpointer ) ) ) ; # endif sprintf ( symbol , "got_end" ) ; emit_label ( acfg , symbol ) ; }
| <vul-start> acfg , "jit_got" , FALSE
|
98 | CWE-000 int main ( ) { inputPars par ; image * img = NULL ; <vul-start> int nImages ; <vul-end> silent = 0 ; mallocInputPars ( & par ) ; nImages = initParImg ( & par , & img ) ; run ( par , img , nImages ) ; free ( img ) ; free ( par . collPartIds ) ; free ( par . nMolWeights ) ; free ( par . dustWeights ) ; free ( par . moldatfile ) ; return 0 ; }
| <vul-start> ; int nImages <vul-end> ; mallocInputPars (
|
99 | CWE-000 static bool c_parser_gimple_compound_statement ( c_parser * parser , gimple_seq * seq ) { bool return_p = false ; if ( ! c_parser_require ( parser , CPP_OPEN_BRACE , "expected %<{%>" ) ) return false ; while ( c_parser_next_tokens_start_declaration ( parser ) ) { c_parser_gimple_declaration ( parser ) ; if ( ! c_parser_require ( parser , CPP_SEMICOLON , "expected %<;%>" ) ) return false ; } while ( c_parser_next_token_is_not ( parser , CPP_CLOSE_BRACE ) ) { if ( c_parser_error ( parser ) ) { c_parser_skip_until_found ( parser , CPP_CLOSE_BRACE , NULL ) ; return return_p ; } else if ( c_parser_next_token_is ( parser , CPP_EOF ) ) { c_parser_error ( parser , "expected declaration or statement" ) ; return return_p ; } switch ( c_parser_peek_token ( parser ) -> type ) { case CPP_KEYWORD : switch ( c_parser_peek_token ( parser ) -> keyword ) { case RID_IF : c_parser_gimple_if_stmt ( parser , seq ) ; break ; case RID_SWITCH : c_parser_gimple_switch_stmt ( parser , seq ) ; break ; case RID_GOTO : { location_t loc = c_parser_peek_token ( parser ) -> location ; c_parser_consume_token ( parser ) ; if ( c_parser_next_token_is ( parser , CPP_NAME ) ) { c_parser_gimple_goto_stmt ( loc , c_parser_peek_token ( parser ) -> value , seq ) ; c_parser_consume_token ( parser ) ; if ( ! c_parser_require ( parser , CPP_SEMICOLON , "expected %<;%>" ) ) return return_p ; } } break ; case RID_RETURN : return_p = true ; c_parser_gimple_return_stmt ( parser , seq ) ; if ( ! c_parser_require ( parser , CPP_SEMICOLON , "expected %<;%>" ) ) return return_p ; break ; default : goto expr_stmt ; } break ; case CPP_NAME : if ( c_parser_peek_2nd_token ( parser ) -> type == CPP_COLON ) { c_parser_gimple_label ( parser , seq ) ; break ; } goto expr_stmt ; default : expr_stmt : c_parser_gimple_statement ( parser , seq ) ; if ( ! c_parser_require ( parser , CPP_SEMICOLON , "expected %<;%>" ) ) <vul-start> return return_p ; <vul-end> } } c_parser_consume_token ( parser ) ; return return_p ; }
| <vul-start> "expected %<;%>" ) ) c_parser_skip_until_found ( parser , CPP_SEMICOLON , NULL ) <vul-end> ; } }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.