Unnamed: 0
int64 0
6.78k
| cwe_id
stringlengths 6
8
| source
stringlengths 86
89.9k
| target
stringlengths 1
30.7k
| project_and_commit_id
stringlengths 48
79
| cve_id
stringlengths 13
16
⌀ | original_address
stringlengths 46
134
| time
stringlengths 1
17
|
---|---|---|---|---|---|---|---|
0 | CWE-000 | CWE-000 static void unix_release_sock ( struct sock * sk , int embrion ) { struct unix_sock * u = unix_sk ( sk ) ; struct path path ; struct sock * skpair ; struct sk_buff * skb ; int state ; unix_remove_socket ( sk ) ; unix_state_lock ( sk ) ; sock_orphan ( sk ) ; sk -> sk_shutdown = SHUTDOWN_MASK ; path = u -> path ; u -> path . dentry = NULL ; u -> path . mnt = NULL ; state = sk -> sk_state ; sk -> sk_state = TCP_CLOSE ; unix_state_unlock ( sk ) ; wake_up_interruptible_all ( & u -> peer_wait ) ; skpair = unix_peer ( sk ) ; if ( skpair != NULL ) { if ( sk -> sk_type == SOCK_STREAM || sk -> sk_type == SOCK_SEQPACKET ) { unix_state_lock ( skpair ) ; skpair -> sk_shutdown = SHUTDOWN_MASK ; if ( ! skb_queue_empty ( & sk -> sk_receive_queue ) || embrion ) skpair -> sk_err = ECONNRESET ; unix_state_unlock ( skpair ) ; skpair -> sk_state_change ( skpair ) ; sk_wake_async ( skpair , SOCK_WAKE_WAITD , POLL_HUP ) ; } <S2SV_StartBug> sock_put ( skpair ) ; <S2SV_EndBug> unix_peer ( sk ) = NULL ; } while ( ( skb = skb_dequeue ( & sk -> sk_receive_queue ) ) != NULL ) { if ( state == TCP_LISTEN ) unix_release_sock ( skb -> sk , 1 ) ; UNIXCB ( skb ) . consumed = skb -> len ; kfree_skb ( skb ) ; } if ( path . dentry ) path_put ( & path ) ; sock_put ( sk ) ; if ( unix_tot_inflight ) unix_gc ( ) ; }
| <S2SV_ModStart> ) ; } unix_dgram_peer_wake_disconnect ( sk , skpair ) ;
| torvalds@linux/7d267278a9ece963d77eefec61630223fce08c6c | CVE-2013-7446 | https://github.com/torvalds/linux/commit/7d267278a9ece963d77eefec61630223fce08c6c | 2015-12-28T11:59Z |
1 | CWE-200 | CWE-200 static void snd_timer_user_tinterrupt ( struct snd_timer_instance * timeri , unsigned long resolution , unsigned long ticks ) { struct snd_timer_user * tu = timeri -> callback_data ; struct snd_timer_tread * r , r1 ; struct timespec tstamp ; int prev , append = 0 ; memset ( & tstamp , 0 , sizeof ( tstamp ) ) ; spin_lock ( & tu -> qlock ) ; if ( ( tu -> filter & ( ( 1 << SNDRV_TIMER_EVENT_RESOLUTION ) | ( 1 << SNDRV_TIMER_EVENT_TICK ) ) ) == 0 ) { spin_unlock ( & tu -> qlock ) ; return ; } if ( tu -> last_resolution != resolution || ticks > 0 ) { if ( timer_tstamp_monotonic ) ktime_get_ts ( & tstamp ) ; else getnstimeofday ( & tstamp ) ; } if ( ( tu -> filter & ( 1 << SNDRV_TIMER_EVENT_RESOLUTION ) ) && tu -> last_resolution != resolution ) { <S2SV_StartBug> r1 . event = SNDRV_TIMER_EVENT_RESOLUTION ; <S2SV_EndBug> r1 . tstamp = tstamp ; r1 . val = resolution ; snd_timer_user_append_to_tqueue ( tu , & r1 ) ; tu -> last_resolution = resolution ; append ++ ; } if ( ( tu -> filter & ( 1 << SNDRV_TIMER_EVENT_TICK ) ) == 0 ) goto __wake ; if ( ticks == 0 ) goto __wake ; if ( tu -> qused > 0 ) { prev = tu -> qtail == 0 ? tu -> queue_size - 1 : tu -> qtail - 1 ; r = & tu -> tqueue [ prev ] ; if ( r -> event == SNDRV_TIMER_EVENT_TICK ) { r -> tstamp = tstamp ; r -> val += ticks ; append ++ ; goto __wake ; } } r1 . event = SNDRV_TIMER_EVENT_TICK ; r1 . tstamp = tstamp ; r1 . val = ticks ; snd_timer_user_append_to_tqueue ( tu , & r1 ) ; append ++ ; __wake : spin_unlock ( & tu -> qlock ) ; if ( append == 0 ) return ; kill_fasync ( & tu -> fasync , SIGIO , POLL_IN ) ; wake_up ( & tu -> qchange_sleep ) ; }
| <S2SV_ModStart> resolution ) { memset ( & r1 , 0 , sizeof ( r1 ) ) ;
| torvalds@linux/e4ec8cc8039a7063e24204299b462bd1383184a5 | CVE-2016-4578 | https://github.com/torvalds/linux/commit/e4ec8cc8039a7063e24204299b462bd1383184a5 | 2016-05-23T10:59Z |
2 | CWE-119 | CWE-119 static void store_coding_context ( MACROBLOCK * x , PICK_MODE_CONTEXT * ctx , int mode_index , <S2SV_StartBug> int_mv * ref_mv , <S2SV_EndBug> int_mv * second_ref_mv , int64_t comp_pred_diff [ REFERENCE_MODES ] , <S2SV_StartBug> int64_t tx_size_diff [ TX_MODES ] , <S2SV_EndBug> <S2SV_StartBug> int64_t best_filter_diff [ SWITCHABLE_FILTER_CONTEXTS ] ) { <S2SV_EndBug> MACROBLOCKD * const xd = & x -> e_mbd ; ctx -> skip = x -> skip ; <S2SV_StartBug> ctx -> best_mode_index = mode_index ; <S2SV_EndBug> ctx -> mic = * xd -> mi [ 0 ] ; <S2SV_StartBug> ctx -> best_ref_mv [ 0 ] . as_int = ref_mv -> as_int ; <S2SV_EndBug> ctx -> best_ref_mv [ 1 ] . as_int = second_ref_mv -> as_int ; ctx -> single_pred_diff = ( int ) comp_pred_diff [ SINGLE_REFERENCE ] ; ctx -> comp_pred_diff = ( int ) comp_pred_diff [ COMPOUND_REFERENCE ] ; ctx -> hybrid_pred_diff = ( int ) comp_pred_diff [ REFERENCE_MODE_SELECT ] ; <S2SV_StartBug> vpx_memcpy ( ctx -> tx_rd_diff , tx_size_diff , sizeof ( ctx -> tx_rd_diff ) ) ; <S2SV_EndBug> vpx_memcpy ( ctx -> best_filter_diff , best_filter_diff , sizeof ( * best_filter_diff ) * SWITCHABLE_FILTER_CONTEXTS ) ; }
| <S2SV_ModStart> int mode_index , <S2SV_ModEnd> int64_t comp_pred_diff [ <S2SV_ModStart> ] , int64_t <S2SV_ModEnd> best_filter_diff [ SWITCHABLE_FILTER_CONTEXTS <S2SV_ModStart> [ SWITCHABLE_FILTER_CONTEXTS ] , int skippable <S2SV_ModStart> ; ctx -> skippable = skippable ; ctx -> <S2SV_ModStart> ; ctx -> mbmi_ext = * x -> mbmi_ext <S2SV_ModEnd> ; ctx -> <S2SV_ModStart> REFERENCE_MODE_SELECT ] ; memcpy <S2SV_ModEnd> ( ctx ->
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
3 | CWE-000 | CWE-000 static int ext4_write_begin ( struct file * file , struct address_space * mapping , loff_t pos , unsigned len , unsigned flags , struct page * * pagep , void * * fsdata ) { struct inode * inode = mapping -> host ; int ret , needed_blocks ; handle_t * handle ; int retries = 0 ; struct page * page ; pgoff_t index ; unsigned from , to ; trace_ext4_write_begin ( inode , pos , len , flags ) ; needed_blocks = ext4_writepage_trans_blocks ( inode ) + 1 ; index = pos >> PAGE_CACHE_SHIFT ; from = pos & ( PAGE_CACHE_SIZE - 1 ) ; to = from + len ; retry : handle = ext4_journal_start ( inode , needed_blocks ) ; if ( IS_ERR ( handle ) ) { ret = PTR_ERR ( handle ) ; goto out ; } flags |= AOP_FLAG_NOFS ; page = grab_cache_page_write_begin ( mapping , index , flags ) ; if ( ! page ) { ext4_journal_stop ( handle ) ; ret = - ENOMEM ; goto out ; } * pagep = page ; <S2SV_StartBug> ret = block_write_begin ( file , mapping , pos , len , flags , pagep , fsdata , <S2SV_EndBug> <S2SV_StartBug> ext4_get_block ) ; <S2SV_EndBug> if ( ! ret && ext4_should_journal_data ( inode ) ) { ret = walk_page_buffers ( handle , page_buffers ( page ) , from , to , NULL , do_journal_get_write_access ) ; } if ( ret ) { unlock_page ( page ) ; page_cache_release ( page ) ; if ( pos + len > inode -> i_size && ext4_can_truncate ( inode ) ) ext4_orphan_add ( handle , inode ) ; ext4_journal_stop ( handle ) ; if ( pos + len > inode -> i_size ) { ext4_truncate_failed_write ( inode ) ; if ( inode -> i_nlink ) ext4_orphan_del ( NULL , inode ) ; } } if ( ret == - ENOSPC && ext4_should_retry_alloc ( inode -> i_sb , & retries ) ) goto retry ; out : return ret ; }
| <S2SV_ModStart> = page ; if ( ext4_should_dioread_nolock ( inode ) ) <S2SV_ModStart> , fsdata , ext4_get_block_write ) ; else ret = block_write_begin ( file , mapping , pos , len , flags , pagep , fsdata ,
| torvalds@linux/744692dc059845b2a3022119871846e74d4f6e11 | CVE-2015-8324 | https://github.com/torvalds/linux/commit/744692dc059845b2a3022119871846e74d4f6e11 | 2016-05-02T10:59Z |
4 | CWE-119 | CWE-119 <S2SV_StartBug> int16_t vp9_ac_quant ( int qindex , int delta ) { <S2SV_EndBug> return ac_qlookup [ clamp ( qindex + delta , 0 , MAXQ ) ] ; <S2SV_StartBug> } <S2SV_EndBug>
| <S2SV_ModStart> , int delta , vpx_bit_depth_t bit_depth ) { # if CONFIG_VP9_HIGHBITDEPTH switch ( bit_depth ) { case VPX_BITS_8 : <S2SV_ModEnd> return ac_qlookup [ <S2SV_ModStart> ) ] ; case VPX_BITS_10 : return ac_qlookup_10 [ clamp ( qindex + delta , 0 , MAXQ ) ] ; case VPX_BITS_12 : return ac_qlookup_12 [ clamp ( qindex + delta , 0 , MAXQ ) ] ; default : assert ( 0 && "bit_depth<S2SV_blank>should<S2SV_blank>be<S2SV_blank>VPX_BITS_8,<S2SV_blank>VPX_BITS_10<S2SV_blank>or<S2SV_blank>VPX_BITS_12" ) ; return - 1 ; } # else ( void ) bit_depth ; return ac_qlookup [ clamp ( qindex + delta , 0 , MAXQ ) ] ; # endif
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
5 | CWE-59 | CWE-59 int <S2SV_StartBug> add_mibfile ( const char * tmpstr , const char * d_name , FILE * ip ) <S2SV_EndBug> { FILE * fp ; char token [ MAXTOKEN ] , token2 [ MAXTOKEN ] ; if ( ( fp = fopen ( tmpstr , "r" ) ) == NULL ) { snmp_log_perror ( tmpstr ) ; return 1 ; } DEBUGMSGTL ( ( "parse-mibs" , "Checking<S2SV_blank>file:<S2SV_blank>%s...\\n" , tmpstr ) ) ; mibLine = 1 ; File = tmpstr ; if ( get_token ( fp , token , MAXTOKEN ) != LABEL ) { fclose ( fp ) ; return 1 ; } if ( get_token ( fp , token2 , MAXTOKEN ) == DEFINITIONS ) { new_module ( token , tmpstr ) ; <S2SV_StartBug> if ( ip ) <S2SV_EndBug> fprintf ( ip , "%s<S2SV_blank>%s\\n" , token , d_name ) ; fclose ( fp ) ; return 0 ; } else { fclose ( fp ) ; return 1 ; } }
| <S2SV_ModStart> char * d_name <S2SV_ModEnd> ) { FILE <S2SV_ModStart> tmpstr ) ; <S2SV_ModEnd> fclose ( fp
| net-snmp@net-snmp/4fd9a450444a434a993bc72f7c3486ccce41f602 | CVE-2020-15861 | https://github.com/net-snmp/net-snmp/commit/4fd9a450444a434a993bc72f7c3486ccce41f602 | 2020-08-20T01:17Z |
6 | CWE-400 | CWE-400 int fpm_stdio_init_child ( struct fpm_worker_pool_s * wp ) { # ifdef HAVE_SYSLOG_H if ( fpm_globals . error_log_fd == ZLOG_SYSLOG ) { closelog ( ) ; } else # endif if ( fpm_globals . error_log_fd > 0 ) { close ( fpm_globals . error_log_fd ) ; } fpm_globals . error_log_fd = - 1 ; zlog_set_fd ( - 1 ) ; <S2SV_StartBug> if ( wp -> listening_socket != STDIN_FILENO ) { <S2SV_EndBug> if ( 0 > dup2 ( wp -> listening_socket , STDIN_FILENO ) ) { zlog ( ZLOG_SYSERROR , "failed<S2SV_blank>to<S2SV_blank>init<S2SV_blank>child<S2SV_blank>stdio:<S2SV_blank>dup2()" ) ; return - 1 ; } } return 0 ; }
| <S2SV_ModStart> 1 ) ; <S2SV_ModEnd> return 0 ;
| php@php-src/69dee5c732fe982c82edb17d0dbc3e79a47748d8 | CVE-2015-9253 | https://github.com/php/php-src/commit/69dee5c732fe982c82edb17d0dbc3e79a47748d8 | 2018-02-19T19:29Z |
7 | CWE-254 | CWE-254 void test_parser ( void ) { <S2SV_StartBug> int i , retval ; <S2SV_EndBug> bzrtpPacket_t * zrtpPacket ; bzrtpContext_t * context87654321 = bzrtp_createBzrtpContext ( 0x87654321 ) ; bzrtpContext_t * context12345678 = bzrtp_createBzrtpContext ( 0x12345678 ) ; memcpy ( context12345678 -> channelContext [ 0 ] -> selfH [ 0 ] , H12345678 [ 0 ] , 32 ) ; memcpy ( context12345678 -> channelContext [ 0 ] -> selfH [ 1 ] , H12345678 [ 1 ] , 32 ) ; memcpy ( context12345678 -> channelContext [ 0 ] -> selfH [ 2 ] , H12345678 [ 2 ] , 32 ) ; memcpy ( context12345678 -> channelContext [ 0 ] -> selfH [ 3 ] , H12345678 [ 3 ] , 32 ) ; memcpy ( context87654321 -> channelContext [ 0 ] -> selfH [ 0 ] , H87654321 [ 0 ] , 32 ) ; memcpy ( context87654321 -> channelContext [ 0 ] -> selfH [ 1 ] , H87654321 [ 1 ] , 32 ) ; memcpy ( context87654321 -> channelContext [ 0 ] -> selfH [ 2 ] , H87654321 [ 2 ] , 32 ) ; memcpy ( context87654321 -> channelContext [ 0 ] -> selfH [ 3 ] , H87654321 [ 3 ] , 32 ) ; context87654321 -> channelContext [ 0 ] -> keyAgreementAlgo = ZRTP_KEYAGREEMENT_DH3k ; context12345678 -> channelContext [ 0 ] -> keyAgreementAlgo = ZRTP_KEYAGREEMENT_DH3k ; context87654321 -> channelContext [ 0 ] -> cipherAlgo = ZRTP_CIPHER_AES1 ; context12345678 -> channelContext [ 0 ] -> cipherAlgo = ZRTP_CIPHER_AES1 ; context87654321 -> channelContext [ 0 ] -> hashAlgo = ZRTP_HASH_S256 ; context12345678 -> channelContext [ 0 ] -> hashAlgo = ZRTP_HASH_S256 ; updateCryptoFunctionPointers ( context87654321 -> channelContext [ 0 ] ) ; updateCryptoFunctionPointers ( context12345678 -> channelContext [ 0 ] ) ; context87654321 -> channelContext [ 0 ] -> mackeyi = ( uint8_t * ) malloc ( 32 ) ; context12345678 -> channelContext [ 0 ] -> mackeyi = ( uint8_t * ) malloc ( 32 ) ; context87654321 -> channelContext [ 0 ] -> mackeyr = ( uint8_t * ) malloc ( 32 ) ; context12345678 -> channelContext [ 0 ] -> mackeyr = ( uint8_t * ) malloc ( 32 ) ; context87654321 -> channelContext [ 0 ] -> zrtpkeyi = ( uint8_t * ) malloc ( 16 ) ; context12345678 -> channelContext [ 0 ] -> zrtpkeyi = ( uint8_t * ) malloc ( 16 ) ; context87654321 -> channelContext [ 0 ] -> zrtpkeyr = ( uint8_t * ) malloc ( 16 ) ; context12345678 -> channelContext [ 0 ] -> zrtpkeyr = ( uint8_t * ) malloc ( 16 ) ; memcpy ( context12345678 -> channelContext [ 0 ] -> mackeyi , mackeyi , 32 ) ; memcpy ( context12345678 -> channelContext [ 0 ] -> mackeyr , mackeyr , 32 ) ; memcpy ( context12345678 -> channelContext [ 0 ] -> zrtpkeyi , zrtpkeyi , 16 ) ; memcpy ( context12345678 -> channelContext [ 0 ] -> zrtpkeyr , zrtpkeyr , 16 ) ; memcpy ( context87654321 -> channelContext [ 0 ] -> mackeyi , mackeyi , 32 ) ; memcpy ( context87654321 -> channelContext [ 0 ] -> mackeyr , mackeyr , 32 ) ; memcpy ( context87654321 -> channelContext [ 0 ] -> zrtpkeyi , zrtpkeyi , 16 ) ; memcpy ( context87654321 -> channelContext [ 0 ] -> zrtpkeyr , zrtpkeyr , 16 ) ; context12345678 -> channelContext [ 0 ] -> role = RESPONDER ; for ( i = 0 ; i < TEST_PACKET_NUMBER ; i ++ ) { uint8_t freePacketFlag = 1 ; zrtpPacket = bzrtp_packetCheck ( patternZRTPPackets [ i ] , patternZRTPMetaData [ i ] [ 0 ] , ( patternZRTPMetaData [ i ] [ 1 ] ) - 1 , & retval ) ; retval += bzrtp_packetParser ( ( patternZRTPMetaData [ i ] [ 2 ] == 0x87654321 ) ? context12345678 : context87654321 , ( patternZRTPMetaData [ i ] [ 2 ] == 0x87654321 ) ? context12345678 -> channelContext [ 0 ] : context87654321 -> channelContext [ 0 ] , patternZRTPPackets [ i ] , patternZRTPMetaData [ i ] [ 0 ] , zrtpPacket ) ; if ( zrtpPacket -> messageType == MSGTYPE_HELLO ) { if ( patternZRTPMetaData [ i ] [ 2 ] == 0x87654321 ) { context12345678 -> channelContext [ 0 ] -> peerPackets [ HELLO_MESSAGE_STORE_ID ] = zrtpPacket ; } else { context87654321 -> channelContext [ 0 ] -> peerPackets [ HELLO_MESSAGE_STORE_ID ] = zrtpPacket ; } freePacketFlag = 0 ; } if ( zrtpPacket -> messageType == MSGTYPE_COMMIT ) { if ( patternZRTPMetaData [ i ] [ 2 ] == 0x87654321 ) { context12345678 -> channelContext [ 0 ] -> peerPackets [ COMMIT_MESSAGE_STORE_ID ] = zrtpPacket ; } else { context87654321 -> channelContext [ 0 ] -> peerPackets [ COMMIT_MESSAGE_STORE_ID ] = zrtpPacket ; } freePacketFlag = 0 ; } if ( zrtpPacket -> messageType == MSGTYPE_DHPART1 || zrtpPacket -> messageType == MSGTYPE_DHPART2 ) { if ( patternZRTPMetaData [ i ] [ 2 ] == 0x87654321 ) { context12345678 -> channelContext [ 0 ] -> peerPackets [ DHPART_MESSAGE_STORE_ID ] = zrtpPacket ; } else { context87654321 -> channelContext [ 0 ] -> peerPackets [ DHPART_MESSAGE_STORE_ID ] = zrtpPacket ; } freePacketFlag = 0 ; } free ( zrtpPacket -> packetString ) ; retval = bzrtp_packetBuild ( ( patternZRTPMetaData [ i ] [ 2 ] == 0x12345678 ) ? context12345678 : context87654321 , ( patternZRTPMetaData [ i ] [ 2 ] == 0x12345678 ) ? context12345678 -> channelContext [ 0 ] : context87654321 -> channelContext [ 0 ] , zrtpPacket , patternZRTPMetaData [ i ] [ 1 ] ) ; if ( zrtpPacket -> packetString != NULL ) { CU_ASSERT_TRUE ( memcmp ( zrtpPacket -> packetString , patternZRTPPackets [ i ] , patternZRTPMetaData [ i ] [ 0 ] ) == 0 ) ; <S2SV_StartBug> } else { <S2SV_EndBug> CU_FAIL ( "Unable<S2SV_blank>to<S2SV_blank>build<S2SV_blank>packet" ) ; } if ( freePacketFlag == 1 ) { bzrtp_freeZrtpPacket ( zrtpPacket ) ; } } bzrtp_destroyBzrtpContext ( context87654321 , 0x87654321 ) ; bzrtp_destroyBzrtpContext ( context12345678 , 0x12345678 ) ; }
| <S2SV_ModStart> void ) { test_parser_param ( <S2SV_ModEnd> 0 ) ; <S2SV_ModStart> ) ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null>
| BelledonneCommunications@bzrtp/bbb1e6e2f467ee4bd7b9a8c800e4f07343d7d99b | CVE-2016-6271 | https://github.com/BelledonneCommunications/bzrtp/commit/bbb1e6e2f467ee4bd7b9a8c800e4f07343d7d99b | 2017-01-18T22:59Z |
8 | CWE-20 | CWE-20 static enum try_read_result try_read_network ( conn * c ) { enum try_read_result gotdata = READ_NO_DATA_RECEIVED ; int res ; <S2SV_StartBug> assert ( c != NULL ) ; <S2SV_EndBug> if ( c -> rcurr != c -> rbuf ) { if ( c -> rbytes != 0 ) memmove ( c -> rbuf , c -> rcurr , c -> rbytes ) ; c -> rcurr = c -> rbuf ; } while ( 1 ) { <S2SV_StartBug> if ( c -> rbytes >= c -> rsize ) { <S2SV_EndBug> char * new_rbuf = realloc ( c -> rbuf , c -> rsize * 2 ) ; if ( ! new_rbuf ) { if ( settings . verbose > 0 ) fprintf ( stderr , "Couldn\'t<S2SV_blank>realloc<S2SV_blank>input<S2SV_blank>buffer\\n" ) ; c -> rbytes = 0 ; out_string ( c , "SERVER_ERROR<S2SV_blank>out<S2SV_blank>of<S2SV_blank>memory<S2SV_blank>reading<S2SV_blank>request" ) ; c -> write_and_go = conn_closing ; return READ_MEMORY_ERROR ; } c -> rcurr = c -> rbuf = new_rbuf ; c -> rsize *= 2 ; } int avail = c -> rsize - c -> rbytes ; res = read ( c -> sfd , c -> rbuf + c -> rbytes , avail ) ; if ( res > 0 ) { pthread_mutex_lock ( & c -> thread -> stats . mutex ) ; c -> thread -> stats . bytes_read += res ; pthread_mutex_unlock ( & c -> thread -> stats . mutex ) ; gotdata = READ_DATA_RECEIVED ; c -> rbytes += res ; if ( res == avail ) { continue ; } else { break ; } } if ( res == 0 ) { return READ_ERROR ; } if ( res == - 1 ) { if ( errno == EAGAIN || errno == EWOULDBLOCK ) { break ; } return READ_ERROR ; } } return gotdata ; }
| <S2SV_ModStart> int res ; int num_allocs = 0 ; <S2SV_ModStart> rsize ) { if ( num_allocs == 4 ) { return gotdata ; } ++ num_allocs ;
| memcached@memcached/75cc83685e103bc8ba380a57468c8f04413033f9 | CVE-2010-1152 | https://github.com/memcached/memcached/commit/75cc83685e103bc8ba380a57468c8f04413033f9 | 2010-04-12T18:30Z |
9 | CWE-400 | CWE-400 static Image * ReadWPGImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { typedef struct { size_t FileId ; MagickOffsetType DataOffset ; unsigned int ProductType ; unsigned int FileType ; unsigned char MajorVersion ; unsigned char MinorVersion ; unsigned int EncryptKey ; unsigned int Reserved ; } WPGHeader ; typedef struct { unsigned char RecType ; size_t RecordLength ; } WPGRecord ; typedef struct { unsigned char Class ; unsigned char RecType ; size_t Extension ; size_t RecordLength ; } WPG2Record ; typedef struct { unsigned HorizontalUnits ; unsigned VerticalUnits ; unsigned char PosSizePrecision ; } WPG2Start ; typedef struct { unsigned int Width ; unsigned int Height ; unsigned int Depth ; unsigned int HorzRes ; unsigned int VertRes ; } WPGBitmapType1 ; typedef struct { unsigned int Width ; unsigned int Height ; unsigned char Depth ; unsigned char Compression ; } WPG2BitmapType1 ; typedef struct { unsigned int RotAngle ; unsigned int LowLeftX ; unsigned int LowLeftY ; unsigned int UpRightX ; unsigned int UpRightY ; unsigned int Width ; unsigned int Height ; unsigned int Depth ; unsigned int HorzRes ; unsigned int VertRes ; } WPGBitmapType2 ; typedef struct { unsigned int StartIndex ; unsigned int NumOfEntries ; } WPGColorMapRec ; Image * image ; unsigned int status ; WPGHeader Header ; WPGRecord Rec ; WPG2Record Rec2 ; WPG2Start StartWPG ; WPGBitmapType1 BitmapHeader1 ; WPG2BitmapType1 Bitmap2Header1 ; WPGBitmapType2 BitmapHeader2 ; WPGColorMapRec WPG_Palette ; int i , bpp , WPG2Flags ; ssize_t ldblk ; size_t one ; unsigned char * BImgBuff ; tCTM CTM ; assert ( image_info != ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickSignature ) ; assert ( exception != ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickSignature ) ; one = 1 ; image = AcquireImage ( image_info ) ; image -> depth = 8 ; status = OpenBlob ( image_info , image , ReadBinaryBlobMode , exception ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } Header . FileId = ReadBlobLSBLong ( image ) ; Header . DataOffset = ( MagickOffsetType ) ReadBlobLSBLong ( image ) ; Header . ProductType = ReadBlobLSBShort ( image ) ; Header . FileType = ReadBlobLSBShort ( image ) ; Header . MajorVersion = ReadBlobByte ( image ) ; Header . MinorVersion = ReadBlobByte ( image ) ; Header . EncryptKey = ReadBlobLSBShort ( image ) ; Header . Reserved = ReadBlobLSBShort ( image ) ; if ( Header . FileId != 0x435057FF || ( Header . ProductType >> 8 ) != 0x16 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( Header . EncryptKey != 0 ) ThrowReaderException ( CoderError , "EncryptedWPGImageFileNotSupported" ) ; image -> columns = 1 ; image -> rows = 1 ; image -> colors = 0 ; bpp = 0 ; BitmapHeader2 . RotAngle = 0 ; Rec2 . RecordLength = 0 ; switch ( Header . FileType ) { case 1 : while ( ! EOFBlob ( image ) ) { ( void ) SeekBlob ( image , Header . DataOffset , SEEK_SET ) ; if ( EOFBlob ( image ) ) break ; Rec . RecType = ( i = ReadBlobByte ( image ) ) ; if ( i == EOF ) break ; <S2SV_StartBug> Rd_WP_DWORD ( image , & Rec . RecordLength ) ; <S2SV_EndBug> if ( EOFBlob ( image ) ) break ; Header . DataOffset = TellBlob ( image ) + Rec . RecordLength ; switch ( Rec . RecType ) { case 0x0B : BitmapHeader1 . Width = ReadBlobLSBShort ( image ) ; BitmapHeader1 . Height = ReadBlobLSBShort ( image ) ; if ( ( BitmapHeader1 . Width == 0 ) || ( BitmapHeader1 . Height == 0 ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; BitmapHeader1 . Depth = ReadBlobLSBShort ( image ) ; BitmapHeader1 . HorzRes = ReadBlobLSBShort ( image ) ; BitmapHeader1 . VertRes = ReadBlobLSBShort ( image ) ; if ( BitmapHeader1 . HorzRes && BitmapHeader1 . VertRes ) { image -> units = PixelsPerCentimeterResolution ; image -> x_resolution = BitmapHeader1 . HorzRes / 470.0 ; image -> y_resolution = BitmapHeader1 . VertRes / 470.0 ; } image -> columns = BitmapHeader1 . Width ; image -> rows = BitmapHeader1 . Height ; bpp = BitmapHeader1 . Depth ; goto UnpackRaster ; case 0x0E : WPG_Palette . StartIndex = ReadBlobLSBShort ( image ) ; WPG_Palette . NumOfEntries = ReadBlobLSBShort ( image ) ; if ( ( WPG_Palette . NumOfEntries - WPG_Palette . StartIndex ) > ( Rec2 . RecordLength - 2 - 2 ) / 3 ) ThrowReaderException ( CorruptImageError , "InvalidColormapIndex" ) ; image -> colors = WPG_Palette . NumOfEntries ; if ( ! AcquireImageColormap ( image , image -> colors ) ) goto NoMemory ; for ( i = WPG_Palette . StartIndex ; i < ( int ) WPG_Palette . NumOfEntries ; i ++ ) { image -> colormap [ i ] . red = ScaleCharToQuantum ( ( unsigned char ) ReadBlobByte ( image ) ) ; image -> colormap [ i ] . green = ScaleCharToQuantum ( ( unsigned char ) ReadBlobByte ( image ) ) ; image -> colormap [ i ] . blue = ScaleCharToQuantum ( ( unsigned char ) ReadBlobByte ( image ) ) ; } break ; case 0x11 : if ( Rec . RecordLength > 8 ) image = ExtractPostscript ( image , image_info , TellBlob ( image ) + 8 , ( ssize_t ) Rec . RecordLength - 8 , exception ) ; break ; case 0x14 : BitmapHeader2 . RotAngle = ReadBlobLSBShort ( image ) ; BitmapHeader2 . LowLeftX = ReadBlobLSBShort ( image ) ; BitmapHeader2 . LowLeftY = ReadBlobLSBShort ( image ) ; BitmapHeader2 . UpRightX = ReadBlobLSBShort ( image ) ; BitmapHeader2 . UpRightY = ReadBlobLSBShort ( image ) ; BitmapHeader2 . Width = ReadBlobLSBShort ( image ) ; BitmapHeader2 . Height = ReadBlobLSBShort ( image ) ; if ( ( BitmapHeader2 . Width == 0 ) || ( BitmapHeader2 . Height == 0 ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; BitmapHeader2 . Depth = ReadBlobLSBShort ( image ) ; BitmapHeader2 . HorzRes = ReadBlobLSBShort ( image ) ; BitmapHeader2 . VertRes = ReadBlobLSBShort ( image ) ; image -> units = PixelsPerCentimeterResolution ; image -> page . width = ( unsigned int ) ( ( BitmapHeader2 . LowLeftX - BitmapHeader2 . UpRightX ) / 470.0 ) ; image -> page . height = ( unsigned int ) ( ( BitmapHeader2 . LowLeftX - BitmapHeader2 . UpRightY ) / 470.0 ) ; image -> page . x = ( int ) ( BitmapHeader2 . LowLeftX / 470.0 ) ; image -> page . y = ( int ) ( BitmapHeader2 . LowLeftX / 470.0 ) ; if ( BitmapHeader2 . HorzRes && BitmapHeader2 . VertRes ) { image -> x_resolution = BitmapHeader2 . HorzRes / 470.0 ; image -> y_resolution = BitmapHeader2 . VertRes / 470.0 ; } image -> columns = BitmapHeader2 . Width ; image -> rows = BitmapHeader2 . Height ; bpp = BitmapHeader2 . Depth ; UnpackRaster : status = SetImageExtent ( image , image -> columns , image -> rows ) ; if ( status == MagickFalse ) break ; if ( ( image -> colors == 0 ) && ( bpp != 24 ) ) { image -> colors = one << bpp ; if ( ! AcquireImageColormap ( image , image -> colors ) ) { NoMemory : ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; } for ( i = 0 ; ( i < ( int ) image -> colors ) && ( i < 256 ) ; i ++ ) { image -> colormap [ i ] . red = ScaleCharToQuantum ( WPG1_Palette [ i ] . Red ) ; image -> colormap [ i ] . green = ScaleCharToQuantum ( WPG1_Palette [ i ] . Green ) ; image -> colormap [ i ] . blue = ScaleCharToQuantum ( WPG1_Palette [ i ] . Blue ) ; } } else { if ( bpp < 24 ) if ( ( image -> colors < ( one << bpp ) ) && ( bpp != 24 ) ) image -> colormap = ( PixelPacket * ) ResizeQuantumMemory ( image -> colormap , ( size_t ) ( one << bpp ) , sizeof ( * image -> colormap ) ) ; } if ( bpp == 1 ) { if ( image -> colormap [ 0 ] . red == 0 && image -> colormap [ 0 ] . green == 0 && image -> colormap [ 0 ] . blue == 0 && image -> colormap [ 1 ] . red == 0 && image -> colormap [ 1 ] . green == 0 && image -> colormap [ 1 ] . blue == 0 ) { image -> colormap [ 1 ] . red = image -> colormap [ 1 ] . green = image -> colormap [ 1 ] . blue = QuantumRange ; } } if ( UnpackWPGRaster ( image , bpp ) < 0 ) { DecompressionFailed : ThrowReaderException ( CoderError , "UnableToDecompressImage" ) ; } if ( Rec . RecType == 0x14 && BitmapHeader2 . RotAngle != 0 && ! image_info -> ping ) { if ( BitmapHeader2 . RotAngle & 0x8000 ) { Image * flop_image ; flop_image = FlopImage ( image , exception ) ; if ( flop_image != ( Image * ) NULL ) { DuplicateBlob ( flop_image , image ) ; ReplaceImageInList ( & image , flop_image ) ; } } if ( BitmapHeader2 . RotAngle & 0x2000 ) { Image * flip_image ; flip_image = FlipImage ( image , exception ) ; if ( flip_image != ( Image * ) NULL ) { DuplicateBlob ( flip_image , image ) ; ReplaceImageInList ( & image , flip_image ) ; } } if ( BitmapHeader2 . RotAngle & 0x0FFF ) { Image * rotate_image ; rotate_image = RotateImage ( image , ( BitmapHeader2 . RotAngle & 0x0FFF ) , exception ) ; if ( rotate_image != ( Image * ) NULL ) { DuplicateBlob ( rotate_image , image ) ; ReplaceImageInList ( & image , rotate_image ) ; } } } AcquireNextImage ( image_info , image ) ; image -> depth = 8 ; if ( image -> next == ( Image * ) NULL ) goto Finish ; image = SyncNextImageInList ( image ) ; image -> columns = image -> rows = 1 ; image -> colors = 0 ; break ; case 0x1B : if ( Rec . RecordLength > 0x3C ) image = ExtractPostscript ( image , image_info , TellBlob ( image ) + 0x3C , ( ssize_t ) Rec . RecordLength - 0x3C , exception ) ; break ; } } break ; case 2 : ( void ) memset ( CTM , 0 , sizeof ( CTM ) ) ; StartWPG . PosSizePrecision = 0 ; while ( ! EOFBlob ( image ) ) { ( void ) SeekBlob ( image , Header . DataOffset , SEEK_SET ) ; if ( EOFBlob ( image ) ) break ; Rec2 . Class = ( i = ReadBlobByte ( image ) ) ; if ( i == EOF ) break ; Rec2 . RecType = ( i = ReadBlobByte ( image ) ) ; if ( i == EOF ) break ; Rd_WP_DWORD ( image , & Rec2 . Extension ) ; Rd_WP_DWORD ( image , & Rec2 . RecordLength ) ; if ( EOFBlob ( image ) ) break ; Header . DataOffset = TellBlob ( image ) + Rec2 . RecordLength ; switch ( Rec2 . RecType ) { case 1 : StartWPG . HorizontalUnits = ReadBlobLSBShort ( image ) ; StartWPG . VerticalUnits = ReadBlobLSBShort ( image ) ; StartWPG . PosSizePrecision = ReadBlobByte ( image ) ; break ; case 0x0C : WPG_Palette . StartIndex = ReadBlobLSBShort ( image ) ; WPG_Palette . NumOfEntries = ReadBlobLSBShort ( image ) ; if ( ( WPG_Palette . NumOfEntries - WPG_Palette . StartIndex ) > ( Rec2 . RecordLength - 2 - 2 ) / 3 ) ThrowReaderException ( CorruptImageError , "InvalidColormapIndex" ) ; image -> colors = WPG_Palette . NumOfEntries ; if ( AcquireImageColormap ( image , image -> colors ) == MagickFalse ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; for ( i = WPG_Palette . StartIndex ; i < ( int ) WPG_Palette . NumOfEntries ; i ++ ) { image -> colormap [ i ] . red = ScaleCharToQuantum ( ( char ) ReadBlobByte ( image ) ) ; image -> colormap [ i ] . green = ScaleCharToQuantum ( ( char ) ReadBlobByte ( image ) ) ; image -> colormap [ i ] . blue = ScaleCharToQuantum ( ( char ) ReadBlobByte ( image ) ) ; ( void ) ReadBlobByte ( image ) ; } break ; case 0x0E : Bitmap2Header1 . Width = ReadBlobLSBShort ( image ) ; Bitmap2Header1 . Height = ReadBlobLSBShort ( image ) ; if ( ( Bitmap2Header1 . Width == 0 ) || ( Bitmap2Header1 . Height == 0 ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; Bitmap2Header1 . Depth = ReadBlobByte ( image ) ; Bitmap2Header1 . Compression = ReadBlobByte ( image ) ; if ( Bitmap2Header1 . Compression > 1 ) continue ; switch ( Bitmap2Header1 . Depth ) { case 1 : bpp = 1 ; break ; case 2 : bpp = 2 ; break ; case 3 : bpp = 4 ; break ; case 4 : bpp = 8 ; break ; case 8 : bpp = 24 ; break ; default : continue ; } image -> columns = Bitmap2Header1 . Width ; image -> rows = Bitmap2Header1 . Height ; status = SetImageExtent ( image , image -> columns , image -> rows ) ; if ( status == MagickFalse ) break ; if ( ( image -> colors == 0 ) && ( bpp != 24 ) ) { size_t one ; one = 1 ; image -> colors = one << bpp ; if ( ! AcquireImageColormap ( image , image -> colors ) ) goto NoMemory ; } else { if ( bpp < 24 ) if ( image -> colors < ( one << bpp ) && bpp != 24 ) image -> colormap = ( PixelPacket * ) ResizeQuantumMemory ( image -> colormap , ( size_t ) ( one << bpp ) , sizeof ( * image -> colormap ) ) ; } switch ( Bitmap2Header1 . Compression ) { case 0 : { ldblk = ( ssize_t ) ( ( bpp * image -> columns + 7 ) / 8 ) ; BImgBuff = ( unsigned char * ) AcquireQuantumMemory ( ( size_t ) ldblk + 1 , sizeof ( * BImgBuff ) ) ; if ( BImgBuff == ( unsigned char * ) NULL ) goto NoMemory ; for ( i = 0 ; i < ( ssize_t ) image -> rows ; i ++ ) { ( void ) ReadBlob ( image , ldblk , BImgBuff ) ; InsertRow ( BImgBuff , i , image , bpp ) ; } if ( BImgBuff ) BImgBuff = ( unsigned char * ) RelinquishMagickMemory ( BImgBuff ) ; break ; } case 1 : { if ( UnpackWPG2Raster ( image , bpp ) < 0 ) goto DecompressionFailed ; break ; } } if ( CTM [ 0 ] [ 0 ] < 0 && ! image_info -> ping ) { Image * flop_image ; flop_image = FlopImage ( image , exception ) ; if ( flop_image != ( Image * ) NULL ) { DuplicateBlob ( flop_image , image ) ; ReplaceImageInList ( & image , flop_image ) ; } } if ( CTM [ 1 ] [ 1 ] < 0 && ! image_info -> ping ) { Image * flip_image ; flip_image = FlipImage ( image , exception ) ; if ( flip_image != ( Image * ) NULL ) { DuplicateBlob ( flip_image , image ) ; ReplaceImageInList ( & image , flip_image ) ; } } AcquireNextImage ( image_info , image ) ; image -> depth = 8 ; if ( image -> next == ( Image * ) NULL ) goto Finish ; image = SyncNextImageInList ( image ) ; image -> columns = image -> rows = 1 ; image -> colors = 0 ; break ; case 0x12 : i = ReadBlobLSBShort ( image ) ; if ( Rec2 . RecordLength > ( unsigned int ) i ) image = ExtractPostscript ( image , image_info , TellBlob ( image ) + i , ( ssize_t ) ( Rec2 . RecordLength - i - 2 ) , exception ) ; break ; case 0x1B : WPG2Flags = LoadWPG2Flags ( image , StartWPG . PosSizePrecision , NULL , & CTM ) ; ( void ) WPG2Flags ; break ; } } break ; default : { ThrowReaderException ( CoderError , "DataEncodingSchemeIsNotSupported" ) ; } } Finish : ( void ) CloseBlob ( image ) ; { Image * p ; ssize_t scene = 0 ; p = image ; image = NULL ; while ( p != ( Image * ) NULL ) { Image * tmp = p ; if ( ( p -> rows == 0 ) || ( p -> columns == 0 ) ) { p = p -> previous ; DeleteImageFromList ( & tmp ) ; } else { image = p ; p = p -> previous ; } } for ( p = image ; p != ( Image * ) NULL ; p = p -> next ) p -> scene = ( size_t ) scene ++ ; } if ( image == ( Image * ) NULL ) ThrowReaderException ( CorruptImageError , "ImageFileDoesNotContainAnyImageData" ) ; return ( image ) ; }
| <S2SV_ModStart> Rec . RecordLength ) ; if ( Rec . RecordLength > GetBlobSize ( image ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader"
| ImageMagick@ImageMagick/4eae304e773bad8a876c3c26fdffac24d4253ae4 | CVE-2017-14341 | https://github.com/ImageMagick/ImageMagick/commit/4eae304e773bad8a876c3c26fdffac24d4253ae4 | 2017-09-12T17:29Z |
10 | CWE-125 | CWE-125 static const u_char * ikev2_auth_print ( netdissect_options * ndo , u_char tpay , const struct isakmp_gen * ext , u_int item_len _U_ , const u_char * ep , uint32_t phase _U_ , uint32_t doi _U_ , uint32_t proto _U_ , int depth _U_ ) { struct ikev2_auth a ; const char * v2_auth [ ] = { "invalid" , "rsasig" , "shared-secret" , "dsssig" } ; const u_char * authdata = ( const u_char * ) ext + sizeof ( a ) ; unsigned int len ; <S2SV_StartBug> ND_TCHECK ( * ext ) ; <S2SV_EndBug> UNALIGNED_MEMCPY ( & a , ext , sizeof ( a ) ) ; ikev2_pay_print ( ndo , NPSTR ( tpay ) , a . h . critical ) ; len = ntohs ( a . h . len ) ; ND_PRINT ( ( ndo , "<S2SV_blank>len=%u<S2SV_blank>method=%s" , len - 4 , STR_OR_ID ( a . auth_method , v2_auth ) ) ) ; if ( len > 4 ) { if ( ndo -> ndo_vflag > 1 ) { ND_PRINT ( ( ndo , "<S2SV_blank>authdata=(" ) ) ; if ( ! rawprint ( ndo , ( const uint8_t * ) authdata , len - sizeof ( a ) ) ) goto trunc ; ND_PRINT ( ( ndo , ")<S2SV_blank>" ) ) ; } else if ( ndo -> ndo_vflag ) { if ( ! ike_show_somedata ( ndo , authdata , ep ) ) goto trunc ; } } return ( const u_char * ) ext + len ; trunc : ND_PRINT ( ( ndo , "<S2SV_blank>[|%s]" , NPSTR ( tpay ) ) ) ; return NULL ; }
| <S2SV_ModStart> int len ; ND_TCHECK2 ( * ext , sizeof ( a ) <S2SV_ModEnd> ) ; UNALIGNED_MEMCPY
| the-tcpdump-group@tcpdump/8dca25d26c7ca2caf6138267f6f17111212c156e | CVE-2017-13690 | https://github.com/the-tcpdump-group/tcpdump/commit/8dca25d26c7ca2caf6138267f6f17111212c156e | 2017-09-14T06:29Z |
11 | CWE-415 | CWE-415 static int netlink_dump ( struct sock * sk ) { struct netlink_sock * nlk = nlk_sk ( sk ) ; struct netlink_callback * cb ; struct sk_buff * skb = NULL ; struct nlmsghdr * nlh ; <S2SV_StartBug> int len , err = - ENOBUFS ; <S2SV_EndBug> int alloc_min_size ; int alloc_size ; mutex_lock ( nlk -> cb_mutex ) ; if ( ! nlk -> cb_running ) { err = - EINVAL ; goto errout_skb ; } if ( atomic_read ( & sk -> sk_rmem_alloc ) >= sk -> sk_rcvbuf ) goto errout_skb ; cb = & nlk -> cb ; alloc_min_size = max_t ( int , cb -> min_dump_alloc , NLMSG_GOODSIZE ) ; if ( alloc_min_size < nlk -> max_recvmsg_len ) { alloc_size = nlk -> max_recvmsg_len ; skb = alloc_skb ( alloc_size , GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY ) ; } if ( ! skb ) { alloc_size = alloc_min_size ; skb = alloc_skb ( alloc_size , GFP_KERNEL ) ; } if ( ! skb ) goto errout_skb ; skb_reserve ( skb , skb_tailroom ( skb ) - alloc_size ) ; netlink_skb_set_owner_r ( skb , sk ) ; len = cb -> dump ( skb , cb ) ; if ( len > 0 ) { mutex_unlock ( nlk -> cb_mutex ) ; if ( sk_filter ( sk , skb ) ) kfree_skb ( skb ) ; else __netlink_sendskb ( sk , skb ) ; return 0 ; } nlh = nlmsg_put_answer ( skb , cb , NLMSG_DONE , sizeof ( len ) , NLM_F_MULTI ) ; if ( ! nlh ) goto errout_skb ; nl_dump_check_consistent ( cb , nlh ) ; memcpy ( nlmsg_data ( nlh ) , & len , sizeof ( len ) ) ; if ( sk_filter ( sk , skb ) ) kfree_skb ( skb ) ; else __netlink_sendskb ( sk , skb ) ; if ( cb -> done ) cb -> done ( cb ) ; nlk -> cb_running = false ; <S2SV_StartBug> mutex_unlock ( nlk -> cb_mutex ) ; <S2SV_EndBug> <S2SV_StartBug> module_put ( cb -> module ) ; <S2SV_EndBug> <S2SV_StartBug> consume_skb ( cb -> skb ) ; <S2SV_EndBug> return 0 ; errout_skb : mutex_unlock ( nlk -> cb_mutex ) ; kfree_skb ( skb ) ; return err ; }
| <S2SV_ModStart> * nlh ; struct module * module ; <S2SV_ModStart> = false ; module = cb -> module ; skb = cb -> skb ; <S2SV_ModStart> ; module_put ( <S2SV_ModEnd> module ) ; <S2SV_ModStart> ; consume_skb ( <S2SV_ModEnd> skb ) ;
| torvalds@linux/92964c79b357efd980812c4de5c1fd2ec8bb5520 | CVE-2016-9806 | https://github.com/torvalds/linux/commit/92964c79b357efd980812c4de5c1fd2ec8bb5520 | 2016-12-28T07:59Z |
12 | CWE-269 | CWE-269 qboolean S_AL_Init ( soundInterface_t * si ) { # ifdef USE_OPENAL const char * device = NULL ; const char * inputdevice = NULL ; int i ; if ( ! si ) { return qfalse ; } for ( i = 0 ; i < MAX_RAW_STREAMS ; i ++ ) { streamSourceHandles [ i ] = - 1 ; streamPlaying [ i ] = qfalse ; streamSources [ i ] = 0 ; streamNumBuffers [ i ] = 0 ; streamBufIndex [ i ] = 0 ; } s_alPrecache = Cvar_Get ( "s_alPrecache" , "1" , CVAR_ARCHIVE ) ; s_alGain = Cvar_Get ( "s_alGain" , "1.0" , CVAR_ARCHIVE ) ; s_alSources = Cvar_Get ( "s_alSources" , "96" , CVAR_ARCHIVE ) ; s_alDopplerFactor = Cvar_Get ( "s_alDopplerFactor" , "1.0" , CVAR_ARCHIVE ) ; s_alDopplerSpeed = Cvar_Get ( "s_alDopplerSpeed" , "9000" , CVAR_ARCHIVE ) ; s_alMinDistance = Cvar_Get ( "s_alMinDistance" , "120" , CVAR_CHEAT ) ; s_alMaxDistance = Cvar_Get ( "s_alMaxDistance" , "1024" , CVAR_CHEAT ) ; s_alRolloff = Cvar_Get ( "s_alRolloff" , "2" , CVAR_CHEAT ) ; s_alGraceDistance = Cvar_Get ( "s_alGraceDistance" , "512" , CVAR_CHEAT ) ; <S2SV_StartBug> s_alDriver = Cvar_Get ( "s_alDriver" , ALDRIVER_DEFAULT , CVAR_ARCHIVE | CVAR_LATCH ) ; <S2SV_EndBug> s_alInputDevice = Cvar_Get ( "s_alInputDevice" , "" , CVAR_ARCHIVE | CVAR_LATCH ) ; <S2SV_StartBug> s_alDevice = Cvar_Get ( "s_alDevice" , "" , CVAR_ARCHIVE | CVAR_LATCH ) ; <S2SV_EndBug> if ( ! QAL_Init ( s_alDriver -> string ) ) { Com_Printf ( "Failed<S2SV_blank>to<S2SV_blank>load<S2SV_blank>library:<S2SV_blank>\\"%s\\".\\n" , s_alDriver -> string ) ; if ( ! Q_stricmp ( s_alDriver -> string , ALDRIVER_DEFAULT ) || ! QAL_Init ( ALDRIVER_DEFAULT ) ) { return qfalse ; } } device = s_alDevice -> string ; if ( device && ! * device ) device = NULL ; inputdevice = s_alInputDevice -> string ; if ( inputdevice && ! * inputdevice ) inputdevice = NULL ; enumeration_all_ext = qalcIsExtensionPresent ( NULL , "ALC_ENUMERATE_ALL_EXT" ) ; enumeration_ext = qalcIsExtensionPresent ( NULL , "ALC_ENUMERATION_EXT" ) ; if ( enumeration_ext || enumeration_all_ext ) { char devicenames [ 16384 ] = "" ; const char * devicelist ; # ifdef _WIN32 const char * defaultdevice ; # endif int curlen ; if ( enumeration_all_ext ) { devicelist = qalcGetString ( NULL , ALC_ALL_DEVICES_SPECIFIER ) ; # ifdef _WIN32 defaultdevice = qalcGetString ( NULL , ALC_DEFAULT_ALL_DEVICES_SPECIFIER ) ; # endif } else { devicelist = qalcGetString ( NULL , ALC_DEVICE_SPECIFIER ) ; # ifdef _WIN32 defaultdevice = qalcGetString ( NULL , ALC_DEFAULT_DEVICE_SPECIFIER ) ; # endif enumeration_ext = qtrue ; } # ifdef _WIN32 if ( ! device && defaultdevice && ! strcmp ( defaultdevice , "Generic<S2SV_blank>Hardware" ) ) device = "Generic<S2SV_blank>Software" ; # endif if ( devicelist ) { while ( ( curlen = strlen ( devicelist ) ) ) { Q_strcat ( devicenames , sizeof ( devicenames ) , devicelist ) ; Q_strcat ( devicenames , sizeof ( devicenames ) , "\\n" ) ; devicelist += curlen + 1 ; } } s_alAvailableDevices = Cvar_Get ( "s_alAvailableDevices" , devicenames , CVAR_ROM | CVAR_NORESTART ) ; } alDevice = qalcOpenDevice ( device ) ; if ( ! alDevice && device ) { Com_Printf ( "Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>OpenAL<S2SV_blank>device<S2SV_blank>\'%s\',<S2SV_blank>trying<S2SV_blank>default.\\n" , device ) ; alDevice = qalcOpenDevice ( NULL ) ; } if ( ! alDevice ) { QAL_Shutdown ( ) ; Com_Printf ( "Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>OpenAL<S2SV_blank>device.\\n" ) ; return qfalse ; } alContext = qalcCreateContext ( alDevice , NULL ) ; if ( ! alContext ) { QAL_Shutdown ( ) ; qalcCloseDevice ( alDevice ) ; Com_Printf ( "Failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>OpenAL<S2SV_blank>context.\\n" ) ; return qfalse ; } qalcMakeContextCurrent ( alContext ) ; S_AL_BufferInit ( ) ; S_AL_SrcInit ( ) ; qalDistanceModel ( AL_INVERSE_DISTANCE_CLAMPED ) ; qalDopplerFactor ( s_alDopplerFactor -> value ) ; qalSpeedOfSound ( s_alDopplerSpeed -> value ) ; # ifdef USE_VOIP s_alCapture = Cvar_Get ( "s_alCapture" , "1" , CVAR_ARCHIVE | CVAR_LATCH ) ; if ( ! s_alCapture -> integer ) { Com_Printf ( "OpenAL<S2SV_blank>capture<S2SV_blank>support<S2SV_blank>disabled<S2SV_blank>by<S2SV_blank>user<S2SV_blank>(\'+set<S2SV_blank>s_alCapture<S2SV_blank>1\'<S2SV_blank>to<S2SV_blank>enable)\\n" ) ; } # if USE_MUMBLE else if ( cl_useMumble -> integer ) { Com_Printf ( "OpenAL<S2SV_blank>capture<S2SV_blank>support<S2SV_blank>disabled<S2SV_blank>for<S2SV_blank>Mumble<S2SV_blank>support\\n" ) ; } # endif else { # ifdef __APPLE__ if ( qalcCaptureOpenDevice == NULL ) # else if ( ! qalcIsExtensionPresent ( NULL , "ALC_EXT_capture" ) ) # endif { Com_Printf ( "No<S2SV_blank>ALC_EXT_capture<S2SV_blank>support,<S2SV_blank>can\'t<S2SV_blank>record<S2SV_blank>audio.\\n" ) ; } else { char inputdevicenames [ 16384 ] = "" ; const char * inputdevicelist ; const char * defaultinputdevice ; int curlen ; capture_ext = qtrue ; inputdevicelist = qalcGetString ( NULL , ALC_CAPTURE_DEVICE_SPECIFIER ) ; defaultinputdevice = qalcGetString ( NULL , ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER ) ; if ( inputdevicelist ) { while ( ( curlen = strlen ( inputdevicelist ) ) ) { Q_strcat ( inputdevicenames , sizeof ( inputdevicenames ) , inputdevicelist ) ; Q_strcat ( inputdevicenames , sizeof ( inputdevicenames ) , "\\n" ) ; inputdevicelist += curlen + 1 ; } } s_alAvailableInputDevices = Cvar_Get ( "s_alAvailableInputDevices" , inputdevicenames , CVAR_ROM | CVAR_NORESTART ) ; Com_Printf ( "OpenAL<S2SV_blank>default<S2SV_blank>capture<S2SV_blank>device<S2SV_blank>is<S2SV_blank>\'%s\'\\n" , defaultinputdevice ? defaultinputdevice : "none" ) ; alCaptureDevice = qalcCaptureOpenDevice ( inputdevice , 48000 , AL_FORMAT_MONO16 , VOIP_MAX_PACKET_SAMPLES * 4 ) ; if ( ! alCaptureDevice && inputdevice ) { Com_Printf ( "Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>OpenAL<S2SV_blank>Input<S2SV_blank>device<S2SV_blank>\'%s\',<S2SV_blank>trying<S2SV_blank>default.\\n" , inputdevice ) ; alCaptureDevice = qalcCaptureOpenDevice ( NULL , 48000 , AL_FORMAT_MONO16 , VOIP_MAX_PACKET_SAMPLES * 4 ) ; } Com_Printf ( "OpenAL<S2SV_blank>capture<S2SV_blank>device<S2SV_blank>%s.\\n" , ( alCaptureDevice == NULL ) ? "failed<S2SV_blank>to<S2SV_blank>open" : "opened" ) ; } } # endif si -> Shutdown = S_AL_Shutdown ; si -> StartSound = S_AL_StartSound ; si -> StartLocalSound = S_AL_StartLocalSound ; si -> StartBackgroundTrack = S_AL_StartBackgroundTrack ; si -> StopBackgroundTrack = S_AL_StopBackgroundTrack ; si -> RawSamples = S_AL_RawSamples ; si -> StopAllSounds = S_AL_StopAllSounds ; si -> ClearLoopingSounds = S_AL_ClearLoopingSounds ; si -> AddLoopingSound = S_AL_AddLoopingSound ; si -> AddRealLoopingSound = S_AL_AddRealLoopingSound ; si -> StopLoopingSound = S_AL_StopLoopingSound ; si -> Respatialize = S_AL_Respatialize ; si -> UpdateEntityPosition = S_AL_UpdateEntityPosition ; si -> Update = S_AL_Update ; si -> DisableSounds = S_AL_DisableSounds ; si -> BeginRegistration = S_AL_BeginRegistration ; si -> RegisterSound = S_AL_RegisterSound ; si -> ClearSoundBuffer = S_AL_ClearSoundBuffer ; si -> SoundInfo = S_AL_SoundInfo ; si -> SoundList = S_AL_SoundList ; # ifdef USE_VOIP si -> StartCapture = S_AL_StartCapture ; si -> AvailableCaptureSamples = S_AL_AvailableCaptureSamples ; si -> Capture = S_AL_Capture ; si -> StopCapture = S_AL_StopCapture ; si -> MasterGain = S_AL_MasterGain ; # endif return qtrue ; # else return qfalse ; # endif }
| <S2SV_ModStart> CVAR_ARCHIVE | CVAR_LATCH | CVAR_PROTECTED <S2SV_ModStart> CVAR_LATCH ) ; if ( COM_CompareExtension ( s_alDriver -> string , ".pk3" ) ) { Com_Printf ( "Rejecting<S2SV_blank>DLL<S2SV_blank>named<S2SV_blank>\\"%s\\"" , s_alDriver -> string ) ; return qfalse ; }
| ioquake@ioq3/f61fe5f6a0419ef4a88d46a128052f2e8352e85d | CVE-2017-6903 | https://github.com/ioquake/ioq3/commit/f61fe5f6a0419ef4a88d46a128052f2e8352e85d | 2017-03-14T22:59Z |
13 | CWE-20 | CWE-20 int HTMLtagproc1 ( struct parsed_tag * tag , struct html_feed_environ * h_env ) { char * p , * q , * r ; int i , w , x , y , z , count , width ; struct readbuffer * obuf = h_env -> obuf ; struct environment * envs = h_env -> envs ; Str tmp ; int hseq ; int cmd ; # ifdef ID_EXT char * id = NULL ; # endif cmd = tag -> tagid ; if ( obuf -> flag & RB_PRE ) { switch ( cmd ) { case HTML_NOBR : case HTML_N_NOBR : case HTML_PRE_INT : case HTML_N_PRE_INT : return 1 ; } } switch ( cmd ) { case HTML_B : obuf -> in_bold ++ ; if ( obuf -> in_bold > 1 ) return 1 ; return 0 ; case HTML_N_B : if ( obuf -> in_bold == 1 && close_effect0 ( obuf , HTML_B ) ) obuf -> in_bold = 0 ; if ( obuf -> in_bold > 0 ) { obuf -> in_bold -- ; if ( obuf -> in_bold == 0 ) return 0 ; } return 1 ; case HTML_I : obuf -> in_italic ++ ; if ( obuf -> in_italic > 1 ) return 1 ; return 0 ; case HTML_N_I : if ( obuf -> in_italic == 1 && close_effect0 ( obuf , HTML_I ) ) obuf -> in_italic = 0 ; if ( obuf -> in_italic > 0 ) { obuf -> in_italic -- ; if ( obuf -> in_italic == 0 ) return 0 ; } return 1 ; case HTML_U : obuf -> in_under ++ ; if ( obuf -> in_under > 1 ) return 1 ; return 0 ; case HTML_N_U : if ( obuf -> in_under == 1 && close_effect0 ( obuf , HTML_U ) ) obuf -> in_under = 0 ; if ( obuf -> in_under > 0 ) { obuf -> in_under -- ; if ( obuf -> in_under == 0 ) return 0 ; } return 1 ; case HTML_EM : HTMLlineproc1 ( "<i>" , h_env ) ; return 1 ; case HTML_N_EM : HTMLlineproc1 ( "</i>" , h_env ) ; return 1 ; case HTML_STRONG : HTMLlineproc1 ( "<b>" , h_env ) ; return 1 ; case HTML_N_STRONG : HTMLlineproc1 ( "</b>" , h_env ) ; return 1 ; case HTML_Q : HTMLlineproc1 ( "`" , h_env ) ; return 1 ; case HTML_N_Q : HTMLlineproc1 ( "\'" , h_env ) ; return 1 ; case HTML_P : case HTML_N_P : CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 1 , h_env -> limit ) ; do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; } obuf -> flag |= RB_IGNORE_P ; if ( cmd == HTML_P ) { set_alignment ( obuf , tag ) ; obuf -> flag |= RB_P ; } return 1 ; case HTML_BR : flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 1 , h_env -> limit ) ; h_env -> blank_lines = 0 ; return 1 ; case HTML_H : if ( ! ( obuf -> flag & ( RB_PREMODE | RB_IGNORE_P ) ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; } HTMLlineproc1 ( "<b>" , h_env ) ; set_alignment ( obuf , tag ) ; return 1 ; case HTML_N_H : HTMLlineproc1 ( "</b>" , h_env ) ; if ( ! ( obuf -> flag & RB_PREMODE ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; } do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; RB_RESTORE_FLAG ( obuf ) ; close_anchor ( h_env , obuf ) ; obuf -> flag |= RB_IGNORE_P ; return 1 ; case HTML_UL : case HTML_OL : case HTML_BLQ : CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; if ( ! ( obuf -> flag & RB_PREMODE ) && ( h_env -> envc == 0 || cmd == HTML_BLQ ) ) do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; } PUSH_ENV ( cmd ) ; if ( cmd == HTML_UL || cmd == HTML_OL ) { if ( parsedtag_get_value ( tag , ATTR_START , & count ) ) { envs [ h_env -> envc ] . count = count - 1 ; } } if ( cmd == HTML_OL ) { envs [ h_env -> envc ] . type = '1' ; if ( parsedtag_get_value ( tag , ATTR_TYPE , & p ) ) { envs [ h_env -> envc ] . type = ( int ) * p ; } } if ( cmd == HTML_UL ) envs [ h_env -> envc ] . type = ul_type ( tag , 0 ) ; flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; return 1 ; case HTML_N_UL : case HTML_N_OL : case HTML_N_DL : case HTML_N_BLQ : CLOSE_DT ; CLOSE_A ; if ( h_env -> envc > 0 ) { flushline ( h_env , obuf , envs [ h_env -> envc - 1 ] . indent , 0 , h_env -> limit ) ; POP_ENV ; if ( ! ( obuf -> flag & RB_PREMODE ) && ( h_env -> envc == 0 || cmd == HTML_N_DL || cmd == HTML_N_BLQ ) ) { do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , INDENT_INCR , h_env -> limit ) ; obuf -> flag |= RB_IGNORE_P ; } } close_anchor ( h_env , obuf ) ; return 1 ; case HTML_DL : CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; if ( ! ( obuf -> flag & RB_PREMODE ) ) do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; } PUSH_ENV ( cmd ) ; if ( parsedtag_exists ( tag , ATTR_COMPACT ) ) envs [ h_env -> envc ] . env = HTML_DL_COMPACT ; obuf -> flag |= RB_IGNORE_P ; return 1 ; case HTML_LI : CLOSE_A ; CLOSE_DT ; if ( h_env -> envc > 0 ) { Str num ; flushline ( h_env , obuf , envs [ h_env -> envc - 1 ] . indent , 0 , h_env -> limit ) ; envs [ h_env -> envc ] . count ++ ; if ( parsedtag_get_value ( tag , ATTR_VALUE , & p ) ) { count = atoi ( p ) ; if ( count > 0 ) envs [ h_env -> envc ] . count = count ; else envs [ h_env -> envc ] . count = 0 ; } switch ( envs [ h_env -> envc ] . env ) { case HTML_UL : envs [ h_env -> envc ] . type = ul_type ( tag , envs [ h_env -> envc ] . type ) ; for ( i = 0 ; i < INDENT_INCR - 3 ; i ++ ) push_charp ( obuf , 1 , NBSP , PC_ASCII ) ; tmp = Strnew ( ) ; switch ( envs [ h_env -> envc ] . type ) { case 'd' : push_symbol ( tmp , UL_SYMBOL_DISC , symbol_width , 1 ) ; break ; case 'c' : push_symbol ( tmp , UL_SYMBOL_CIRCLE , symbol_width , 1 ) ; break ; case 's' : push_symbol ( tmp , UL_SYMBOL_SQUARE , symbol_width , 1 ) ; break ; default : push_symbol ( tmp , UL_SYMBOL ( ( h_env -> envc_real - 1 ) % MAX_UL_LEVEL ) , symbol_width , 1 ) ; break ; } if ( symbol_width == 1 ) push_charp ( obuf , 1 , NBSP , PC_ASCII ) ; push_str ( obuf , symbol_width , tmp , PC_ASCII ) ; push_charp ( obuf , 1 , NBSP , PC_ASCII ) ; set_space_to_prevchar ( obuf -> prevchar ) ; break ; case HTML_OL : if ( parsedtag_get_value ( tag , ATTR_TYPE , & p ) ) envs [ h_env -> envc ] . type = ( int ) * p ; switch ( ( envs [ h_env -> envc ] . count > 0 ) ? envs [ h_env -> envc ] . type : '1' ) { case 'i' : num = romanNumeral ( envs [ h_env -> envc ] . count ) ; break ; case 'I' : num = romanNumeral ( envs [ h_env -> envc ] . count ) ; Strupper ( num ) ; break ; case 'a' : num = romanAlphabet ( envs [ h_env -> envc ] . count ) ; break ; case 'A' : num = romanAlphabet ( envs [ h_env -> envc ] . count ) ; Strupper ( num ) ; break ; default : num = Sprintf ( "%d" , envs [ h_env -> envc ] . count ) ; break ; } if ( INDENT_INCR >= 4 ) Strcat_charp ( num , ".<S2SV_blank>" ) ; else Strcat_char ( num , '.' ) ; push_spaces ( obuf , 1 , INDENT_INCR - num -> length ) ; push_str ( obuf , num -> length , num , PC_ASCII ) ; if ( INDENT_INCR >= 4 ) set_space_to_prevchar ( obuf -> prevchar ) ; break ; default : push_spaces ( obuf , 1 , INDENT_INCR ) ; break ; } } else { flushline ( h_env , obuf , 0 , 0 , h_env -> limit ) ; } obuf -> flag |= RB_IGNORE_P ; return 1 ; case HTML_DT : CLOSE_A ; if ( h_env -> envc == 0 || ( h_env -> envc_real < h_env -> nenv && envs [ h_env -> envc ] . env != HTML_DL && envs [ h_env -> envc ] . env != HTML_DL_COMPACT ) ) { PUSH_ENV ( HTML_DL ) ; } if ( h_env -> envc > 0 ) { flushline ( h_env , obuf , envs [ h_env -> envc - 1 ] . indent , 0 , h_env -> limit ) ; } if ( ! ( obuf -> flag & RB_IN_DT ) ) { HTMLlineproc1 ( "<b>" , h_env ) ; obuf -> flag |= RB_IN_DT ; } obuf -> flag |= RB_IGNORE_P ; return 1 ; case HTML_DD : CLOSE_A ; CLOSE_DT ; <S2SV_StartBug> if ( envs [ h_env -> envc ] . env == HTML_DL_COMPACT ) { <S2SV_EndBug> if ( obuf -> pos > envs [ h_env -> envc ] . indent ) flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; else push_spaces ( obuf , 1 , envs [ h_env -> envc ] . indent - obuf -> pos ) ; } else flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; return 1 ; case HTML_TITLE : close_anchor ( h_env , obuf ) ; process_title ( tag ) ; obuf -> flag |= RB_TITLE ; obuf -> end_tag = HTML_N_TITLE ; return 1 ; case HTML_N_TITLE : if ( ! ( obuf -> flag & RB_TITLE ) ) return 1 ; obuf -> flag &= ~ RB_TITLE ; obuf -> end_tag = 0 ; tmp = process_n_title ( tag ) ; if ( tmp ) HTMLlineproc1 ( tmp -> ptr , h_env ) ; return 1 ; case HTML_TITLE_ALT : if ( parsedtag_get_value ( tag , ATTR_TITLE , & p ) ) h_env -> title = html_unquote ( p ) ; return 0 ; case HTML_FRAMESET : PUSH_ENV ( cmd ) ; push_charp ( obuf , 9 , "--FRAME--" , PC_ASCII ) ; flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; return 0 ; case HTML_N_FRAMESET : if ( h_env -> envc > 0 ) { POP_ENV ; flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; } return 0 ; case HTML_NOFRAMES : CLOSE_A ; flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; obuf -> flag |= ( RB_NOFRAMES | RB_IGNORE_P ) ; return 1 ; case HTML_N_NOFRAMES : CLOSE_A ; flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; obuf -> flag &= ~ RB_NOFRAMES ; return 1 ; case HTML_FRAME : q = r = NULL ; parsedtag_get_value ( tag , ATTR_SRC , & q ) ; parsedtag_get_value ( tag , ATTR_NAME , & r ) ; if ( q ) { q = html_quote ( q ) ; push_tag ( obuf , Sprintf ( "<a<S2SV_blank>hseq=\\"%d\\"<S2SV_blank>href=\\"%s\\">" , cur_hseq ++ , q ) -> ptr , HTML_A ) ; if ( r ) q = html_quote ( r ) ; push_charp ( obuf , get_strwidth ( q ) , q , PC_ASCII ) ; push_tag ( obuf , "</a>" , HTML_N_A ) ; } flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; return 0 ; case HTML_HR : close_anchor ( h_env , obuf ) ; tmp = process_hr ( tag , h_env -> limit , envs [ h_env -> envc ] . indent ) ; HTMLlineproc1 ( tmp -> ptr , h_env ) ; set_space_to_prevchar ( obuf -> prevchar ) ; return 1 ; case HTML_PRE : x = parsedtag_exists ( tag , ATTR_FOR_TABLE ) ; CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; if ( ! x ) do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; } else fillline ( obuf , envs [ h_env -> envc ] . indent ) ; obuf -> flag |= ( RB_PRE | RB_IGNORE_P ) ; return 1 ; case HTML_N_PRE : flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) { do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; obuf -> flag |= RB_IGNORE_P ; h_env -> blank_lines ++ ; } obuf -> flag &= ~ RB_PRE ; close_anchor ( h_env , obuf ) ; return 1 ; case HTML_PRE_INT : i = obuf -> line -> length ; append_tags ( obuf ) ; if ( ! ( obuf -> flag & RB_SPECIAL ) ) { set_breakpoint ( obuf , obuf -> line -> length - i ) ; } obuf -> flag |= RB_PRE_INT ; return 0 ; case HTML_N_PRE_INT : push_tag ( obuf , "</pre_int>" , HTML_N_PRE_INT ) ; obuf -> flag &= ~ RB_PRE_INT ; if ( ! ( obuf -> flag & RB_SPECIAL ) && obuf -> pos > obuf -> bp . pos ) { set_prevchar ( obuf -> prevchar , "" , 0 ) ; obuf -> prev_ctype = PC_CTRL ; } return 1 ; case HTML_NOBR : obuf -> flag |= RB_NOBR ; obuf -> nobr_level ++ ; return 0 ; case HTML_N_NOBR : if ( obuf -> nobr_level > 0 ) obuf -> nobr_level -- ; if ( obuf -> nobr_level == 0 ) obuf -> flag &= ~ RB_NOBR ; return 0 ; case HTML_PRE_PLAIN : CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; } obuf -> flag |= ( RB_PRE | RB_IGNORE_P ) ; return 1 ; case HTML_N_PRE_PLAIN : CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; obuf -> flag |= RB_IGNORE_P ; } obuf -> flag &= ~ RB_PRE ; return 1 ; case HTML_LISTING : case HTML_XMP : case HTML_PLAINTEXT : CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; } obuf -> flag |= ( RB_PLAIN | RB_IGNORE_P ) ; switch ( cmd ) { case HTML_LISTING : obuf -> end_tag = HTML_N_LISTING ; break ; case HTML_XMP : obuf -> end_tag = HTML_N_XMP ; break ; case HTML_PLAINTEXT : obuf -> end_tag = MAX_HTMLTAG ; break ; } return 1 ; case HTML_N_LISTING : case HTML_N_XMP : CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) { flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; obuf -> flag |= RB_IGNORE_P ; } obuf -> flag &= ~ RB_PLAIN ; obuf -> end_tag = 0 ; return 1 ; case HTML_SCRIPT : obuf -> flag |= RB_SCRIPT ; obuf -> end_tag = HTML_N_SCRIPT ; return 1 ; case HTML_STYLE : obuf -> flag |= RB_STYLE ; obuf -> end_tag = HTML_N_STYLE ; return 1 ; case HTML_N_SCRIPT : obuf -> flag &= ~ RB_SCRIPT ; obuf -> end_tag = 0 ; return 1 ; case HTML_N_STYLE : obuf -> flag &= ~ RB_STYLE ; obuf -> end_tag = 0 ; return 1 ; case HTML_A : if ( obuf -> anchor . url ) close_anchor ( h_env , obuf ) ; hseq = 0 ; if ( parsedtag_get_value ( tag , ATTR_HREF , & p ) ) obuf -> anchor . url = Strnew_charp ( p ) -> ptr ; if ( parsedtag_get_value ( tag , ATTR_TARGET , & p ) ) obuf -> anchor . target = Strnew_charp ( p ) -> ptr ; if ( parsedtag_get_value ( tag , ATTR_REFERER , & p ) ) obuf -> anchor . referer = Strnew_charp ( p ) -> ptr ; if ( parsedtag_get_value ( tag , ATTR_TITLE , & p ) ) obuf -> anchor . title = Strnew_charp ( p ) -> ptr ; if ( parsedtag_get_value ( tag , ATTR_ACCESSKEY , & p ) ) obuf -> anchor . accesskey = ( unsigned char ) * p ; if ( parsedtag_get_value ( tag , ATTR_HSEQ , & hseq ) ) obuf -> anchor . hseq = hseq ; if ( hseq == 0 && obuf -> anchor . url ) { obuf -> anchor . hseq = cur_hseq ; tmp = process_anchor ( tag , h_env -> tagbuf -> ptr ) ; push_tag ( obuf , tmp -> ptr , HTML_A ) ; if ( displayLinkNumber ) HTMLlineproc1 ( getLinkNumberStr ( - 1 ) -> ptr , h_env ) ; return 1 ; } return 0 ; case HTML_N_A : close_anchor ( h_env , obuf ) ; return 1 ; case HTML_IMG : tmp = process_img ( tag , h_env -> limit ) ; HTMLlineproc1 ( tmp -> ptr , h_env ) ; return 1 ; case HTML_IMG_ALT : if ( parsedtag_get_value ( tag , ATTR_SRC , & p ) ) obuf -> img_alt = Strnew_charp ( p ) ; # ifdef USE_IMAGE i = 0 ; if ( parsedtag_get_value ( tag , ATTR_TOP_MARGIN , & i ) ) { if ( i > obuf -> top_margin ) obuf -> top_margin = i ; } i = 0 ; if ( parsedtag_get_value ( tag , ATTR_BOTTOM_MARGIN , & i ) ) { if ( i > obuf -> bottom_margin ) obuf -> bottom_margin = i ; } # endif return 0 ; case HTML_N_IMG_ALT : if ( obuf -> img_alt ) { if ( ! close_effect0 ( obuf , HTML_IMG_ALT ) ) push_tag ( obuf , "</img_alt>" , HTML_N_IMG_ALT ) ; obuf -> img_alt = NULL ; } return 1 ; case HTML_INPUT_ALT : i = 0 ; if ( parsedtag_get_value ( tag , ATTR_TOP_MARGIN , & i ) ) { if ( i > obuf -> top_margin ) obuf -> top_margin = i ; } i = 0 ; if ( parsedtag_get_value ( tag , ATTR_BOTTOM_MARGIN , & i ) ) { if ( i > obuf -> bottom_margin ) obuf -> bottom_margin = i ; } if ( parsedtag_get_value ( tag , ATTR_HSEQ , & hseq ) ) { obuf -> input_alt . hseq = hseq ; } if ( parsedtag_get_value ( tag , ATTR_FID , & i ) ) { obuf -> input_alt . fid = i ; } if ( parsedtag_get_value ( tag , ATTR_TYPE , & p ) ) { obuf -> input_alt . type = Strnew_charp ( p ) ; } if ( parsedtag_get_value ( tag , ATTR_VALUE , & p ) ) { obuf -> input_alt . value = Strnew_charp ( p ) ; } if ( parsedtag_get_value ( tag , ATTR_NAME , & p ) ) { obuf -> input_alt . name = Strnew_charp ( p ) ; } obuf -> input_alt . in = 1 ; return 0 ; case HTML_N_INPUT_ALT : if ( obuf -> input_alt . in ) { if ( ! close_effect0 ( obuf , HTML_INPUT_ALT ) ) push_tag ( obuf , "</input_alt>" , HTML_N_INPUT_ALT ) ; obuf -> input_alt . hseq = 0 ; obuf -> input_alt . fid = - 1 ; obuf -> input_alt . in = 0 ; obuf -> input_alt . type = NULL ; obuf -> input_alt . name = NULL ; obuf -> input_alt . value = NULL ; } return 1 ; case HTML_TABLE : close_anchor ( h_env , obuf ) ; obuf -> table_level ++ ; if ( obuf -> table_level >= MAX_TABLE ) break ; w = BORDER_NONE ; x = 2 ; y = 1 ; z = 0 ; width = 0 ; if ( parsedtag_exists ( tag , ATTR_BORDER ) ) { if ( parsedtag_get_value ( tag , ATTR_BORDER , & w ) ) { if ( w > 2 ) w = BORDER_THICK ; else if ( w < 0 ) { w = BORDER_THIN ; } } else w = BORDER_THIN ; } if ( DisplayBorders && w == BORDER_NONE ) w = BORDER_THIN ; if ( parsedtag_get_value ( tag , ATTR_WIDTH , & i ) ) { if ( obuf -> table_level == 0 ) width = REAL_WIDTH ( i , h_env -> limit - envs [ h_env -> envc ] . indent ) ; else width = RELATIVE_WIDTH ( i ) ; } if ( parsedtag_exists ( tag , ATTR_HBORDER ) ) w = BORDER_NOWIN ; # define MAX_CELLSPACING 1000 # define MAX_CELLPADDING 1000 # define MAX_VSPACE 1000 parsedtag_get_value ( tag , ATTR_CELLSPACING , & x ) ; parsedtag_get_value ( tag , ATTR_CELLPADDING , & y ) ; parsedtag_get_value ( tag , ATTR_VSPACE , & z ) ; if ( x > MAX_CELLSPACING ) x = MAX_CELLSPACING ; if ( y > MAX_CELLPADDING ) y = MAX_CELLPADDING ; if ( z > MAX_VSPACE ) z = MAX_VSPACE ; # ifdef ID_EXT parsedtag_get_value ( tag , ATTR_ID , & id ) ; # endif tables [ obuf -> table_level ] = begin_table ( w , x , y , z ) ; # ifdef ID_EXT if ( id != NULL ) tables [ obuf -> table_level ] -> id = Strnew_charp ( id ) ; # endif table_mode [ obuf -> table_level ] . pre_mode = 0 ; table_mode [ obuf -> table_level ] . indent_level = 0 ; table_mode [ obuf -> table_level ] . nobr_level = 0 ; table_mode [ obuf -> table_level ] . caption = 0 ; table_mode [ obuf -> table_level ] . end_tag = 0 ; # ifndef TABLE_EXPAND tables [ obuf -> table_level ] -> total_width = width ; # else tables [ obuf -> table_level ] -> real_width = width ; tables [ obuf -> table_level ] -> total_width = 0 ; # endif return 1 ; case HTML_N_TABLE : return 1 ; case HTML_CENTER : CLOSE_A ; if ( ! ( obuf -> flag & ( RB_PREMODE | RB_IGNORE_P ) ) ) flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; RB_SAVE_FLAG ( obuf ) ; RB_SET_ALIGN ( obuf , RB_CENTER ) ; return 1 ; case HTML_N_CENTER : CLOSE_A ; if ( ! ( obuf -> flag & RB_PREMODE ) ) flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; RB_RESTORE_FLAG ( obuf ) ; return 1 ; case HTML_DIV : CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; set_alignment ( obuf , tag ) ; return 1 ; case HTML_N_DIV : CLOSE_A ; flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; RB_RESTORE_FLAG ( obuf ) ; return 1 ; case HTML_DIV_INT : CLOSE_P ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; set_alignment ( obuf , tag ) ; return 1 ; case HTML_N_DIV_INT : CLOSE_P ; flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; RB_RESTORE_FLAG ( obuf ) ; return 1 ; case HTML_FORM : CLOSE_A ; if ( ! ( obuf -> flag & RB_IGNORE_P ) ) flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; tmp = process_form ( tag ) ; if ( tmp ) HTMLlineproc1 ( tmp -> ptr , h_env ) ; return 1 ; case HTML_N_FORM : CLOSE_A ; flushline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; obuf -> flag |= RB_IGNORE_P ; process_n_form ( ) ; return 1 ; case HTML_INPUT : close_anchor ( h_env , obuf ) ; tmp = process_input ( tag ) ; if ( tmp ) HTMLlineproc1 ( tmp -> ptr , h_env ) ; return 1 ; case HTML_BUTTON : tmp = process_button ( tag ) ; if ( tmp ) HTMLlineproc1 ( tmp -> ptr , h_env ) ; return 1 ; case HTML_N_BUTTON : tmp = process_n_button ( ) ; if ( tmp ) HTMLlineproc1 ( tmp -> ptr , h_env ) ; return 1 ; case HTML_SELECT : close_anchor ( h_env , obuf ) ; tmp = process_select ( tag ) ; if ( tmp ) HTMLlineproc1 ( tmp -> ptr , h_env ) ; obuf -> flag |= RB_INSELECT ; obuf -> end_tag = HTML_N_SELECT ; return 1 ; case HTML_N_SELECT : obuf -> flag &= ~ RB_INSELECT ; obuf -> end_tag = 0 ; tmp = process_n_select ( ) ; if ( tmp ) HTMLlineproc1 ( tmp -> ptr , h_env ) ; return 1 ; case HTML_OPTION : return 1 ; case HTML_TEXTAREA : close_anchor ( h_env , obuf ) ; tmp = process_textarea ( tag , h_env -> limit ) ; if ( tmp ) HTMLlineproc1 ( tmp -> ptr , h_env ) ; obuf -> flag |= RB_INTXTA ; obuf -> end_tag = HTML_N_TEXTAREA ; return 1 ; case HTML_N_TEXTAREA : obuf -> flag &= ~ RB_INTXTA ; obuf -> end_tag = 0 ; tmp = process_n_textarea ( ) ; if ( tmp ) HTMLlineproc1 ( tmp -> ptr , h_env ) ; return 1 ; case HTML_ISINDEX : p = "" ; q = "!CURRENT_URL!" ; parsedtag_get_value ( tag , ATTR_PROMPT , & p ) ; parsedtag_get_value ( tag , ATTR_ACTION , & q ) ; tmp = Strnew_m_charp ( "<form<S2SV_blank>method=get<S2SV_blank>action=\\"" , html_quote ( q ) , "\\">" , html_quote ( p ) , "<input<S2SV_blank>type=text<S2SV_blank>name=\\"\\"<S2SV_blank>accept></form>" , NULL ) ; HTMLlineproc1 ( tmp -> ptr , h_env ) ; return 1 ; case HTML_META : p = q = r = NULL ; parsedtag_get_value ( tag , ATTR_HTTP_EQUIV , & p ) ; parsedtag_get_value ( tag , ATTR_CONTENT , & q ) ; # ifdef USE_M17N parsedtag_get_value ( tag , ATTR_CHARSET , & r ) ; if ( r ) { SKIP_BLANKS ( r ) ; meta_charset = wc_guess_charset ( r , 0 ) ; } else if ( p && q && ! strcasecmp ( p , "Content-Type" ) && ( q = strcasestr ( q , "charset" ) ) != NULL ) { q += 7 ; SKIP_BLANKS ( q ) ; if ( * q == '=' ) { q ++ ; SKIP_BLANKS ( q ) ; meta_charset = wc_guess_charset ( q , 0 ) ; } } else # endif if ( p && q && ! strcasecmp ( p , "refresh" ) ) { int refresh_interval ; tmp = NULL ; refresh_interval = getMetaRefreshParam ( q , & tmp ) ; if ( tmp ) { q = html_quote ( tmp -> ptr ) ; tmp = Sprintf ( "Refresh<S2SV_blank>(%d<S2SV_blank>sec)<S2SV_blank><a<S2SV_blank>href=\\"%s\\">%s</a>" , refresh_interval , q , q ) ; } else if ( refresh_interval > 0 ) tmp = Sprintf ( "Refresh<S2SV_blank>(%d<S2SV_blank>sec)" , refresh_interval ) ; if ( tmp ) { HTMLlineproc1 ( tmp -> ptr , h_env ) ; do_blankline ( h_env , obuf , envs [ h_env -> envc ] . indent , 0 , h_env -> limit ) ; if ( ! is_redisplay && ! ( ( obuf -> flag & RB_NOFRAMES ) && RenderFrame ) ) { tag -> need_reconstruct = TRUE ; return 0 ; } } } return 1 ; case HTML_BASE : # if defined ( USE_M17N ) || defined ( USE_IMAGE ) p = NULL ; if ( parsedtag_get_value ( tag , ATTR_HREF , & p ) ) { cur_baseURL = New ( ParsedURL ) ; parseURL ( p , cur_baseURL , NULL ) ; } # endif case HTML_MAP : case HTML_N_MAP : case HTML_AREA : return 0 ; case HTML_DEL : switch ( displayInsDel ) { case DISPLAY_INS_DEL_SIMPLE : obuf -> flag |= RB_DEL ; break ; case DISPLAY_INS_DEL_NORMAL : HTMLlineproc1 ( "<U>[DEL:</U>" , h_env ) ; break ; case DISPLAY_INS_DEL_FONTIFY : obuf -> in_strike ++ ; if ( obuf -> in_strike == 1 ) { push_tag ( obuf , "<s>" , HTML_S ) ; } break ; } return 1 ; case HTML_N_DEL : switch ( displayInsDel ) { case DISPLAY_INS_DEL_SIMPLE : obuf -> flag &= ~ RB_DEL ; break ; case DISPLAY_INS_DEL_NORMAL : HTMLlineproc1 ( "<U>:DEL]</U>" , h_env ) ; case DISPLAY_INS_DEL_FONTIFY : if ( obuf -> in_strike == 0 ) return 1 ; if ( obuf -> in_strike == 1 && close_effect0 ( obuf , HTML_S ) ) obuf -> in_strike = 0 ; if ( obuf -> in_strike > 0 ) { obuf -> in_strike -- ; if ( obuf -> in_strike == 0 ) { push_tag ( obuf , "</s>" , HTML_N_S ) ; } } break ; } return 1 ; case HTML_S : switch ( displayInsDel ) { case DISPLAY_INS_DEL_SIMPLE : obuf -> flag |= RB_S ; break ; case DISPLAY_INS_DEL_NORMAL : HTMLlineproc1 ( "<U>[S:</U>" , h_env ) ; break ; case DISPLAY_INS_DEL_FONTIFY : obuf -> in_strike ++ ; if ( obuf -> in_strike == 1 ) { push_tag ( obuf , "<s>" , HTML_S ) ; } break ; } return 1 ; case HTML_N_S : switch ( displayInsDel ) { case DISPLAY_INS_DEL_SIMPLE : obuf -> flag &= ~ RB_S ; break ; case DISPLAY_INS_DEL_NORMAL : HTMLlineproc1 ( "<U>:S]</U>" , h_env ) ; break ; case DISPLAY_INS_DEL_FONTIFY : if ( obuf -> in_strike == 0 ) return 1 ; if ( obuf -> in_strike == 1 && close_effect0 ( obuf , HTML_S ) ) obuf -> in_strike = 0 ; if ( obuf -> in_strike > 0 ) { obuf -> in_strike -- ; if ( obuf -> in_strike == 0 ) { push_tag ( obuf , "</s>" , HTML_N_S ) ; } } } return 1 ; case HTML_INS : switch ( displayInsDel ) { case DISPLAY_INS_DEL_SIMPLE : break ; case DISPLAY_INS_DEL_NORMAL : HTMLlineproc1 ( "<U>[INS:</U>" , h_env ) ; break ; case DISPLAY_INS_DEL_FONTIFY : obuf -> in_ins ++ ; if ( obuf -> in_ins == 1 ) { push_tag ( obuf , "<ins>" , HTML_INS ) ; } break ; } return 1 ; case HTML_N_INS : switch ( displayInsDel ) { case DISPLAY_INS_DEL_SIMPLE : break ; case DISPLAY_INS_DEL_NORMAL : HTMLlineproc1 ( "<U>:INS]</U>" , h_env ) ; break ; case DISPLAY_INS_DEL_FONTIFY : if ( obuf -> in_ins == 0 ) return 1 ; if ( obuf -> in_ins == 1 && close_effect0 ( obuf , HTML_INS ) ) obuf -> in_ins = 0 ; if ( obuf -> in_ins > 0 ) { obuf -> in_ins -- ; if ( obuf -> in_ins == 0 ) { push_tag ( obuf , "</ins>" , HTML_N_INS ) ; } } break ; } return 1 ; case HTML_SUP : if ( ! ( obuf -> flag & ( RB_DEL | RB_S ) ) ) HTMLlineproc1 ( "^" , h_env ) ; return 1 ; case HTML_N_SUP : return 1 ; case HTML_SUB : if ( ! ( obuf -> flag & ( RB_DEL | RB_S ) ) ) HTMLlineproc1 ( "[" , h_env ) ; return 1 ; case HTML_N_SUB : if ( ! ( obuf -> flag & ( RB_DEL | RB_S ) ) ) HTMLlineproc1 ( "]" , h_env ) ; return 1 ; case HTML_FONT : case HTML_N_FONT : case HTML_NOP : return 1 ; case HTML_BGSOUND : if ( view_unseenobject ) { if ( parsedtag_get_value ( tag , ATTR_SRC , & p ) ) { Str s ; q = html_quote ( p ) ; s = Sprintf ( "<A<S2SV_blank>HREF=\\"%s\\">bgsound(%s)</A>" , q , q ) ; HTMLlineproc1 ( s -> ptr , h_env ) ; } } return 1 ; case HTML_EMBED : if ( view_unseenobject ) { if ( parsedtag_get_value ( tag , ATTR_SRC , & p ) ) { Str s ; q = html_quote ( p ) ; s = Sprintf ( "<A<S2SV_blank>HREF=\\"%s\\">embed(%s)</A>" , q , q ) ; HTMLlineproc1 ( s -> ptr , h_env ) ; } } return 1 ; case HTML_APPLET : if ( view_unseenobject ) { if ( parsedtag_get_value ( tag , ATTR_ARCHIVE , & p ) ) { Str s ; q = html_quote ( p ) ; s = Sprintf ( "<A<S2SV_blank>HREF=\\"%s\\">applet<S2SV_blank>archive(%s)</A>" , q , q ) ; HTMLlineproc1 ( s -> ptr , h_env ) ; } } return 1 ; case HTML_BODY : if ( view_unseenobject ) { if ( parsedtag_get_value ( tag , ATTR_BACKGROUND , & p ) ) { Str s ; q = html_quote ( p ) ; s = Sprintf ( "<IMG<S2SV_blank>SRC=\\"%s\\"<S2SV_blank>ALT=\\"bg<S2SV_blank>image(%s)\\"><BR>" , q , q ) ; HTMLlineproc1 ( s -> ptr , h_env ) ; } } case HTML_N_HEAD : if ( obuf -> flag & RB_TITLE ) HTMLlineproc1 ( "</title>" , h_env ) ; case HTML_HEAD : case HTML_N_BODY : return 1 ; default : return 0 ; } return 0 ; }
| <S2SV_ModStart> ; if ( h_env -> envc == 0 || ( h_env -> envc_real < h_env -> nenv && envs [ h_env -> envc ] . env != HTML_DL && envs [ h_env -> envc ] . env != HTML_DL_COMPACT ) ) { PUSH_ENV ( HTML_DL ) ; } if (
| tats@w3m/33509cc81ec5f2ba44eb6fd98bd5c1b5873e46bd | CVE-2016-9436 | https://github.com/tats/w3m/commit/33509cc81ec5f2ba44eb6fd98bd5c1b5873e46bd | 2017-01-20T15:59Z |
14 | CWE-78 | CWE-78 static int r_core_cmd_subst_i ( RCore * core , char * cmd , char * colon , bool * tmpseek ) { RList * tmpenvs = r_list_newf ( tmpenvs_free ) ; const char * quotestr = "`" ; const char * tick = NULL ; char * ptr , * ptr2 , * str ; char * arroba = NULL ; char * grep = NULL ; RIODesc * tmpdesc = NULL ; int pamode = ! core -> io -> va ; int i , ret = 0 , pipefd ; bool usemyblock = false ; int scr_html = - 1 ; int scr_color = - 1 ; bool eos = false ; bool haveQuote = false ; bool oldfixedarch = core -> fixedarch ; bool oldfixedbits = core -> fixedbits ; bool cmd_tmpseek = false ; ut64 tmpbsz = core -> blocksize ; int cmd_ignbithints = - 1 ; if ( ! cmd ) { r_list_free ( tmpenvs ) ; return 0 ; } cmd = r_str_trim_head_tail ( cmd ) ; char * $0 = strstr ( cmd , "$(" ) ; if ( $0 ) { char * $1 = strchr ( $0 + 2 , ')' ) ; if ( $1 ) { * $0 = '`' ; * $1 = '`' ; memmove ( $0 + 1 , $0 + 2 , strlen ( $0 + 2 ) + 1 ) ; } else { eprintf ( "Unterminated<S2SV_blank>$()<S2SV_blank>block\\n" ) ; } } switch ( * cmd ) { case '.' : if ( cmd [ 1 ] == \'"\' ) { r_list_free ( tmpenvs ) ; return r_cmd_call ( core -> rcmd , cmd ) ; } break ; case \'"\' : for ( ; * cmd ; ) { int pipefd = - 1 ; ut64 oseek = UT64_MAX ; char * line , * p ; haveQuote = * cmd == \'"\' ; if ( haveQuote ) { cmd ++ ; p = * cmd ? find_eoq ( cmd ) : NULL ; if ( ! p || ! * p ) { eprintf ( "Missing<S2SV_blank>\\"<S2SV_blank>in<S2SV_blank>(%s)." , cmd ) ; r_list_free ( tmpenvs ) ; return false ; } * p ++ = 0 ; if ( ! * p ) { eos = true ; } } else { char * sc = strchr ( cmd , ';' ) ; if ( sc ) { * sc = 0 ; } r_core_cmd0 ( core , cmd ) ; if ( ! sc ) { break ; } cmd = sc + 1 ; continue ; } <S2SV_StartBug> if ( * p ) { <S2SV_EndBug> if ( p [ 0 ] == '@' ) { p -- ; } while ( p [ 1 ] == ';' || IS_WHITESPACE ( p [ 1 ] ) ) { p ++ ; } if ( p [ 1 ] == '@' || ( p [ 1 ] && p [ 2 ] == '@' ) ) { char * q = strchr ( p + 1 , \'"\' ) ; if ( q ) { <S2SV_StartBug> * q = 0 ; <S2SV_EndBug> } haveQuote = q != NULL ; oseek = core -> offset ; r_core_seek ( core , r_num_math ( core -> num , p + 2 ) , 1 ) ; if ( q ) { * p = \'"\' ; p = q ; } else { p = strchr ( p + 1 , ';' ) ; } } if ( p && * p && p [ 1 ] == '>' ) { str = p + 2 ; while ( * str == '>' ) { str ++ ; } str = ( char * ) r_str_trim_ro ( str ) ; r_cons_flush ( ) ; const bool append = p [ 2 ] == '>' ; pipefd = r_cons_pipe_open ( str , 1 , append ) ; } } line = strdup ( cmd ) ; line = r_str_replace ( line , "\\\\\\"" , "\\"" , true ) ; if ( p && * p && p [ 1 ] == '|' ) { str = p + 2 ; while ( IS_WHITESPACE ( * str ) ) { str ++ ; } r_core_cmd_pipe ( core , cmd , str ) ; } else { r_cmd_call ( core -> rcmd , line ) ; } free ( line ) ; if ( oseek != UT64_MAX ) { r_core_seek ( core , oseek , 1 ) ; } if ( pipefd != - 1 ) { r_cons_flush ( ) ; r_cons_pipe_close ( pipefd ) ; } if ( ! p ) { break ; } if ( eos ) { break ; } if ( haveQuote ) { if ( * p == ';' ) { cmd = p + 1 ; } else { if ( * p == \'"\' ) { <S2SV_StartBug> cmd = p + 1 ; <S2SV_EndBug> } else { <S2SV_StartBug> * p = \'"\' ; <S2SV_EndBug> cmd = p ; } } } else { cmd = p + 1 ; } } r_list_free ( tmpenvs ) ; return true ; case '(' : if ( cmd [ 1 ] != '*' && ! strstr ( cmd , ")()" ) ) { r_list_free ( tmpenvs ) ; return r_cmd_call ( core -> rcmd , cmd ) ; } break ; case '?' : if ( cmd [ 1 ] == '>' ) { r_core_cmd_help ( core , help_msg_greater_sign ) ; r_list_free ( tmpenvs ) ; return true ; } } if ( * cmd != '#' ) { ptr = ( char * ) r_str_firstbut ( cmd , '#' , "`\\"" ) ; if ( ptr && ( ptr [ 1 ] == '<S2SV_blank>' || ptr [ 1 ] == '\\t' ) ) { * ptr = '\\0' ; } } if ( * cmd != '#' ) { ptr = ( char * ) r_str_lastbut ( cmd , ';' , quotestr ) ; if ( colon && ptr ) { int ret ; * ptr = '\\0' ; if ( r_core_cmd_subst ( core , cmd ) == - 1 ) { r_list_free ( tmpenvs ) ; return - 1 ; } cmd = ptr + 1 ; ret = r_core_cmd_subst ( core , cmd ) ; * ptr = ';' ; r_list_free ( tmpenvs ) ; return ret ; } } ptr = ( char * ) r_str_lastbut ( cmd , '|' , quotestr ) ; if ( ptr ) { if ( ptr > cmd ) { char * ch = ptr - 1 ; if ( * ch == '\\\\' ) { memmove ( ch , ptr , strlen ( ptr ) + 1 ) ; goto escape_pipe ; } } char * ptr2 = strchr ( cmd , '`' ) ; if ( ! ptr2 || ( ptr2 && ptr2 > ptr ) ) { if ( ! tick || ( tick && tick > ptr ) ) { * ptr = '\\0' ; cmd = r_str_trim_nc ( cmd ) ; if ( ! strcmp ( ptr + 1 , "?" ) ) { r_core_cmd_help ( core , help_msg_vertical_bar ) ; r_list_free ( tmpenvs ) ; return ret ; } else if ( ! strncmp ( ptr + 1 , "H" , 1 ) ) { scr_html = r_config_get_i ( core -> config , "scr.html" ) ; r_config_set_i ( core -> config , "scr.html" , true ) ; } else if ( ! strcmp ( ptr + 1 , "T" ) ) { scr_color = r_config_get_i ( core -> config , "scr.color" ) ; r_config_set_i ( core -> config , "scr.color" , COLOR_MODE_DISABLED ) ; core -> cons -> use_tts = true ; } else if ( ! strcmp ( ptr + 1 , "." ) ) { ret = * cmd ? r_core_cmdf ( core , ".%s" , cmd ) : 0 ; r_list_free ( tmpenvs ) ; return ret ; } else if ( ptr [ 1 ] ) { int value = core -> num -> value ; if ( * cmd ) { r_core_cmd_pipe ( core , cmd , ptr + 1 ) ; } else { char * res = r_io_system ( core -> io , ptr + 1 ) ; if ( res ) { r_cons_printf ( "%s\\n" , res ) ; free ( res ) ; } } core -> num -> value = value ; r_list_free ( tmpenvs ) ; return 0 ; } else { scr_html = r_config_get_i ( core -> config , "scr.html" ) ; r_config_set_i ( core -> config , "scr.html" , 0 ) ; scr_color = r_config_get_i ( core -> config , "scr.color" ) ; r_config_set_i ( core -> config , "scr.color" , COLOR_MODE_DISABLED ) ; } } } } escape_pipe : ptr = ( char * ) r_str_lastbut ( cmd , '&' , quotestr ) ; while ( ptr && * ptr && ptr [ 1 ] == '&' ) { * ptr = '\\0' ; ret = r_cmd_call ( core -> rcmd , cmd ) ; if ( ret == - 1 ) { eprintf ( "command<S2SV_blank>error(%s)\\n" , cmd ) ; if ( scr_html != - 1 ) { r_config_set_i ( core -> config , "scr.html" , scr_html ) ; } if ( scr_color != - 1 ) { r_config_set_i ( core -> config , "scr.color" , scr_color ) ; } r_list_free ( tmpenvs ) ; return ret ; } for ( cmd = ptr + 2 ; cmd && * cmd == '<S2SV_blank>' ; cmd ++ ) { ; } ptr = strchr ( cmd , '&' ) ; } R_FREE ( core -> oobi ) ; ptr = strstr ( cmd , "?*" ) ; if ( ptr && ( ptr == cmd || ptr [ - 1 ] != '~' ) ) { ptr [ 0 ] = 0 ; if ( * cmd != '#' ) { int detail = 0 ; if ( cmd < ptr && ptr [ - 1 ] == '?' ) { detail ++ ; if ( cmd < ptr - 1 && ptr [ - 2 ] == '?' ) { detail ++ ; } } r_cons_break_push ( NULL , NULL ) ; recursive_help ( core , detail , cmd ) ; r_cons_break_pop ( ) ; r_cons_grep_parsecmd ( ptr + 2 , "`" ) ; if ( scr_html != - 1 ) { r_config_set_i ( core -> config , "scr.html" , scr_html ) ; } if ( scr_color != - 1 ) { r_config_set_i ( core -> config , "scr.color" , scr_color ) ; } r_list_free ( tmpenvs ) ; return 0 ; } } # if 0 ptr = strchr ( cmd , '<' ) ; if ( ptr ) { ptr [ 0 ] = '\\0' ; if ( r_cons_singleton ( ) -> is_interactive ) { if ( ptr [ 1 ] == '<' ) { for ( str = ptr + 2 ; str [ 0 ] == '<S2SV_blank>' ; str ++ ) { } eprintf ( "==><S2SV_blank>Reading<S2SV_blank>from<S2SV_blank>stdin<S2SV_blank>until<S2SV_blank>\'%s\'\\n" , str ) ; free ( core -> oobi ) ; core -> oobi = malloc ( 1 ) ; if ( core -> oobi ) { core -> oobi [ 0 ] = '\\0' ; } core -> oobi_len = 0 ; for ( ; ; ) { char buf [ 1024 ] ; int ret ; write ( 1 , "><S2SV_blank>" , 2 ) ; fgets ( buf , sizeof ( buf ) - 1 , stdin ) ; if ( feof ( stdin ) ) { break ; } if ( * buf ) buf [ strlen ( buf ) - 1 ] = '\\0' ; ret = strlen ( buf ) ; core -> oobi_len += ret ; core -> oobi = realloc ( core -> oobi , core -> oobi_len + 1 ) ; if ( core -> oobi ) { if ( ! strcmp ( buf , str ) ) { break ; } strcat ( ( char * ) core -> oobi , buf ) ; } } } else { for ( str = ptr + 1 ; * str == '<S2SV_blank>' ; str ++ ) { } if ( ! * str ) { goto next ; } eprintf ( "Slurping<S2SV_blank>file<S2SV_blank>\'%s\'\\n" , str ) ; free ( core -> oobi ) ; core -> oobi = ( ut8 * ) r_file_slurp ( str , & core -> oobi_len ) ; if ( ! core -> oobi ) { eprintf ( "cannot<S2SV_blank>open<S2SV_blank>file\\n" ) ; } else if ( ptr == cmd ) { return r_core_cmd_buffer ( core , ( const char * ) core -> oobi ) ; } } } else { eprintf ( "Cannot<S2SV_blank>slurp<S2SV_blank>with<S2SV_blank><<<S2SV_blank>in<S2SV_blank>non-interactive<S2SV_blank>mode\\n" ) ; r_list_free ( tmpenvs ) ; return 0 ; } } next : # endif ptr = ( char * ) r_str_firstbut ( cmd , '>' , "\\"" ) ; if ( ptr ) { if ( ptr > cmd ) { char * ch = ptr - 1 ; if ( * ch == '\\\\' ) { memmove ( ch , ptr , strlen ( ptr ) + 1 ) ; goto escape_redir ; } } if ( ptr [ 0 ] && ptr [ 1 ] == '?' ) { r_core_cmd_help ( core , help_msg_greater_sign ) ; r_list_free ( tmpenvs ) ; return true ; } int fdn = 1 ; int pipecolor = r_config_get_i ( core -> config , "scr.color.pipe" ) ; int use_editor = false ; int ocolor = r_config_get_i ( core -> config , "scr.color" ) ; * ptr = '\\0' ; str = r_str_trim_head_tail ( ptr + 1 + ( ptr [ 1 ] == '>' ) ) ; if ( ! * str ) { eprintf ( "No<S2SV_blank>output?\\n" ) ; goto next2 ; } if ( ptr > ( cmd + 1 ) && IS_WHITECHAR ( ptr [ - 2 ] ) ) { char * fdnum = ptr - 1 ; if ( * fdnum == 'H' ) { scr_html = r_config_get_i ( core -> config , "scr.html" ) ; r_config_set_i ( core -> config , "scr.html" , true ) ; pipecolor = true ; * fdnum = 0 ; } else { if ( IS_DIGIT ( * fdnum ) ) { fdn = * fdnum - '0' ; } * fdnum = 0 ; } } r_cons_set_interactive ( false ) ; if ( ! strcmp ( str , "-" ) ) { use_editor = true ; str = r_file_temp ( "dumpedit" ) ; r_config_set_i ( core -> config , "scr.color" , COLOR_MODE_DISABLED ) ; } const bool appendResult = ( ptr [ 1 ] == '>' ) ; if ( * str == '$' ) { char * o = r_core_cmd_str ( core , cmd ) ; if ( appendResult ) { char * oldText = r_cmd_alias_get ( core -> rcmd , str , 1 ) ; if ( oldText ) { char * two = r_str_newf ( "%s%s" , oldText , o ) ; if ( two ) { r_cmd_alias_set ( core -> rcmd , str , two , 1 ) ; free ( two ) ; } } else { char * n = r_str_newf ( "$%s" , o ) ; r_cmd_alias_set ( core -> rcmd , str , n , 1 ) ; free ( n ) ; } } else { char * n = r_str_newf ( "$%s" , o ) ; r_cmd_alias_set ( core -> rcmd , str , n , 1 ) ; free ( n ) ; } ret = 0 ; free ( o ) ; } else if ( fdn > 0 ) { pipefd = r_cons_pipe_open ( str , fdn , appendResult ) ; if ( pipefd != - 1 ) { if ( ! pipecolor ) { r_config_set_i ( core -> config , "scr.color" , COLOR_MODE_DISABLED ) ; } ret = r_core_cmd_subst ( core , cmd ) ; r_cons_flush ( ) ; r_cons_pipe_close ( pipefd ) ; } } r_cons_set_last_interactive ( ) ; if ( ! pipecolor ) { r_config_set_i ( core -> config , "scr.color" , ocolor ) ; } if ( use_editor ) { const char * editor = r_config_get ( core -> config , "cfg.editor" ) ; if ( editor && * editor ) { r_sys_cmdf ( "%s<S2SV_blank>\'%s\'" , editor , str ) ; r_file_rm ( str ) ; } else { eprintf ( "No<S2SV_blank>cfg.editor<S2SV_blank>configured\\n" ) ; } r_config_set_i ( core -> config , "scr.color" , ocolor ) ; free ( str ) ; } if ( scr_html != - 1 ) { r_config_set_i ( core -> config , "scr.html" , scr_html ) ; } if ( scr_color != - 1 ) { r_config_set_i ( core -> config , "scr.color" , scr_color ) ; } core -> cons -> use_tts = false ; r_list_free ( tmpenvs ) ; return ret ; } escape_redir : next2 : ptr = strchr ( cmd , '`' ) ; if ( ptr ) { if ( ptr > cmd ) { char * ch = ptr - 1 ; if ( * ch == '\\\\' ) { memmove ( ch , ptr , strlen ( ptr ) + 1 ) ; goto escape_backtick ; } } bool empty = false ; int oneline = 1 ; if ( ptr [ 1 ] == '`' ) { memmove ( ptr , ptr + 1 , strlen ( ptr ) ) ; oneline = 0 ; empty = true ; } ptr2 = strchr ( ptr + 1 , '`' ) ; if ( empty ) { } else if ( ! ptr2 ) { eprintf ( "parse:<S2SV_blank>Missing<S2SV_blank>backtick<S2SV_blank>in<S2SV_blank>expression.\\n" ) ; goto fail ; } else { int value = core -> num -> value ; * ptr = '\\0' ; * ptr2 = '\\0' ; if ( ptr [ 1 ] == '!' ) { str = r_core_cmd_str_pipe ( core , ptr + 1 ) ; } else { int ocolor = r_config_get_i ( core -> config , "scr.color" ) ; r_config_set_i ( core -> config , "scr.color" , 0 ) ; core -> cmd_in_backticks = true ; str = r_core_cmd_str ( core , ptr + 1 ) ; core -> cmd_in_backticks = false ; r_config_set_i ( core -> config , "scr.color" , ocolor ) ; } if ( ! str ) { goto fail ; } if ( * str == '|' || * str == '*' ) { eprintf ( "r_core_cmd_subst_i:<S2SV_blank>invalid<S2SV_blank>backticked<S2SV_blank>command\\n" ) ; free ( str ) ; goto fail ; } if ( oneline && str ) { for ( i = 0 ; str [ i ] ; i ++ ) { if ( str [ i ] == '\\n' ) { str [ i ] = '<S2SV_blank>' ; } } } str = r_str_append ( str , ptr2 + 1 ) ; cmd = r_str_append ( strdup ( cmd ) , str ) ; core -> num -> value = value ; ret = r_core_cmd_subst ( core , cmd ) ; free ( cmd ) ; if ( scr_html != - 1 ) { r_config_set_i ( core -> config , "scr.html" , scr_html ) ; } free ( str ) ; r_list_free ( tmpenvs ) ; return ret ; } } escape_backtick : if ( * cmd != \'"\' && * cmd ) { const char * s = strstr ( cmd , "~?" ) ; if ( s ) { bool showHelp = false ; if ( cmd == s ) { showHelp = true ; } else { if ( ! strcmp ( s , "~??" ) ) { showHelp = true ; } } if ( showHelp ) { r_cons_grep_help ( ) ; r_list_free ( tmpenvs ) ; return true ; } } } if ( * cmd != '.' ) { grep = r_cons_grep_strip ( cmd , quotestr ) ; } if ( * cmd != \'"\' ) { ptr = strchr ( cmd , '@' ) ; if ( ptr == cmd + 1 && * cmd == '?' ) { ptr = NULL ; } } else { ptr = NULL ; } cmd_tmpseek = core -> tmpseek = ptr ? true : false ; int rc = 0 ; if ( ptr ) { char * f , * ptr2 = strchr ( ptr + 1 , '!' ) ; ut64 addr = core -> offset ; bool addr_is_set = false ; char * tmpbits = NULL ; const char * offstr = NULL ; bool is_bits_set = false ; bool is_arch_set = false ; char * tmpeval = NULL ; char * tmpasm = NULL ; bool flgspc_changed = false ; int tmpfd = - 1 ; int sz , len ; ut8 * buf ; * ptr ++ = '\\0' ; repeat_arroba : arroba = ( ptr [ 0 ] && ptr [ 1 ] && ptr [ 2 ] ) ? strchr ( ptr + 2 , '@' ) : NULL ; if ( arroba ) { * arroba = 0 ; } for ( ; * ptr == '<S2SV_blank>' ; ptr ++ ) { } if ( * ptr && ptr [ 1 ] == ':' ) { } else { ptr -- ; } ptr = r_str_trim_tail ( ptr ) ; if ( ptr [ 1 ] == '?' ) { r_core_cmd_help ( core , help_msg_at ) ; } else if ( ptr [ 1 ] == '%' ) { char * k = strdup ( ptr + 2 ) ; char * v = strchr ( k , '=' ) ; if ( v ) { * v ++ = 0 ; r_sys_setenv ( k , v ) ; r_list_append ( tmpenvs , k ) ; } else { free ( k ) ; } } else if ( ptr [ 1 ] == '.' ) { if ( ptr [ 2 ] == '.' ) { if ( ptr [ 3 ] == '.' ) { ut64 addr = r_num_tail ( core -> num , core -> offset , ptr + 4 ) ; r_core_block_size ( core , R_ABS ( ( st64 ) addr - ( st64 ) core -> offset ) ) ; goto fuji ; } else { addr = r_num_tail ( core -> num , core -> offset , ptr + 3 ) ; r_core_seek ( core , addr , 1 ) ; cmd_tmpseek = core -> tmpseek = true ; goto fuji ; } } else { eprintf ( "TODO:<S2SV_blank>what<S2SV_blank>do<S2SV_blank>you<S2SV_blank>expect<S2SV_blank>for<S2SV_blank>@.<S2SV_blank>import<S2SV_blank>offset<S2SV_blank>from<S2SV_blank>file<S2SV_blank>maybe?\\n" ) ; } } else if ( ptr [ 0 ] && ptr [ 1 ] == ':' && ptr [ 2 ] ) { switch ( ptr [ 0 ] ) { case 'F' : flgspc_changed = r_flag_space_push ( core -> flags , ptr + 2 ) ; break ; case 'B' : { int index = ( int ) r_num_math ( core -> num , ptr + 2 ) ; RAnalBlock * bb = r_anal_bb_from_offset ( core -> anal , core -> offset ) ; if ( bb ) { if ( index < 0 ) { index = bb -> ninstr + index ; } if ( index >= 0 && index < bb -> ninstr ) { ut16 inst_off = r_anal_bb_offset_inst ( bb , index ) ; r_core_seek ( core , bb -> addr + inst_off , 1 ) ; cmd_tmpseek = core -> tmpseek = true ; } else { eprintf ( "The<S2SV_blank>current<S2SV_blank>basic<S2SV_blank>block<S2SV_blank>has<S2SV_blank>%d<S2SV_blank>instructions\\n" , bb -> ninstr ) ; } } else { eprintf ( "Can\'t<S2SV_blank>find<S2SV_blank>a<S2SV_blank>basic<S2SV_blank>block<S2SV_blank>for<S2SV_blank>0x%08" PFMT64x "\\n" , core -> offset ) ; } break ; } break ; case 'f' : f = r_file_slurp ( ptr + 2 , & sz ) ; if ( f ) { { RBuffer * b = r_buf_new_with_bytes ( ( const ut8 * ) f , sz ) ; RIODesc * d = r_io_open_buffer ( core -> io , b , R_PERM_RWX , 0 ) ; if ( d ) { if ( tmpdesc ) { r_io_desc_close ( tmpdesc ) ; } tmpdesc = d ; if ( pamode ) { r_config_set_i ( core -> config , "io.va" , 1 ) ; } r_io_map_new ( core -> io , d -> fd , d -> perm , 0 , core -> offset , r_buf_size ( b ) ) ; } } # if 0 buf = malloc ( sz ) ; if ( buf ) { free ( core -> block ) ; core -> block = buf ; core -> blocksize = sz ; memcpy ( core -> block , f , sz ) ; usemyblock = true ; } else { eprintf ( "cannot<S2SV_blank>alloc<S2SV_blank>%d" , sz ) ; } free ( f ) ; # endif } else { eprintf ( "cannot<S2SV_blank>open<S2SV_blank>\'%s\'\\n" , ptr + 3 ) ; } break ; case 'r' : if ( ptr [ 1 ] == ':' ) { ut64 regval ; char * mander = strdup ( ptr + 2 ) ; char * sep = findSeparator ( mander ) ; if ( sep ) { char ch = * sep ; * sep = 0 ; regval = r_debug_reg_get ( core -> dbg , mander ) ; * sep = ch ; char * numexpr = r_str_newf ( "0x%" PFMT64x "%s" , regval , sep ) ; regval = r_num_math ( core -> num , numexpr ) ; free ( numexpr ) ; } else { regval = r_debug_reg_get ( core -> dbg , ptr + 2 ) ; } r_core_seek ( core , regval , 1 ) ; cmd_tmpseek = core -> tmpseek = true ; free ( mander ) ; } break ; case 'b' : is_bits_set = set_tmp_bits ( core , r_num_math ( core -> num , ptr + 2 ) , & tmpbits ) ; cmd_ignbithints = r_config_get_i ( core -> config , "anal.ignbithints" ) ; r_config_set_i ( core -> config , "anal.ignbithints" , 1 ) ; break ; case 'i' : { ut64 addr = r_num_math ( core -> num , ptr + 2 ) ; if ( addr ) { r_core_cmdf ( core , "so<S2SV_blank>%s" , ptr + 2 ) ; cmd_tmpseek = core -> tmpseek = true ; } } break ; case 'e' : { char * cmd = parse_tmp_evals ( core , ptr + 2 ) ; if ( ! tmpeval ) { tmpeval = cmd ; } else { tmpeval = r_str_prepend ( tmpeval , cmd ) ; free ( cmd ) ; } } break ; case 'x' : if ( ptr [ 1 ] == ':' ) { buf = malloc ( strlen ( ptr + 2 ) + 1 ) ; if ( buf ) { len = r_hex_str2bin ( ptr + 2 , buf ) ; r_core_block_size ( core , R_ABS ( len ) ) ; if ( len > 0 ) { RBuffer * b = r_buf_new_with_bytes ( buf , len ) ; RIODesc * d = r_io_open_buffer ( core -> io , b , R_PERM_RWX , 0 ) ; if ( d ) { if ( tmpdesc ) { r_io_desc_close ( tmpdesc ) ; } tmpdesc = d ; if ( pamode ) { r_config_set_i ( core -> config , "io.va" , 1 ) ; } r_io_map_new ( core -> io , d -> fd , d -> perm , 0 , core -> offset , r_buf_size ( b ) ) ; r_core_block_size ( core , len ) ; r_core_block_read ( core ) ; } } else { eprintf ( "Error:<S2SV_blank>Invalid<S2SV_blank>hexpairs<S2SV_blank>for<S2SV_blank>@x:\\n" ) ; } free ( buf ) ; } else { eprintf ( "cannot<S2SV_blank>allocate\\n" ) ; } } else { eprintf ( "Invalid<S2SV_blank>@x:<S2SV_blank>syntax\\n" ) ; } break ; case 'k' : { char * out = sdb_querys ( core -> sdb , NULL , 0 , ptr + ( ( ptr [ 1 ] ) ? 2 : 1 ) ) ; if ( out ) { r_core_seek ( core , r_num_math ( core -> num , out ) , 1 ) ; free ( out ) ; usemyblock = true ; } } break ; case 'o' : if ( ptr [ 1 ] == ':' ) { tmpfd = core -> io -> desc ? core -> io -> desc -> fd : - 1 ; r_io_use_fd ( core -> io , atoi ( ptr + 2 ) ) ; } break ; case 'a' : if ( ptr [ 1 ] == ':' ) { char * q = strchr ( ptr + 2 , ':' ) ; if ( q ) { * q ++ = 0 ; int bits = r_num_math ( core -> num , q ) ; is_bits_set = set_tmp_bits ( core , bits , & tmpbits ) ; } is_arch_set = set_tmp_arch ( core , ptr + 2 , & tmpasm ) ; } else { eprintf ( "Usage:<S2SV_blank>pd<S2SV_blank>10<S2SV_blank>@a:arm:32\\n" ) ; } break ; case 's' : { len = strlen ( ptr + 2 ) ; r_core_block_size ( core , len ) ; const ut8 * buf = ( const ut8 * ) r_str_trim_ro ( ptr + 2 ) ; if ( len > 0 ) { RBuffer * b = r_buf_new_with_bytes ( buf , len ) ; RIODesc * d = r_io_open_buffer ( core -> io , b , R_PERM_RWX , 0 ) ; if ( ! core -> io -> va ) { r_config_set_i ( core -> config , "io.va" , 1 ) ; } if ( d ) { if ( tmpdesc ) { r_io_desc_close ( tmpdesc ) ; } tmpdesc = d ; if ( pamode ) { r_config_set_i ( core -> config , "io.va" , 1 ) ; } r_io_map_new ( core -> io , d -> fd , d -> perm , 0 , core -> offset , r_buf_size ( b ) ) ; r_core_block_size ( core , len ) ; } } } break ; default : goto ignore ; } * ptr = '@' ; char * trim = ptr - 2 ; while ( trim > cmd ) { if ( ! IS_WHITESPACE ( * trim ) ) { break ; } * trim = 0 ; trim -- ; } goto next_arroba ; } ignore : ptr = r_str_trim_head ( ptr + 1 ) - 1 ; cmd = r_str_trim_nc ( cmd ) ; if ( ptr2 ) { if ( strlen ( ptr + 1 ) == 13 && strlen ( ptr2 + 1 ) == 6 && ! memcmp ( ptr + 1 , "0x" , 2 ) && ! memcmp ( ptr2 + 1 , "0x" , 2 ) ) { } else if ( strlen ( ptr + 1 ) == 9 && strlen ( ptr2 + 1 ) == 4 ) { } else { * ptr2 = '\\0' ; if ( ! ptr2 [ 1 ] ) { goto fail ; } r_core_block_size ( core , r_num_math ( core -> num , ptr2 + 1 ) ) ; } } offstr = r_str_trim_head ( ptr + 1 ) ; addr = r_num_math ( core -> num , offstr ) ; addr_is_set = true ; if ( isalpha ( ( ut8 ) ptr [ 1 ] ) && ! addr ) { if ( ! r_flag_get ( core -> flags , ptr + 1 ) ) { eprintf ( "Invalid<S2SV_blank>address<S2SV_blank>(%s)\\n" , ptr + 1 ) ; goto fail ; } } else { char ch = * offstr ; if ( ch == '-' || ch == '+' ) { addr = core -> offset + addr ; } } if ( addr ) { RIODesc * d = tmpdesc ; if ( d ) { r_io_map_new ( core -> io , d -> fd , d -> perm , 0 , addr , r_io_desc_size ( d ) ) ; } } next_arroba : if ( arroba ) { ptr = arroba + 1 ; * arroba = '@' ; arroba = NULL ; goto repeat_arroba ; } core -> fixedblock = ! ! tmpdesc ; if ( core -> fixedblock ) { r_core_block_read ( core ) ; } if ( ptr [ 1 ] == '@' ) { if ( ptr [ 2 ] == '@' ) { char * rule = ptr + 3 ; while ( * rule && * rule == '<S2SV_blank>' ) { rule ++ ; } ret = r_core_cmd_foreach3 ( core , cmd , rule ) ; } else { ret = r_core_cmd_foreach ( core , cmd , ptr + 2 ) ; } } else { bool tmpseek = false ; const char * fromvars [ ] = { "anal.from" , "diff.from" , "graph.from" , "io.buffer.from" , "lines.from" , "search.from" , "zoom.from" , NULL } ; const char * tovars [ ] = { "anal.to" , "diff.to" , "graph.to" , "io.buffer.to" , "lines.to" , "search.to" , "zoom.to" , NULL } ; ut64 curfrom [ R_ARRAY_SIZE ( fromvars ) - 1 ] , curto [ R_ARRAY_SIZE ( tovars ) - 1 ] ; if ( ptr [ 1 ] == '(' ) { char * range = ptr + 3 ; char * p = strchr ( range , '<S2SV_blank>' ) ; if ( ! p ) { eprintf ( "Usage:<S2SV_blank>/<S2SV_blank>ABCD<S2SV_blank>@..0x1000<S2SV_blank>0x3000\\n" ) ; free ( tmpeval ) ; free ( tmpasm ) ; free ( tmpbits ) ; goto fail ; } * p = '\\x00' ; ut64 from = r_num_math ( core -> num , range ) ; ut64 to = r_num_math ( core -> num , p + 1 ) ; for ( i = 0 ; fromvars [ i ] ; i ++ ) { curfrom [ i ] = r_config_get_i ( core -> config , fromvars [ i ] ) ; } for ( i = 0 ; tovars [ i ] ; i ++ ) { curto [ i ] = r_config_get_i ( core -> config , tovars [ i ] ) ; } for ( i = 0 ; fromvars [ i ] ; i ++ ) { r_config_set_i ( core -> config , fromvars [ i ] , from ) ; } for ( i = 0 ; tovars [ i ] ; i ++ ) { r_config_set_i ( core -> config , tovars [ i ] , to ) ; } tmpseek = true ; } if ( usemyblock ) { if ( addr_is_set ) { core -> offset = addr ; } ret = r_cmd_call ( core -> rcmd , r_str_trim_head ( cmd ) ) ; } else { if ( addr_is_set ) { if ( ptr [ 1 ] ) { r_core_seek ( core , addr , 1 ) ; r_core_block_read ( core ) ; } } ret = r_cmd_call ( core -> rcmd , r_str_trim_head ( cmd ) ) ; } if ( tmpseek ) { for ( i = 0 ; fromvars [ i ] ; i ++ ) { r_config_set_i ( core -> config , fromvars [ i ] , curfrom [ i ] ) ; } for ( i = 0 ; tovars [ i ] ; i ++ ) { r_config_set_i ( core -> config , tovars [ i ] , curto [ i ] ) ; } } } if ( ptr2 ) { * ptr2 = '!' ; r_core_block_size ( core , tmpbsz ) ; } if ( is_arch_set ) { core -> fixedarch = oldfixedarch ; r_config_set ( core -> config , "asm.arch" , tmpasm ) ; R_FREE ( tmpasm ) ; } if ( tmpfd != - 1 ) { r_io_use_fd ( core -> io , tmpfd ) ; } if ( tmpdesc ) { if ( pamode ) { r_config_set_i ( core -> config , "io.va" , 0 ) ; } r_io_desc_close ( tmpdesc ) ; tmpdesc = NULL ; } if ( is_bits_set ) { r_config_set ( core -> config , "asm.bits" , tmpbits ) ; core -> fixedbits = oldfixedbits ; } if ( tmpbsz != core -> blocksize ) { r_core_block_size ( core , tmpbsz ) ; } if ( tmpeval ) { r_core_cmd0 ( core , tmpeval ) ; R_FREE ( tmpeval ) ; } if ( flgspc_changed ) { r_flag_space_pop ( core -> flags ) ; } * ptr = '@' ; rc = ret ; goto beach ; } fuji : rc = cmd ? r_cmd_call ( core -> rcmd , r_str_trim_head ( cmd ) ) : false ; beach : r_cons_grep_process ( grep ) ; if ( scr_html != - 1 ) { r_cons_flush ( ) ; r_config_set_i ( core -> config , "scr.html" , scr_html ) ; } if ( scr_color != - 1 ) { r_config_set_i ( core -> config , "scr.color" , scr_color ) ; } r_list_free ( tmpenvs ) ; if ( tmpdesc ) { r_io_desc_close ( tmpdesc ) ; tmpdesc = NULL ; } core -> fixedarch = oldfixedarch ; core -> fixedbits = oldfixedbits ; if ( tmpseek ) { * tmpseek = cmd_tmpseek ; } if ( cmd_ignbithints != - 1 ) { r_config_set_i ( core -> config , "anal.ignbithints" , cmd_ignbithints ) ; } return rc ; fail : rc = - 1 ; goto beach ; }
| <S2SV_ModStart> continue ; } char op0 = 0 ; <S2SV_ModStart> q ) { op0 = * q ; <S2SV_ModStart> cmd = p <S2SV_ModEnd> ; } else <S2SV_ModStart> * p = op0 <S2SV_ModEnd> ; cmd =
| radareorg@radare2/dd739f5a45b3af3d1f65f00fe19af1dbfec7aea7 | CVE-2019-16718 | https://github.com/radareorg/radare2/commit/dd739f5a45b3af3d1f65f00fe19af1dbfec7aea7 | 2019-09-23T14:15Z |
15 | CWE-200 | CWE-200 int check_user_token ( const char * authfile , const char * username , const char * otp_id , int verbose , FILE * debug_file ) { char buf [ 1024 ] ; char * s_user , * s_token ; int retval = AUTH_ERROR ; int fd ; struct stat st ; FILE * opwfile ; fd = open ( authfile , O_RDONLY , 0 ) ; if ( fd < 0 ) { if ( verbose ) D ( debug_file , "Cannot<S2SV_blank>open<S2SV_blank>file:<S2SV_blank>%s<S2SV_blank>(%s)" , authfile , strerror ( errno ) ) ; return retval ; } if ( fstat ( fd , & st ) < 0 ) { if ( verbose ) D ( debug_file , "Cannot<S2SV_blank>stat<S2SV_blank>file:<S2SV_blank>%s<S2SV_blank>(%s)" , authfile , strerror ( errno ) ) ; close ( fd ) ; return retval ; } if ( ! S_ISREG ( st . st_mode ) ) { if ( verbose ) D ( debug_file , "%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>regular<S2SV_blank>file" , authfile ) ; close ( fd ) ; return retval ; } opwfile = fdopen ( fd , "r" ) ; if ( opwfile == NULL ) { if ( verbose ) D ( debug_file , "fdopen:<S2SV_blank>%s" , strerror ( errno ) ) ; close ( fd ) ; return retval ; } retval = AUTH_NO_TOKENS ; while ( fgets ( buf , 1024 , opwfile ) ) { char * saveptr = NULL ; if ( buf [ strlen ( buf ) - 1 ] == '\\n' ) buf [ strlen ( buf ) - 1 ] = '\\0' ; if ( buf [ 0 ] == '#' ) { if ( verbose ) D ( debug_file , "Skipping<S2SV_blank>comment<S2SV_blank>line:<S2SV_blank>%s" , buf ) ; continue ; } if ( verbose ) D ( debug_file , "Authorization<S2SV_blank>line:<S2SV_blank>%s" , buf ) ; s_user = strtok_r ( buf , ":" , & saveptr ) ; if ( s_user && strcmp ( username , s_user ) == 0 ) { if ( verbose ) D ( debug_file , "Matched<S2SV_blank>user:<S2SV_blank>%s" , s_user ) ; retval = AUTH_NOT_FOUND ; do { s_token = strtok_r ( NULL , ":" , & saveptr ) ; if ( verbose ) D ( debug_file , "Authorization<S2SV_blank>token:<S2SV_blank>%s" , s_token ) ; if ( s_token && otp_id && strcmp ( otp_id , s_token ) == 0 ) { if ( verbose ) D ( debug_file , "Match<S2SV_blank>user/token<S2SV_blank>as<S2SV_blank>%s/%s" , username , otp_id ) ; <S2SV_StartBug> return AUTH_FOUND ; <S2SV_EndBug> } } while ( s_token != NULL ) ; } } fclose ( opwfile ) ; return retval ; }
| <S2SV_ModStart> otp_id ) ; fclose ( opwfile ) ;
| Yubico@yubico-pam/0f6ceabab0a8849b47f67d727aa526c2656089ba | CVE-2018-9275 | https://github.com/Yubico/yubico-pam/commit/0f6ceabab0a8849b47f67d727aa526c2656089ba | 2018-04-04T18:29Z |
16 | CWE-125 | CWE-125 static int PARSER_FLAGS ( PyCompilerFlags * flags ) { int parser_flags = 0 ; if ( ! flags ) return 0 ; if ( flags -> cf_flags & PyCF_DONT_IMPLY_DEDENT ) parser_flags |= PyPARSE_DONT_IMPLY_DEDENT ; if ( flags -> cf_flags & PyCF_IGNORE_COOKIE ) parser_flags |= PyPARSE_IGNORE_COOKIE ; if ( flags -> cf_flags & CO_FUTURE_BARRY_AS_BDFL ) parser_flags |= PyPARSE_BARRY_AS_BDFL ; <S2SV_StartBug> return parser_flags ; <S2SV_EndBug> }
| <S2SV_ModStart> |= PyPARSE_BARRY_AS_BDFL ; if ( flags -> cf_flags & PyCF_TYPE_COMMENTS ) parser_flags |= PyPARSE_TYPE_COMMENTS ;
| python@typed_ast/dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c | CVE-2019-19275 | https://github.com/python/typed_ast/commit/dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c | 2019-11-26T15:15Z |
17 | CWE-125 | CWE-125 void bootp_print ( netdissect_options * ndo , register const u_char * cp , u_int length ) { register const struct bootp * bp ; static const u_char vm_cmu [ 4 ] = VM_CMU ; static const u_char vm_rfc1048 [ 4 ] = VM_RFC1048 ; bp = ( const struct bootp * ) cp ; ND_TCHECK ( bp -> bp_op ) ; ND_PRINT ( ( ndo , "BOOTP/DHCP,<S2SV_blank>%s" , tok2str ( bootp_op_values , "unknown<S2SV_blank>(0x%02x)" , bp -> bp_op ) ) ) ; ND_TCHECK ( bp -> bp_hlen ) ; if ( bp -> bp_htype == 1 && bp -> bp_hlen == 6 && bp -> bp_op == BOOTPREQUEST ) { ND_TCHECK2 ( bp -> bp_chaddr [ 0 ] , 6 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>from<S2SV_blank>%s" , etheraddr_string ( ndo , bp -> bp_chaddr ) ) ) ; } ND_PRINT ( ( ndo , ",<S2SV_blank>length<S2SV_blank>%u" , length ) ) ; if ( ! ndo -> ndo_vflag ) return ; ND_TCHECK ( bp -> bp_secs ) ; if ( bp -> bp_htype != 1 ) ND_PRINT ( ( ndo , ",<S2SV_blank>htype<S2SV_blank>%d" , bp -> bp_htype ) ) ; if ( bp -> bp_htype != 1 || bp -> bp_hlen != 6 ) ND_PRINT ( ( ndo , ",<S2SV_blank>hlen<S2SV_blank>%d" , bp -> bp_hlen ) ) ; if ( bp -> bp_hops ) ND_PRINT ( ( ndo , ",<S2SV_blank>hops<S2SV_blank>%d" , bp -> bp_hops ) ) ; if ( EXTRACT_32BITS ( & bp -> bp_xid ) ) ND_PRINT ( ( ndo , ",<S2SV_blank>xid<S2SV_blank>0x%x" , EXTRACT_32BITS ( & bp -> bp_xid ) ) ) ; if ( EXTRACT_16BITS ( & bp -> bp_secs ) ) ND_PRINT ( ( ndo , ",<S2SV_blank>secs<S2SV_blank>%d" , EXTRACT_16BITS ( & bp -> bp_secs ) ) ) ; <S2SV_StartBug> ND_PRINT ( ( ndo , ",<S2SV_blank>Flags<S2SV_blank>[%s]" , <S2SV_EndBug> bittok2str ( bootp_flag_values , "none" , EXTRACT_16BITS ( & bp -> bp_flags ) ) ) ) ; if ( ndo -> ndo_vflag > 1 ) ND_PRINT ( ( ndo , "<S2SV_blank>(0x%04x)" , EXTRACT_16BITS ( & bp -> bp_flags ) ) ) ; ND_TCHECK ( bp -> bp_ciaddr ) ; if ( EXTRACT_32BITS ( & bp -> bp_ciaddr . s_addr ) ) ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Client-IP<S2SV_blank>%s" , ipaddr_string ( ndo , & bp -> bp_ciaddr ) ) ) ; ND_TCHECK ( bp -> bp_yiaddr ) ; if ( EXTRACT_32BITS ( & bp -> bp_yiaddr . s_addr ) ) ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Your-IP<S2SV_blank>%s" , ipaddr_string ( ndo , & bp -> bp_yiaddr ) ) ) ; ND_TCHECK ( bp -> bp_siaddr ) ; if ( EXTRACT_32BITS ( & bp -> bp_siaddr . s_addr ) ) ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Server-IP<S2SV_blank>%s" , ipaddr_string ( ndo , & bp -> bp_siaddr ) ) ) ; ND_TCHECK ( bp -> bp_giaddr ) ; if ( EXTRACT_32BITS ( & bp -> bp_giaddr . s_addr ) ) ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Gateway-IP<S2SV_blank>%s" , ipaddr_string ( ndo , & bp -> bp_giaddr ) ) ) ; if ( bp -> bp_htype == 1 && bp -> bp_hlen == 6 ) { ND_TCHECK2 ( bp -> bp_chaddr [ 0 ] , 6 ) ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Client-Ethernet-Address<S2SV_blank>%s" , etheraddr_string ( ndo , bp -> bp_chaddr ) ) ) ; } ND_TCHECK2 ( bp -> bp_sname [ 0 ] , 1 ) ; if ( * bp -> bp_sname ) { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>sname<S2SV_blank>\\"" ) ) ; if ( fn_printztn ( ndo , bp -> bp_sname , ( u_int ) sizeof bp -> bp_sname , ndo -> ndo_snapend ) ) { ND_PRINT ( ( ndo , "\\"" ) ) ; ND_PRINT ( ( ndo , "%s" , tstr + 1 ) ) ; return ; } ND_PRINT ( ( ndo , "\\"" ) ) ; } ND_TCHECK2 ( bp -> bp_file [ 0 ] , 1 ) ; if ( * bp -> bp_file ) { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>file<S2SV_blank>\\"" ) ) ; if ( fn_printztn ( ndo , bp -> bp_file , ( u_int ) sizeof bp -> bp_file , ndo -> ndo_snapend ) ) { ND_PRINT ( ( ndo , "\\"" ) ) ; ND_PRINT ( ( ndo , "%s" , tstr + 1 ) ) ; return ; } ND_PRINT ( ( ndo , "\\"" ) ) ; } ND_TCHECK ( bp -> bp_vend [ 0 ] ) ; if ( memcmp ( ( const char * ) bp -> bp_vend , vm_rfc1048 , sizeof ( uint32_t ) ) == 0 ) rfc1048_print ( ndo , bp -> bp_vend ) ; else if ( memcmp ( ( const char * ) bp -> bp_vend , vm_cmu , sizeof ( uint32_t ) ) == 0 ) cmu_print ( ndo , bp -> bp_vend ) ; else { uint32_t ul ; ul = EXTRACT_32BITS ( & bp -> bp_vend ) ; if ( ul != 0 ) ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Vendor-#0x%x" , ul ) ) ; } return ; trunc : ND_PRINT ( ( ndo , "%s" , tstr ) ) ; }
| <S2SV_ModStart> ) ) ; ND_TCHECK ( bp -> bp_flags ) ;
| the-tcpdump-group@tcpdump/29e5470e6ab84badbc31f4532bb7554a796d9d52 | CVE-2017-13028 | https://github.com/the-tcpdump-group/tcpdump/commit/29e5470e6ab84badbc31f4532bb7554a796d9d52 | 2017-09-14T06:29Z |
18 | CWE-476 | CWE-476 static int dnxhd_find_frame_end ( DNXHDParserContext * dctx , const uint8_t * buf , int buf_size ) { ParseContext * pc = & dctx -> pc ; uint64_t state = pc -> state64 ; int pic_found = pc -> frame_start_found ; int i = 0 ; int interlaced = dctx -> interlaced ; int cur_field = dctx -> cur_field ; if ( ! pic_found ) { for ( i = 0 ; i < buf_size ; i ++ ) { state = ( state << 8 ) | buf [ i ] ; if ( ff_dnxhd_check_header_prefix ( state & 0xffffffffff00LL ) != 0 ) { i ++ ; pic_found = 1 ; interlaced = ( state & 2 ) >> 1 ; cur_field = state & 1 ; dctx -> cur_byte = 0 ; dctx -> remaining = 0 ; break ; } } } if ( pic_found && ! dctx -> remaining ) { if ( ! buf_size ) return 0 ; for ( ; i < buf_size ; i ++ ) { dctx -> cur_byte ++ ; state = ( state << 8 ) | buf [ i ] ; if ( dctx -> cur_byte == 24 ) { dctx -> h = ( state >> 32 ) & 0xFFFF ; } else if ( dctx -> cur_byte == 26 ) { dctx -> w = ( state >> 32 ) & 0xFFFF ; } else if ( dctx -> cur_byte == 42 ) { int cid = ( state >> 32 ) & 0xFFFFFFFF ; <S2SV_StartBug> if ( cid <= 0 ) <S2SV_EndBug> continue ; <S2SV_StartBug> dctx -> remaining = avpriv_dnxhd_get_frame_size ( cid ) ; <S2SV_EndBug> <S2SV_StartBug> if ( dctx -> remaining <= 0 ) { <S2SV_EndBug> <S2SV_StartBug> dctx -> remaining = dnxhd_get_hr_frame_size ( cid , dctx -> w , dctx -> h ) ; <S2SV_EndBug> <S2SV_StartBug> if ( dctx -> remaining <= 0 ) <S2SV_EndBug> <S2SV_StartBug> return dctx -> remaining ; <S2SV_EndBug> } if ( buf_size - i >= dctx -> remaining && ( ! dctx -> interlaced || dctx -> cur_field ) ) { int remaining = dctx -> remaining ; pc -> frame_start_found = 0 ; pc -> state64 = - 1 ; dctx -> interlaced = interlaced ; dctx -> cur_field = 0 ; dctx -> cur_byte = 0 ; dctx -> remaining = 0 ; return remaining ; } else { dctx -> remaining -= buf_size ; } } } } else if ( pic_found ) { if ( dctx -> remaining > buf_size ) { dctx -> remaining -= buf_size ; } else { int remaining = dctx -> remaining ; pc -> frame_start_found = 0 ; pc -> state64 = - 1 ; dctx -> interlaced = interlaced ; dctx -> cur_field = 0 ; dctx -> cur_byte = 0 ; dctx -> remaining = 0 ; return remaining ; } } pc -> frame_start_found = pic_found ; pc -> state64 = state ; dctx -> interlaced = interlaced ; dctx -> cur_field = cur_field ; return END_NOT_FOUND ; }
| <S2SV_ModStart> & 0xFFFFFFFF ; int remaining ; <S2SV_ModStart> ) continue ; <S2SV_ModEnd> remaining = avpriv_dnxhd_get_frame_size <S2SV_ModStart> ; if ( <S2SV_ModEnd> remaining <= 0 <S2SV_ModStart> 0 ) { <S2SV_ModEnd> remaining = dnxhd_get_hr_frame_size <S2SV_ModStart> ; if ( <S2SV_ModEnd> remaining <= 0 <S2SV_ModStart> <= 0 ) continue ; } dctx -> remaining = remaining ; <S2SV_ModEnd> if ( buf_size
| FFmpeg@FFmpeg/31c1c0b46a7021802c3d1d18039fca30dba5a14e | CVE-2017-9608 | https://github.com/FFmpeg/FFmpeg/commit/31c1c0b46a7021802c3d1d18039fca30dba5a14e | 2017-12-27T19:29Z |
19 | CWE-787 | CWE-787 grub_ssize_t grub_fshelp_read_file ( grub_disk_t disk , grub_fshelp_node_t node , void ( * read_hook ) ( grub_disk_addr_t sector , unsigned offset , unsigned length , void * closure ) , void * closure , int flags , grub_off_t pos , grub_size_t len , char * buf , grub_disk_addr_t ( * get_block ) ( grub_fshelp_node_t node , grub_disk_addr_t block ) , grub_off_t filesize , int log2blocksize ) { grub_disk_addr_t i , blockcnt ; int blocksize = 1 << ( log2blocksize + GRUB_DISK_SECTOR_BITS ) ; if ( pos + len > filesize ) len = filesize - pos ; <S2SV_StartBug> blockcnt = ( ( len + pos ) + blocksize - 1 ) >> <S2SV_EndBug> ( log2blocksize + GRUB_DISK_SECTOR_BITS ) ; for ( i = pos >> ( log2blocksize + GRUB_DISK_SECTOR_BITS ) ; i < blockcnt ; i ++ ) { grub_disk_addr_t blknr ; int blockoff = pos & ( blocksize - 1 ) ; int blockend = blocksize ; int skipfirst = 0 ; blknr = get_block ( node , i ) ; if ( grub_errno ) return - 1 ; blknr = blknr << log2blocksize ; if ( i == blockcnt - 1 ) { blockend = ( len + pos ) & ( blocksize - 1 ) ; if ( ! blockend ) blockend = blocksize ; } if ( i == ( pos >> ( log2blocksize + GRUB_DISK_SECTOR_BITS ) ) ) { skipfirst = blockoff ; blockend -= skipfirst ; } if ( blknr ) { disk -> read_hook = read_hook ; disk -> closure = closure ; grub_hack_lastoff = blknr * 512 ; grub_disk_read_ex ( disk , blknr , skipfirst , blockend , buf , flags ) ; disk -> read_hook = 0 ; if ( grub_errno ) return - 1 ; } else if ( buf ) grub_memset ( buf , 0 , blockend ) ; if ( buf ) buf += blocksize - skipfirst ; } return len ; }
| <S2SV_ModStart> - pos ; if ( len < 1 || len == 0xffffffff ) { return - 1 ; }
| radare@radare2/796dd28aaa6b9fa76d99c42c4d5ff8b257cc2191 | CVE-2017-9949 | https://github.com/radare/radare2/commit/796dd28aaa6b9fa76d99c42c4d5ff8b257cc2191 | 2017-06-26T20:29Z |
20 | CWE-476 | CWE-476 int migrate_page_move_mapping ( struct address_space * mapping , struct page * newpage , struct page * page , struct buffer_head * head , enum migrate_mode mode , int extra_count ) { <S2SV_StartBug> int expected_count = 1 + extra_count ; <S2SV_EndBug> void * * pslot ; if ( ! mapping ) { if ( page_count ( page ) != expected_count ) return - EAGAIN ; set_page_memcg ( newpage , page_memcg ( page ) ) ; newpage -> index = page -> index ; newpage -> mapping = page -> mapping ; if ( PageSwapBacked ( page ) ) SetPageSwapBacked ( newpage ) ; return MIGRATEPAGE_SUCCESS ; <S2SV_StartBug> } <S2SV_EndBug> spin_lock_irq ( & mapping -> tree_lock ) ; pslot = radix_tree_lookup_slot ( & mapping -> page_tree , page_index ( page ) ) ; expected_count += 1 + page_has_private ( page ) ; if ( page_count ( page ) != expected_count || radix_tree_deref_slot_protected ( pslot , & mapping -> tree_lock ) != page ) { spin_unlock_irq ( & mapping -> tree_lock ) ; return - EAGAIN ; } if ( ! page_freeze_refs ( page , expected_count ) ) { spin_unlock_irq ( & mapping -> tree_lock ) ; return - EAGAIN ; } if ( mode == MIGRATE_ASYNC && head && ! buffer_migrate_lock_buffers ( head , mode ) ) { page_unfreeze_refs ( page , expected_count ) ; spin_unlock_irq ( & mapping -> tree_lock ) ; return - EAGAIN ; } set_page_memcg ( newpage , page_memcg ( page ) ) ; newpage -> index = page -> index ; newpage -> mapping = page -> mapping ; if ( PageSwapBacked ( page ) ) SetPageSwapBacked ( newpage ) ; get_page ( newpage ) ; if ( PageSwapCache ( page ) ) { SetPageSwapCache ( newpage ) ; set_page_private ( newpage , page_private ( page ) ) ; } <S2SV_StartBug> radix_tree_replace_slot ( pslot , newpage ) ; <S2SV_EndBug> page_unfreeze_refs ( page , expected_count - 1 ) ; <S2SV_StartBug> __dec_zone_page_state ( page , NR_FILE_PAGES ) ; <S2SV_EndBug> <S2SV_StartBug> __inc_zone_page_state ( newpage , NR_FILE_PAGES ) ; <S2SV_EndBug> <S2SV_StartBug> if ( ! PageSwapCache ( page ) && PageSwapBacked ( page ) ) { <S2SV_EndBug> __dec_zone_page_state ( page , NR_SHMEM ) ; __inc_zone_page_state ( newpage , NR_SHMEM ) ; } spin_unlock_irq ( & mapping -> tree_lock ) ; return MIGRATEPAGE_SUCCESS ; }
| <S2SV_ModStart> extra_count ) { struct zone * oldzone , * newzone ; int dirty ; <S2SV_ModStart> MIGRATEPAGE_SUCCESS ; } oldzone = page_zone ( page ) ; newzone = page_zone ( newpage ) ; <S2SV_ModStart> ) ; } dirty = PageDirty ( page ) ; if ( dirty ) { ClearPageDirty ( page ) ; SetPageDirty ( newpage ) ; } <S2SV_ModStart> 1 ) ; spin_unlock ( & mapping -> tree_lock ) ; if ( newzone != oldzone ) { __dec_zone_state ( oldzone <S2SV_ModEnd> , NR_FILE_PAGES ) <S2SV_ModStart> NR_FILE_PAGES ) ; __inc_zone_state ( newzone <S2SV_ModEnd> , NR_FILE_PAGES ) <S2SV_ModStart> ; if ( PageSwapBacked ( page ) && <S2SV_ModStart> ( page ) ) { __dec_zone_state ( oldzone , NR_SHMEM ) ; __inc_zone_state ( newzone , NR_SHMEM ) ; } if ( dirty && mapping_cap_account_dirty ( mapping ) ) { __dec_zone_state ( oldzone , NR_FILE_DIRTY ) ; __inc_zone_state ( newzone , NR_FILE_DIRTY ) ; } } local_irq_enable ( <S2SV_ModEnd> ) ; return
| torvalds@linux/42cb14b110a5698ccf26ce59c4441722605a3743 | CVE-2016-3070 | https://github.com/torvalds/linux/commit/42cb14b110a5698ccf26ce59c4441722605a3743 | 2016-08-06T20:59Z |
21 | CWE-119 | CWE-119 static guint32 parse_wbxml_attribute_list_defined ( proto_tree * tree , tvbuff_t * tvb , guint32 offset , guint32 str_tbl , guint8 level , guint8 * codepage_attr , const wbxml_decoding * map ) { guint32 tvb_len = tvb_reported_length ( tvb ) ; <S2SV_StartBug> guint32 off = offset ; <S2SV_EndBug> guint32 len ; guint str_len ; guint32 ent ; guint32 idx ; guint8 peek ; guint8 attr_save_known = 0 ; const char * attr_save_literal = NULL ; DebugLog ( ( "parse_wbxml_attr_defined<S2SV_blank>(level<S2SV_blank>=<S2SV_blank>%u,<S2SV_blank>offset<S2SV_blank>=<S2SV_blank>%u)\\n" , <S2SV_StartBug> level , offset ) ) ; <S2SV_EndBug> while ( off < tvb_len ) { peek = tvb_get_guint8 ( tvb , off ) ; DebugLog ( ( "ATTR:<S2SV_blank>(top<S2SV_blank>of<S2SV_blank>while)<S2SV_blank>level<S2SV_blank>=<S2SV_blank>%3u,<S2SV_blank>peek<S2SV_blank>=<S2SV_blank>0x%02X,<S2SV_blank>" "off<S2SV_blank>=<S2SV_blank>%u,<S2SV_blank>tvb_len<S2SV_blank>=<S2SV_blank>%u\\n" , level , peek , off , tvb_len ) ) ; if ( ( peek & 0x3F ) < 5 ) switch ( peek ) { case 0x00 : * codepage_attr = tvb_get_guint8 ( tvb , off + 1 ) ; proto_tree_add_text ( tree , tvb , off , 2 , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>-->%3d<S2SV_blank>" "|<S2SV_blank>SWITCH_PAGE<S2SV_blank>(Attr<S2SV_blank>code<S2SV_blank>page)<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>|" , * codepage_attr ) ; off += 2 ; break ; case 0x01 : off ++ ; DebugLog ( ( "ATTR:<S2SV_blank>level<S2SV_blank>=<S2SV_blank>%u,<S2SV_blank>Return:<S2SV_blank>len<S2SV_blank>=<S2SV_blank>%u\\n" , level , off - offset ) ) ; return ( off - offset ) ; case 0x02 : ent = tvb_get_guintvar ( tvb , off + 1 , & len ) ; proto_tree_add_text ( tree , tvb , off , 1 + len , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>ENTITY<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%s\'&#%u;\'" , level , * codepage_attr , Indent ( level ) , ent ) ; off += 1 + len ; break ; case 0x03 : len = tvb_strsize ( tvb , off + 1 ) ; proto_tree_add_text ( tree , tvb , off , 1 + len , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>STR_I<S2SV_blank>(Inline<S2SV_blank>string)<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%s\\\'%s\\\'" , level , * codepage_attr , Indent ( level ) , tvb_format_text ( tvb , off + 1 , len - 1 ) ) ; off += 1 + len ; break ; case 0x04 : idx = tvb_get_guintvar ( tvb , off + 1 , & len ) ; str_len = tvb_strsize ( tvb , str_tbl + idx ) ; attr_save_known = 0 ; attr_save_literal = tvb_format_text ( tvb , str_tbl + idx , str_len - 1 ) ; proto_tree_add_text ( tree , tvb , off , 1 + len , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>LITERAL<S2SV_blank>(Literal<S2SV_blank>Attribute)<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank>%s<%s<S2SV_blank>/>" , level , * codepage_attr , Indent ( level ) , attr_save_literal ) ; off += 1 + len ; break ; case 0x40 : case 0x41 : case 0x42 : len = tvb_strsize ( tvb , off + 1 ) ; proto_tree_add_text ( tree , tvb , off , 1 + len , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>EXT_I_%1x<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>(Extension<S2SV_blank>Token)<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%s(%s:<S2SV_blank>\\\'%s\\\')" , level , * codepage_attr , peek & 0x0f , Indent ( level ) , map_token ( map -> global , 0 , peek ) , tvb_format_text ( tvb , off + 1 , len - 1 ) ) ; off += 1 + len ; break ; case 0x80 : case 0x81 : case 0x82 : idx = tvb_get_guintvar ( tvb , off + 1 , & len ) ; { char * s ; if ( map -> ext_t [ peek & 0x03 ] ) s = ( map -> ext_t [ peek & 0x03 ] ) ( tvb , idx , str_tbl ) ; else s = wmem_strdup_printf ( wmem_packet_scope ( ) , "EXT_T_%1x<S2SV_blank>(%s)" , peek & 0x03 , map_token ( map -> global , 0 , peek ) ) ; proto_tree_add_text ( tree , tvb , off , 1 + len , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank>Tag<S2SV_blank><S2SV_blank><S2SV_blank>|<S2SV_blank>T<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>EXT_T_%1x<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>(Extension<S2SV_blank>Token)<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>%s%s)" , level , * codepage_attr , peek & 0x0f , Indent ( level ) , s ) ; } off += 1 + len ; break ; case 0x83 : idx = tvb_get_guintvar ( tvb , off + 1 , & len ) ; str_len = tvb_strsize ( tvb , str_tbl + idx ) ; proto_tree_add_text ( tree , tvb , off , 1 + len , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>STR_T<S2SV_blank>(Tableref<S2SV_blank>string)<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%s\\\'%s\\\'" , level , * codepage_attr , Indent ( level ) , tvb_format_text ( tvb , str_tbl + idx , str_len - 1 ) ) ; off += 1 + len ; break ; case 0xC0 : case 0xC1 : case 0xC2 : proto_tree_add_text ( tree , tvb , off , 1 , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>EXT_%1x<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>(Extension<S2SV_blank>Token)<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%s(%s)" , level , * codepage_attr , peek & 0x0f , Indent ( level ) , map_token ( map -> global , 0 , peek ) ) ; off ++ ; break ; case 0xC3 : if ( tvb_get_guint8 ( tvb , 0 ) ) { char * str ; if ( attr_save_known ) { if ( map -> opaque_binary_attr ) { str = map -> opaque_binary_attr ( tvb , off + 1 , attr_save_known , * codepage_attr , & len ) ; } else { str = default_opaque_binary_attr ( tvb , off + 1 , attr_save_known , * codepage_attr , & len ) ; } } else { if ( map -> opaque_literal_tag ) { str = map -> opaque_literal_attr ( tvb , off + 1 , attr_save_literal , * codepage_attr , & len ) ; } else { str = default_opaque_literal_attr ( tvb , off + 1 , attr_save_literal , * codepage_attr , & len ) ; } } proto_tree_add_text ( tree , tvb , off , 1 + len , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>OPAQUE<S2SV_blank>(Opaque<S2SV_blank>data)<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%s%s" , level , * codepage_attr , Indent ( level ) , str ) ; off += 1 + len ; } else { proto_tree_add_text ( tree , tvb , off , 1 , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>RESERVED_2<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>(Invalid<S2SV_blank>Token!)<S2SV_blank>" "|<S2SV_blank>WBXML<S2SV_blank>1.0<S2SV_blank>parsing<S2SV_blank>stops<S2SV_blank>here." , level , * codepage_attr ) ; off = tvb_len ; DebugLog ( ( "ATTR:<S2SV_blank>level<S2SV_blank>=<S2SV_blank>%u,<S2SV_blank>Return:<S2SV_blank>len<S2SV_blank>=<S2SV_blank>%u\\n" , level , off - offset ) ) ; return ( off - offset ) ; } break ; default : proto_tree_add_text ( tree , tvb , off , 1 , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank>%-10s<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>(Invalid<S2SV_blank>Token!)<S2SV_blank>" "|<S2SV_blank>WBXML<S2SV_blank>parsing<S2SV_blank>stops<S2SV_blank>here." , level , * codepage_attr , val_to_str_ext ( peek , & vals_wbxml1x_global_tokens_ext , "(unknown<S2SV_blank>0x%x)" ) ) ; off = tvb_len ; break ; } else { if ( peek & 0x80 ) { proto_tree_add_text ( tree , tvb , off , 1 , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank>Known<S2SV_blank>attrValue<S2SV_blank>0x%02X<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%s%s" , level , * codepage_attr , peek & 0x7f , Indent ( level ) , map_token ( map -> attrValue , * codepage_attr , peek ) ) ; off ++ ; } else { attr_save_known = peek & 0x7f ; proto_tree_add_text ( tree , tvb , off , 1 , "<S2SV_blank><S2SV_blank>%3d<S2SV_blank>|<S2SV_blank><S2SV_blank>Attr<S2SV_blank>|<S2SV_blank>A<S2SV_blank>%3d<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank>Known<S2SV_blank>attrStart<S2SV_blank>0x%02X<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" "|<S2SV_blank><S2SV_blank><S2SV_blank>%s%s" , level , * codepage_attr , attr_save_known , Indent ( level ) , map_token ( map -> attrStart , * codepage_attr , peek ) ) ; off ++ ; } } <S2SV_StartBug> } <S2SV_EndBug> DebugLog ( ( "ATTR:<S2SV_blank>level<S2SV_blank>=<S2SV_blank>%u,<S2SV_blank>Return:<S2SV_blank>len<S2SV_blank>=<S2SV_blank>%u<S2SV_blank>(end<S2SV_blank>of<S2SV_blank>function<S2SV_blank>body)\\n" , level , off - offset ) ) ; return ( off - offset ) ; }
| <S2SV_ModStart> off = offset , last_off <S2SV_ModStart> offset ) ) ; last_off = off <S2SV_ModStart> ; } } if ( off < last_off ) { THROW ( ReportedBoundsError ) ; } last_off = off ;
| wireshark@wireshark/b8e0d416898bb975a02c1b55883342edc5b4c9c0 | CVE-2016-5359 | https://github.com/wireshark/wireshark/commit/b8e0d416898bb975a02c1b55883342edc5b4c9c0 | 2016-08-07T16:59Z |
22 | CWE-119 | CWE-119 void vp9_encode_frame ( VP9_COMP * cpi ) { VP9_COMMON * const cm = & cpi -> common ; if ( ! frame_is_intra_only ( cm ) ) { if ( ( cm -> ref_frame_sign_bias [ ALTREF_FRAME ] == cm -> ref_frame_sign_bias [ GOLDEN_FRAME ] ) || ( cm -> ref_frame_sign_bias [ ALTREF_FRAME ] == cm -> ref_frame_sign_bias [ LAST_FRAME ] ) ) { <S2SV_StartBug> cm -> allow_comp_inter_inter = 0 ; <S2SV_EndBug> } else { <S2SV_StartBug> cm -> allow_comp_inter_inter = 1 ; <S2SV_EndBug> cm -> comp_fixed_ref = ALTREF_FRAME ; cm -> comp_var_ref [ 0 ] = LAST_FRAME ; cm -> comp_var_ref [ 1 ] = GOLDEN_FRAME ; } } if ( cpi -> sf . frame_parameter_update ) { <S2SV_StartBug> int i ; <S2SV_EndBug> const MV_REFERENCE_FRAME frame_type = get_frame_type ( cpi ) ; <S2SV_StartBug> const int64_t * mode_thresh = cpi -> rd_prediction_type_threshes [ frame_type ] ; <S2SV_EndBug> <S2SV_StartBug> const int64_t * filter_thresh = cpi -> rd_filter_threshes [ frame_type ] ; <S2SV_EndBug> <S2SV_StartBug> if ( frame_type == ALTREF_FRAME || ! cm -> allow_comp_inter_inter ) <S2SV_EndBug> cm -> reference_mode = SINGLE_REFERENCE ; <S2SV_StartBug> else if ( mode_thresh [ COMPOUND_REFERENCE ] > mode_thresh [ SINGLE_REFERENCE ] && <S2SV_EndBug> <S2SV_StartBug> mode_thresh [ COMPOUND_REFERENCE ] > <S2SV_EndBug> <S2SV_StartBug> mode_thresh [ REFERENCE_MODE_SELECT ] && <S2SV_EndBug> check_dual_ref_flags ( cpi ) && cpi -> static_mb_pct == 100 ) cm -> reference_mode = COMPOUND_REFERENCE ; <S2SV_StartBug> else if ( mode_thresh [ SINGLE_REFERENCE ] > mode_thresh [ REFERENCE_MODE_SELECT ] ) <S2SV_EndBug> cm -> reference_mode = SINGLE_REFERENCE ; else cm -> reference_mode = REFERENCE_MODE_SELECT ; <S2SV_StartBug> if ( cm -> interp_filter == SWITCHABLE ) { <S2SV_EndBug> if ( frame_type != ALTREF_FRAME && filter_thresh [ EIGHTTAP_SMOOTH ] > filter_thresh [ EIGHTTAP ] && filter_thresh [ EIGHTTAP_SMOOTH ] > filter_thresh [ EIGHTTAP_SHARP ] && filter_thresh [ EIGHTTAP_SMOOTH ] > filter_thresh [ SWITCHABLE - 1 ] ) { <S2SV_StartBug> cm -> interp_filter = EIGHTTAP_SMOOTH ; <S2SV_EndBug> } else if ( filter_thresh [ EIGHTTAP_SHARP ] > filter_thresh [ EIGHTTAP ] && filter_thresh [ EIGHTTAP_SHARP ] > filter_thresh [ SWITCHABLE - 1 ] ) { cm -> interp_filter = EIGHTTAP_SHARP ; } else if ( filter_thresh [ EIGHTTAP ] > filter_thresh [ SWITCHABLE - 1 ] ) { cm -> interp_filter = EIGHTTAP ; } } encode_frame_internal ( cpi ) ; <S2SV_StartBug> for ( i = 0 ; i < REFERENCE_MODES ; ++ i ) { <S2SV_EndBug> <S2SV_StartBug> const int diff = ( int ) ( cpi -> rd_comp_pred_diff [ i ] / cm -> MBs ) ; <S2SV_EndBug> cpi -> rd_prediction_type_threshes [ frame_type ] [ i ] += diff ; cpi -> rd_prediction_type_threshes [ frame_type ] [ i ] >>= 1 ; } <S2SV_StartBug> for ( i = 0 ; i < SWITCHABLE_FILTER_CONTEXTS ; i ++ ) { <S2SV_EndBug> <S2SV_StartBug> const int64_t diff = cpi -> rd_filter_diff [ i ] / cm -> MBs ; <S2SV_EndBug> cpi -> rd_filter_threshes [ frame_type ] [ i ] = ( cpi -> rd_filter_threshes [ frame_type ] [ i ] + diff ) / 2 ; <S2SV_StartBug> } <S2SV_EndBug> for ( i = 0 ; i < TX_MODES ; ++ i ) { int64_t pd = cpi -> rd_tx_select_diff [ i ] ; int diff ; if ( i == TX_MODE_SELECT ) pd -= RDCOST ( cpi -> mb . rdmult , cpi -> mb . rddiv , 2048 * ( TX_SIZES - 1 ) , 0 ) ; diff = ( int ) ( pd / cm -> MBs ) ; cpi -> rd_tx_select_threshes [ frame_type ] [ i ] += diff ; cpi -> rd_tx_select_threshes [ frame_type ] [ i ] /= 2 ; } if ( cm -> reference_mode == REFERENCE_MODE_SELECT ) { int single_count_zero = 0 ; int comp_count_zero = 0 ; for ( i = 0 ; i < COMP_INTER_CONTEXTS ; i ++ ) { <S2SV_StartBug> single_count_zero += cm -> counts . comp_inter [ i ] [ 0 ] ; <S2SV_EndBug> <S2SV_StartBug> comp_count_zero += cm -> counts . comp_inter [ i ] [ 1 ] ; <S2SV_EndBug> } if ( comp_count_zero == 0 ) { cm -> reference_mode = SINGLE_REFERENCE ; <S2SV_StartBug> vp9_zero ( cm -> counts . comp_inter ) ; <S2SV_EndBug> } else if ( single_count_zero == 0 ) { cm -> reference_mode = COMPOUND_REFERENCE ; <S2SV_StartBug> vp9_zero ( cm -> counts . comp_inter ) ; <S2SV_EndBug> } } if ( cm -> tx_mode == TX_MODE_SELECT ) { int count4x4 = 0 ; int count8x8_lp = 0 , count8x8_8x8p = 0 ; int count16x16_16x16p = 0 , count16x16_lp = 0 ; int count32x32 = 0 ; for ( i = 0 ; i < TX_SIZE_CONTEXTS ; ++ i ) { <S2SV_StartBug> count4x4 += cm -> counts . tx . p32x32 [ i ] [ TX_4X4 ] ; <S2SV_EndBug> <S2SV_StartBug> count4x4 += cm -> counts . tx . p16x16 [ i ] [ TX_4X4 ] ; <S2SV_EndBug> <S2SV_StartBug> count4x4 += cm -> counts . tx . p8x8 [ i ] [ TX_4X4 ] ; <S2SV_EndBug> <S2SV_StartBug> count8x8_lp += cm -> counts . tx . p32x32 [ i ] [ TX_8X8 ] ; <S2SV_EndBug> <S2SV_StartBug> count8x8_lp += cm -> counts . tx . p16x16 [ i ] [ TX_8X8 ] ; <S2SV_EndBug> <S2SV_StartBug> count8x8_8x8p += cm -> counts . tx . p8x8 [ i ] [ TX_8X8 ] ; <S2SV_EndBug> <S2SV_StartBug> count16x16_16x16p += cm -> counts . tx . p16x16 [ i ] [ TX_16X16 ] ; <S2SV_EndBug> <S2SV_StartBug> count16x16_lp += cm -> counts . tx . p32x32 [ i ] [ TX_16X16 ] ; <S2SV_EndBug> <S2SV_StartBug> count32x32 += cm -> counts . tx . p32x32 [ i ] [ TX_32X32 ] ; <S2SV_EndBug> } if ( count4x4 == 0 && count16x16_lp == 0 && count16x16_16x16p == 0 && count32x32 == 0 ) { cm -> tx_mode = ALLOW_8X8 ; <S2SV_StartBug> reset_skip_txfm_size ( cm , TX_8X8 ) ; <S2SV_EndBug> } else if ( count8x8_8x8p == 0 && count16x16_16x16p == 0 && count8x8_lp == 0 && count16x16_lp == 0 && count32x32 == 0 ) { cm -> tx_mode = ONLY_4X4 ; <S2SV_StartBug> reset_skip_txfm_size ( cm , TX_4X4 ) ; <S2SV_EndBug> } else if ( count8x8_lp == 0 && count16x16_lp == 0 && count4x4 == 0 ) { cm -> tx_mode = ALLOW_32X32 ; } else if ( count32x32 == 0 && count8x8_lp == 0 && count4x4 == 0 ) { cm -> tx_mode = ALLOW_16X16 ; <S2SV_StartBug> reset_skip_txfm_size ( cm , TX_16X16 ) ; <S2SV_EndBug> } } } else { cm -> reference_mode = SINGLE_REFERENCE ; <S2SV_StartBug> cm -> interp_filter = SWITCHABLE ; <S2SV_EndBug> encode_frame_internal ( cpi ) ; } }
| <S2SV_ModStart> ) ) { cpi <S2SV_ModEnd> -> allow_comp_inter_inter = <S2SV_ModStart> } else { cpi <S2SV_ModEnd> -> allow_comp_inter_inter = <S2SV_ModStart> { int i ; RD_OPT * const rd_opt = & cpi -> rd ; FRAME_COUNTS * counts = cpi -> td . counts ; RD_COUNTS * const rdc = & cpi -> td . rd_counts <S2SV_ModStart> cpi ) ; int64_t * const mode_thrs = rd_opt -> prediction_type_threshes <S2SV_ModEnd> [ frame_type ] <S2SV_ModStart> frame_type ] ; int64_t * const filter_thrs = rd_opt -> filter_threshes <S2SV_ModEnd> [ frame_type ] <S2SV_ModStart> frame_type ] ; const int is_alt_ref = <S2SV_ModEnd> frame_type == ALTREF_FRAME <S2SV_ModStart> frame_type == ALTREF_FRAME ; if ( is_alt_ref || ! cpi <S2SV_ModEnd> -> allow_comp_inter_inter ) <S2SV_ModStart> else if ( mode_thrs <S2SV_ModEnd> [ COMPOUND_REFERENCE ] <S2SV_ModStart> COMPOUND_REFERENCE ] > mode_thrs <S2SV_ModEnd> [ SINGLE_REFERENCE ] <S2SV_ModStart> SINGLE_REFERENCE ] && mode_thrs <S2SV_ModEnd> [ COMPOUND_REFERENCE ] <S2SV_ModStart> COMPOUND_REFERENCE ] > mode_thrs <S2SV_ModEnd> [ REFERENCE_MODE_SELECT ] <S2SV_ModStart> else if ( mode_thrs <S2SV_ModEnd> [ SINGLE_REFERENCE ] <S2SV_ModStart> SINGLE_REFERENCE ] > mode_thrs <S2SV_ModEnd> [ REFERENCE_MODE_SELECT ] <S2SV_ModStart> == SWITCHABLE ) <S2SV_ModEnd> cm -> interp_filter <S2SV_ModStart> -> interp_filter = get_interp_filter ( filter_thrs , is_alt_ref ) ; <S2SV_ModEnd> encode_frame_internal ( cpi <S2SV_ModStart> ++ i ) mode_thrs [ i ] = ( mode_thrs [ i ] + rdc -> comp_pred_diff <S2SV_ModEnd> [ i ] <S2SV_ModStart> -> MBs ) / 2 ; <S2SV_ModEnd> for ( i <S2SV_ModStart> < SWITCHABLE_FILTER_CONTEXTS ; ++ i ) filter_thrs [ i ] = ( filter_thrs [ i ] + rdc -> filter_diff <S2SV_ModEnd> [ i ] <S2SV_ModStart> cm -> MBs <S2SV_ModEnd> ) / 2 <S2SV_ModStart> / 2 ; <S2SV_ModEnd> if ( cm <S2SV_ModStart> { single_count_zero += counts -> <S2SV_ModEnd> comp_inter [ i <S2SV_ModStart> ; comp_count_zero += counts -> <S2SV_ModEnd> comp_inter [ i <S2SV_ModStart> ; vp9_zero ( counts -> <S2SV_ModEnd> comp_inter ) ; <S2SV_ModStart> ; vp9_zero ( counts -> <S2SV_ModEnd> comp_inter ) ; <S2SV_ModStart> { count4x4 += counts -> <S2SV_ModEnd> tx . p32x32 <S2SV_ModStart> ; count4x4 += counts -> <S2SV_ModEnd> tx . p16x16 <S2SV_ModStart> ; count4x4 += counts -> <S2SV_ModEnd> tx . p8x8 <S2SV_ModStart> ; count8x8_lp += counts -> <S2SV_ModEnd> tx . p32x32 <S2SV_ModStart> ; count8x8_lp += counts -> <S2SV_ModEnd> tx . p16x16 <S2SV_ModStart> ; count8x8_8x8p += counts -> <S2SV_ModEnd> tx . p8x8 <S2SV_ModStart> ; count16x16_16x16p += counts -> <S2SV_ModEnd> tx . p16x16 <S2SV_ModStart> ; count16x16_lp += counts -> <S2SV_ModEnd> tx . p32x32 <S2SV_ModStart> ; count32x32 += counts -> <S2SV_ModEnd> tx . p32x32 <S2SV_ModStart> = ALLOW_8X8 ; reset_skip_tx_size <S2SV_ModEnd> ( cm , <S2SV_ModStart> = ONLY_4X4 ; reset_skip_tx_size <S2SV_ModEnd> ( cm , <S2SV_ModStart> = ALLOW_16X16 ; reset_skip_tx_size <S2SV_ModEnd> ( cm , <S2SV_ModStart> = SINGLE_REFERENCE ; <S2SV_ModEnd> encode_frame_internal ( cpi
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
23 | CWE-787 | CWE-787 int input_set_keycode ( struct input_dev * dev , const struct input_keymap_entry * ke ) { unsigned long flags ; unsigned int old_keycode ; int retval ; if ( ke -> keycode > KEY_MAX ) return - EINVAL ; spin_lock_irqsave ( & dev -> event_lock , flags ) ; retval = dev -> setkeycode ( dev , ke , & old_keycode ) ; if ( retval ) goto out ; __clear_bit ( KEY_RESERVED , dev -> keybit ) ; <S2SV_StartBug> if ( test_bit ( EV_KEY , dev -> evbit ) && <S2SV_EndBug> ! is_event_supported ( old_keycode , dev -> keybit , KEY_MAX ) && __test_and_clear_bit ( old_keycode , dev -> key ) ) { struct input_value vals [ ] = { { EV_KEY , old_keycode , 0 } , input_value_sync } ; input_pass_values ( dev , vals , ARRAY_SIZE ( vals ) ) ; } out : spin_unlock_irqrestore ( & dev -> event_lock , flags ) ; return retval ; }
| <S2SV_ModStart> keybit ) ; if ( old_keycode > KEY_MAX ) { dev_warn ( dev -> dev . parent ? : & dev -> dev , "%s:<S2SV_blank>got<S2SV_blank>too<S2SV_blank>big<S2SV_blank>old<S2SV_blank>keycode<S2SV_blank>%#x\\n" , __func__ , old_keycode ) ; } else
| torvalds@linux/cb222aed03d798fc074be55e59d9a112338ee784 | CVE-2019-20636 | https://github.com/torvalds/linux/commit/cb222aed03d798fc074be55e59d9a112338ee784 | 2020-04-08T14:15Z |
24 | CWE-189 | CWE-189 BOOL license_read_scope_list ( wStream * s , SCOPE_LIST * scopeList ) { UINT32 i ; UINT32 scopeCount ; if ( Stream_GetRemainingLength ( s ) < 4 ) return FALSE ; <S2SV_StartBug> Stream_Read_UINT32 ( s , scopeCount ) ; <S2SV_EndBug> scopeList -> count = scopeCount ; scopeList -> array = ( LICENSE_BLOB * ) malloc ( sizeof ( LICENSE_BLOB ) * scopeCount ) ; for ( i = 0 ; i < scopeCount ; i ++ ) { scopeList -> array [ i ] . type = BB_SCOPE_BLOB ; if ( ! license_read_binary_blob ( s , & scopeList -> array [ i ] ) ) return FALSE ; } return TRUE ; }
| <S2SV_ModStart> , scopeCount ) ; if ( Stream_GetRemainingLength ( s ) / sizeof ( LICENSE_BLOB ) < scopeCount ) return FALSE
| sidhpurwala-huzaifa@FreeRDP/e2745807c4c3e0a590c0f69a9b655dc74ebaa03e | CVE-2014-0791 | https://github.com/sidhpurwala-huzaifa/FreeRDP/commit/e2745807c4c3e0a590c0f69a9b655dc74ebaa03e | 2014-01-03T18:54Z |
25 | CWE-190 | CWE-190 STATIC struct posix_acl * xfs_acl_from_disk ( struct xfs_acl * aclp ) { struct posix_acl_entry * acl_e ; struct posix_acl * acl ; struct xfs_acl_entry * ace ; int count , i ; <S2SV_StartBug> count = be32_to_cpu ( aclp -> acl_cnt ) ; <S2SV_EndBug> acl = posix_acl_alloc ( count , GFP_KERNEL ) ; if ( ! acl ) return ERR_PTR ( - ENOMEM ) ; for ( i = 0 ; i < count ; i ++ ) { acl_e = & acl -> a_entries [ i ] ; ace = & aclp -> acl_entry [ i ] ; acl_e -> e_tag = be32_to_cpu ( ace -> ae_tag ) ; acl_e -> e_perm = be16_to_cpu ( ace -> ae_perm ) ; switch ( acl_e -> e_tag ) { case ACL_USER : case ACL_GROUP : acl_e -> e_id = be32_to_cpu ( ace -> ae_id ) ; break ; case ACL_USER_OBJ : case ACL_GROUP_OBJ : case ACL_MASK : case ACL_OTHER : acl_e -> e_id = ACL_UNDEFINED_ID ; break ; default : goto fail ; } } return acl ; fail : posix_acl_release ( acl ) ; return ERR_PTR ( - EINVAL ) ; }
| <S2SV_ModStart> aclp -> acl_cnt ) ; if ( count > XFS_ACL_MAX_ENTRIES ) return ERR_PTR ( - EFSCORRUPTED
| torvalds@linux/fa8b18edd752a8b4e9d1ee2cd615b82c93cf8bba | CVE-2012-0038 | https://github.com/torvalds/linux/commit/fa8b18edd752a8b4e9d1ee2cd615b82c93cf8bba | 2012-05-17T11:00Z |
26 | CWE-000 | CWE-000 struct key * key_alloc ( struct key_type * type , const char * desc , kuid_t uid , kgid_t gid , const struct cred * cred , key_perm_t perm , unsigned long flags , struct key_restriction * restrict_link ) { struct key_user * user = NULL ; struct key * key ; size_t desclen , quotalen ; int ret ; key = ERR_PTR ( - EINVAL ) ; if ( ! desc || ! * desc ) goto error ; if ( type -> vet_description ) { ret = type -> vet_description ( desc ) ; if ( ret < 0 ) { key = ERR_PTR ( ret ) ; goto error ; } } desclen = strlen ( desc ) ; quotalen = desclen + 1 + type -> def_datalen ; user = key_user_lookup ( uid ) ; if ( ! user ) goto no_memory_1 ; if ( ! ( flags & KEY_ALLOC_NOT_IN_QUOTA ) ) { unsigned maxkeys = uid_eq ( uid , GLOBAL_ROOT_UID ) ? key_quota_root_maxkeys : key_quota_maxkeys ; unsigned maxbytes = uid_eq ( uid , GLOBAL_ROOT_UID ) ? key_quota_root_maxbytes : key_quota_maxbytes ; spin_lock ( & user -> lock ) ; if ( ! ( flags & KEY_ALLOC_QUOTA_OVERRUN ) ) { if ( user -> qnkeys + 1 >= maxkeys || user -> qnbytes + quotalen >= maxbytes || user -> qnbytes + quotalen < user -> qnbytes ) goto no_quota ; } user -> qnkeys ++ ; user -> qnbytes += quotalen ; spin_unlock ( & user -> lock ) ; } key = kmem_cache_zalloc ( key_jar , GFP_KERNEL ) ; if ( ! key ) goto no_memory_2 ; key -> index_key . desc_len = desclen ; key -> index_key . description = kmemdup ( desc , desclen + 1 , GFP_KERNEL ) ; if ( ! key -> index_key . description ) goto no_memory_3 ; refcount_set ( & key -> usage , 1 ) ; init_rwsem ( & key -> sem ) ; lockdep_set_class ( & key -> sem , & type -> lock_class ) ; key -> index_key . type = type ; key -> user = user ; key -> quotalen = quotalen ; key -> datalen = type -> def_datalen ; key -> uid = uid ; key -> gid = gid ; key -> perm = perm ; key -> restrict_link = restrict_link ; if ( ! ( flags & KEY_ALLOC_NOT_IN_QUOTA ) ) key -> flags |= 1 << KEY_FLAG_IN_QUOTA ; if ( flags & KEY_ALLOC_BUILT_IN ) key -> flags |= 1 << KEY_FLAG_BUILTIN ; <S2SV_StartBug> # ifdef KEY_DEBUGGING <S2SV_EndBug> key -> magic = KEY_DEBUG_MAGIC ; # endif ret = security_key_alloc ( key , cred , flags ) ; if ( ret < 0 ) goto security_error ; atomic_inc ( & user -> nkeys ) ; key_alloc_serial ( key ) ; error : return key ; security_error : kfree ( key -> description ) ; kmem_cache_free ( key_jar , key ) ; if ( ! ( flags & KEY_ALLOC_NOT_IN_QUOTA ) ) { spin_lock ( & user -> lock ) ; user -> qnkeys -- ; user -> qnbytes -= quotalen ; spin_unlock ( & user -> lock ) ; } key_user_put ( user ) ; key = ERR_PTR ( ret ) ; goto error ; no_memory_3 : kmem_cache_free ( key_jar , key ) ; no_memory_2 : if ( ! ( flags & KEY_ALLOC_NOT_IN_QUOTA ) ) { spin_lock ( & user -> lock ) ; user -> qnkeys -- ; user -> qnbytes -= quotalen ; spin_unlock ( & user -> lock ) ; } key_user_put ( user ) ; no_memory_1 : key = ERR_PTR ( - ENOMEM ) ; goto error ; no_quota : spin_unlock ( & user -> lock ) ; key_user_put ( user ) ; key = ERR_PTR ( - EDQUOT ) ; goto error ; }
| <S2SV_ModStart> << KEY_FLAG_BUILTIN ; if ( flags & KEY_ALLOC_UID_KEYRING ) key -> flags |= 1 << KEY_FLAG_UID_KEYRING ;
| torvalds@linux/237bbd29f7a049d310d907f4b2716a7feef9abf3 | CVE-2017-18270 | https://github.com/torvalds/linux/commit/237bbd29f7a049d310d907f4b2716a7feef9abf3 | 2018-05-18T16:29Z |
27 | CWE-20 | CWE-20 int tls1_mac ( SSL * ssl , SSL3_RECORD * rec , unsigned char * md , int send ) { unsigned char * seq ; EVP_MD_CTX * hash ; size_t md_size ; int i ; EVP_MD_CTX * hmac = NULL , * mac_ctx ; unsigned char header [ 13 ] ; int stream_mac = ( send ? ( ssl -> mac_flags & SSL_MAC_FLAG_WRITE_MAC_STREAM ) : ( ssl -> mac_flags & SSL_MAC_FLAG_READ_MAC_STREAM ) ) ; int t ; if ( send ) { seq = RECORD_LAYER_get_write_sequence ( & ssl -> rlayer ) ; hash = ssl -> write_hash ; } else { seq = RECORD_LAYER_get_read_sequence ( & ssl -> rlayer ) ; hash = ssl -> read_hash ; } t = EVP_MD_CTX_size ( hash ) ; OPENSSL_assert ( t >= 0 ) ; md_size = t ; if ( stream_mac ) { mac_ctx = hash ; } else { hmac = EVP_MD_CTX_new ( ) ; if ( hmac == NULL || ! EVP_MD_CTX_copy ( hmac , hash ) ) return - 1 ; mac_ctx = hmac ; } if ( SSL_IS_DTLS ( ssl ) ) { unsigned char dtlsseq [ 8 ] , * p = dtlsseq ; s2n ( send ? DTLS_RECORD_LAYER_get_w_epoch ( & ssl -> rlayer ) : DTLS_RECORD_LAYER_get_r_epoch ( & ssl -> rlayer ) , p ) ; memcpy ( p , & seq [ 2 ] , 6 ) ; memcpy ( header , dtlsseq , 8 ) ; } else memcpy ( header , seq , 8 ) ; header [ 8 ] = rec -> type ; header [ 9 ] = ( unsigned char ) ( ssl -> version >> 8 ) ; header [ 10 ] = ( unsigned char ) ( ssl -> version ) ; header [ 11 ] = ( rec -> length ) >> 8 ; header [ 12 ] = ( rec -> length ) & 0xff ; <S2SV_StartBug> if ( ! send && ! SSL_USE_ETM ( ssl ) && <S2SV_EndBug> EVP_CIPHER_CTX_mode ( ssl -> enc_read_ctx ) == EVP_CIPH_CBC_MODE && ssl3_cbc_record_digest_supported ( mac_ctx ) ) { if ( ssl3_cbc_digest_record ( mac_ctx , md , & md_size , header , rec -> input , rec -> length + md_size , rec -> orig_len , ssl -> s3 -> read_mac_secret , ssl -> s3 -> read_mac_secret_size , 0 ) <= 0 ) { EVP_MD_CTX_free ( hmac ) ; return - 1 ; } } else { if ( EVP_DigestSignUpdate ( mac_ctx , header , sizeof ( header ) ) <= 0 || EVP_DigestSignUpdate ( mac_ctx , rec -> input , rec -> length ) <= 0 || EVP_DigestSignFinal ( mac_ctx , md , & md_size ) <= 0 ) { EVP_MD_CTX_free ( hmac ) ; return - 1 ; } <S2SV_StartBug> if ( ! send && ! SSL_USE_ETM ( ssl ) && FIPS_mode ( ) ) <S2SV_EndBug> if ( ! tls_fips_digest_extra ( ssl -> enc_read_ctx , mac_ctx , rec -> input , rec -> length , rec -> orig_len ) ) { EVP_MD_CTX_free ( hmac ) ; return - 1 ; } } EVP_MD_CTX_free ( hmac ) ; # ifdef SSL_DEBUG fprintf ( stderr , "seq=" ) ; { int z ; for ( z = 0 ; z < 8 ; z ++ ) fprintf ( stderr , "%02X<S2SV_blank>" , seq [ z ] ) ; fprintf ( stderr , "\\n" ) ; } fprintf ( stderr , "rec=" ) ; { unsigned int z ; for ( z = 0 ; z < rec -> length ; z ++ ) fprintf ( stderr , "%02X<S2SV_blank>" , rec -> data [ z ] ) ; fprintf ( stderr , "\\n" ) ; } # endif if ( ! SSL_IS_DTLS ( ssl ) ) { for ( i = 7 ; i >= 0 ; i -- ) { ++ seq [ i ] ; if ( seq [ i ] != 0 ) break ; } } # ifdef SSL_DEBUG { unsigned int z ; for ( z = 0 ; z < md_size ; z ++ ) fprintf ( stderr , "%02X<S2SV_blank>" , md [ z ] ) ; fprintf ( stderr , "\\n" ) ; } # endif return ( md_size ) ; }
| <S2SV_ModStart> send && ! SSL_READ_ETM <S2SV_ModEnd> ( ssl ) <S2SV_ModStart> send && ! SSL_READ_ETM <S2SV_ModEnd> ( ssl )
| openssl@openssl/4ad93618d26a3ea23d36ad5498ff4f59eff3a4d2 | CVE-2017-3733 | https://github.com/openssl/openssl/commit/4ad93618d26a3ea23d36ad5498ff4f59eff3a4d2 | 2017-05-04T19:29Z |
28 | CWE-17 | CWE-17 int do_remount_sb ( struct super_block * sb , int flags , void * data , int force ) { int retval ; int remount_ro ; if ( sb -> s_writers . frozen != SB_UNFROZEN ) return - EBUSY ; # ifdef CONFIG_BLOCK if ( ! ( flags & MS_RDONLY ) && bdev_read_only ( sb -> s_bdev ) ) return - EACCES ; # endif if ( flags & MS_RDONLY ) acct_auto_close ( sb ) ; shrink_dcache_sb ( sb ) ; sync_filesystem ( sb ) ; remount_ro = ( flags & MS_RDONLY ) && ! ( sb -> s_flags & MS_RDONLY ) ; if ( remount_ro ) { if ( force ) { <S2SV_StartBug> mark_files_ro ( sb ) ; <S2SV_EndBug> } else { retval = sb_prepare_remount_readonly ( sb ) ; if ( retval ) return retval ; } } if ( sb -> s_op -> remount_fs ) { retval = sb -> s_op -> remount_fs ( sb , & flags , data ) ; if ( retval ) { if ( ! force ) goto cancel_readonly ; WARN ( 1 , "forced<S2SV_blank>remount<S2SV_blank>of<S2SV_blank>a<S2SV_blank>%s<S2SV_blank>fs<S2SV_blank>returned<S2SV_blank>%i\\n" , sb -> s_type -> name , retval ) ; } } sb -> s_flags = ( sb -> s_flags & ~ MS_RMT_MASK ) | ( flags & MS_RMT_MASK ) ; smp_wmb ( ) ; sb -> s_readonly_remount = 0 ; if ( remount_ro && sb -> s_bdev ) invalidate_bdev ( sb -> s_bdev ) ; return 0 ; cancel_readonly : sb -> s_readonly_remount = 0 ; return retval ; }
| <S2SV_ModStart> force ) { sb -> s_readonly_remount = 1 ; smp_wmb ( <S2SV_ModEnd> ) ; }
| torvalds@linux/eee5cc2702929fd41cce28058dc6d6717f723f87 | CVE-2014-8172 | https://github.com/torvalds/linux/commit/eee5cc2702929fd41cce28058dc6d6717f723f87 | 2015-03-16T10:59Z |
29 | CWE-476 | CWE-476 static GsfInfileTar * tar_directory_for_file ( GsfInfileTar * dir , const char * name , gboolean last ) { const char * s = name ; while ( 1 ) { const char * s0 = s ; char * dirname ; while ( 1 ) { if ( * s == 0 ) { if ( last && s != s0 ) break ; else return dir ; } if ( * s == '/' ) break ; s ++ ; } dirname = g_strndup ( s0 , s - s0 ) ; while ( * s == '/' ) s ++ ; if ( strcmp ( dirname , "." ) != 0 ) { GsfInput * subdir = gsf_infile_child_by_name ( GSF_INFILE ( dir ) , dirname ) ; if ( subdir ) { <S2SV_StartBug> g_object_unref ( subdir ) ; <S2SV_EndBug> <S2SV_StartBug> dir = GSF_INFILE_TAR ( subdir ) ; <S2SV_EndBug> } else dir = tar_create_dir ( dir , dirname ) ; } g_free ( dirname ) ; } }
| <S2SV_ModStart> subdir ) { dir = GSF_IS_INFILE_TAR ( subdir ) ? GSF_INFILE_TAR ( subdir ) : dir ; <S2SV_ModStart> subdir ) ; <S2SV_ModEnd> } else dir
| GNOME@libgsf/95a8351a75758cf10b3bf6abae0b6b461f90d9e5 | CVE-2016-9888 | https://github.com/GNOME/libgsf/commit/95a8351a75758cf10b3bf6abae0b6b461f90d9e5 | 2016-12-08T08:59Z |
30 | CWE-000 | CWE-000 static void parse_cfg ( int flags , int argc , const char * * argv , cfg_t * cfg ) { <S2SV_StartBug> int i ; <S2SV_EndBug> memset ( cfg , 0 , sizeof ( cfg_t ) ) ; cfg -> debug_file = stderr ; for ( i = 0 ; i < argc ; i ++ ) { if ( strncmp ( argv [ i ] , "max_devices=" , 12 ) == 0 ) sscanf ( argv [ i ] , "max_devices=%u" , & cfg -> max_devs ) ; if ( strcmp ( argv [ i ] , "manual" ) == 0 ) cfg -> manual = 1 ; if ( strcmp ( argv [ i ] , "debug" ) == 0 ) cfg -> debug = 1 ; if ( strcmp ( argv [ i ] , "nouserok" ) == 0 ) cfg -> nouserok = 1 ; if ( strcmp ( argv [ i ] , "openasuser" ) == 0 ) cfg -> openasuser = 1 ; if ( strcmp ( argv [ i ] , "alwaysok" ) == 0 ) cfg -> alwaysok = 1 ; if ( strcmp ( argv [ i ] , "interactive" ) == 0 ) cfg -> interactive = 1 ; if ( strcmp ( argv [ i ] , "cue" ) == 0 ) cfg -> cue = 1 ; if ( strcmp ( argv [ i ] , "nodetect" ) == 0 ) cfg -> nodetect = 1 ; if ( strncmp ( argv [ i ] , "authfile=" , 9 ) == 0 ) cfg -> auth_file = argv [ i ] + 9 ; if ( strncmp ( argv [ i ] , "authpending_file=" , 17 ) == 0 ) cfg -> authpending_file = argv [ i ] + 17 ; if ( strncmp ( argv [ i ] , "origin=" , 7 ) == 0 ) cfg -> origin = argv [ i ] + 7 ; if ( strncmp ( argv [ i ] , "appid=" , 6 ) == 0 ) cfg -> appid = argv [ i ] + 6 ; if ( strncmp ( argv [ i ] , "prompt=" , 7 ) == 0 ) cfg -> prompt = argv [ i ] + 7 ; if ( strncmp ( argv [ i ] , "debug_file=" , 11 ) == 0 ) { const char * filename = argv [ i ] + 11 ; if ( strncmp ( filename , "stdout" , 6 ) == 0 ) { cfg -> debug_file = stdout ; } else if ( strncmp ( filename , "stderr" , 6 ) == 0 ) { cfg -> debug_file = stderr ; } else if ( strncmp ( filename , "syslog" , 6 ) == 0 ) { cfg -> debug_file = ( FILE * ) - 1 ; } else { <S2SV_StartBug> struct stat st ; <S2SV_EndBug> FILE * file ; <S2SV_StartBug> if ( lstat ( filename , & st ) == 0 ) { <S2SV_EndBug> if ( S_ISREG ( st . st_mode ) ) { <S2SV_StartBug> file = fopen ( filename , "a" ) ; <S2SV_EndBug> if ( file != NULL ) { cfg -> debug_file = file ; <S2SV_StartBug> } <S2SV_EndBug> } } } } } if ( cfg -> debug ) { D ( cfg -> debug_file , "called." ) ; D ( cfg -> debug_file , "flags<S2SV_blank>%d<S2SV_blank>argc<S2SV_blank>%d" , flags , argc ) ; for ( i = 0 ; i < argc ; i ++ ) { D ( cfg -> debug_file , "argv[%d]=%s" , i , argv [ i ] ) ; } D ( cfg -> debug_file , "max_devices=%d" , cfg -> max_devs ) ; D ( cfg -> debug_file , "debug=%d" , cfg -> debug ) ; D ( cfg -> debug_file , "interactive=%d" , cfg -> interactive ) ; D ( cfg -> debug_file , "cue=%d" , cfg -> cue ) ; D ( cfg -> debug_file , "nodetect=%d" , cfg -> nodetect ) ; D ( cfg -> debug_file , "manual=%d" , cfg -> manual ) ; D ( cfg -> debug_file , "nouserok=%d" , cfg -> nouserok ) ; D ( cfg -> debug_file , "openasuser=%d" , cfg -> openasuser ) ; D ( cfg -> debug_file , "alwaysok=%d" , cfg -> alwaysok ) ; D ( cfg -> debug_file , "authfile=%s" , cfg -> auth_file ? cfg -> auth_file : "(null)" ) ; D ( cfg -> debug_file , "authpending_file=%s" , cfg -> authpending_file ? cfg -> authpending_file : "(null)" ) ; D ( cfg -> debug_file , "origin=%s" , cfg -> origin ? cfg -> origin : "(null)" ) ; D ( cfg -> debug_file , "appid=%s" , cfg -> appid ? cfg -> appid : "(null)" ) ; D ( cfg -> debug_file , "prompt=%s" , cfg -> prompt ? cfg -> prompt : "(null)" ) ; } <S2SV_StartBug> } <S2SV_EndBug>
| <S2SV_ModStart> cfg ) { struct stat st ; FILE * file = NULL ; int fd = - 1 ; <S2SV_ModStart> } else { fd = open ( filename , O_WRONLY | O_APPEND | O_CLOEXEC | O_NOFOLLOW | O_NOCTTY ) ; if ( fd >= 0 && ( fstat ( fd <S2SV_ModEnd> , & st <S2SV_ModStart> == 0 ) && <S2SV_ModEnd> S_ISREG ( st <S2SV_ModStart> { file = fdopen ( fd <S2SV_ModEnd> , "a" ) <S2SV_ModStart> = file ; cfg -> is_custom_debug_file = 1 ; file = NULL ; fd = - 1 ; <S2SV_ModEnd> } } } <S2SV_ModStart> ) ; } if ( fd != - 1 ) close ( fd ) ; if ( file != NULL ) fclose ( file ) ;
| Yubico@pam-u2f/18b1914e32b74ff52000f10e97067e841e5fff62 | CVE-2019-12210 | https://github.com/Yubico/pam-u2f/commit/18b1914e32b74ff52000f10e97067e841e5fff62 | 2019-06-04T21:29Z |
31 | CWE-125 | CWE-125 static RList * r_bin_wasm_get_global_entries ( RBinWasmObj * bin , RBinWasmSection * sec ) { RList * ret = NULL ; RBinWasmGlobalEntry * ptr = NULL ; <S2SV_StartBug> int buflen = bin -> buf -> length ; <S2SV_EndBug> if ( sec -> payload_data + 32 > buflen ) { return NULL ; } if ( ! ( ret = r_list_newf ( ( RListFree ) free ) ) ) { return NULL ; } ut8 * buf = bin -> buf -> buf + ( ut32 ) sec -> payload_data ; ut32 len = sec -> payload_len ; ut32 count = sec -> count ; ut32 i = 0 , r = 0 ; while ( i < len && len < buflen && r < count ) { if ( ! ( ptr = R_NEW0 ( RBinWasmGlobalEntry ) ) ) { return ret ; } if ( len + 8 > buflen || ! ( consume_u8 ( buf + i , buf + len , ( ut8 * ) & ptr -> content_type , & i ) ) ) { goto beach ; } if ( len + 8 > buflen || ! ( consume_u8 ( buf + i , buf + len , & ptr -> mutability , & i ) ) ) { goto beach ; } if ( len + 8 > buflen || ! ( consume_init_expr ( buf + i , buf + len , R_BIN_WASM_END_OF_CODE , NULL , & i ) ) ) { goto beach ; } r_list_append ( ret , ptr ) ; r ++ ; } return ret ; beach : free ( ptr ) ; return ret ; }
| <S2SV_ModStart> = NULL ; if ( ! ( ret = r_list_newf ( ( RListFree ) free ) ) ) { return NULL ; } ut8 * buf = bin -> buf -> buf + ( ut32 ) sec -> payload_data ; <S2SV_ModStart> buf -> length - <S2SV_ModEnd> ( ut32 )
| radare@radare2/d2632f6483a3ceb5d8e0a5fb11142c51c43978b4 | CVE-2017-7854 | https://github.com/radare/radare2/commit/d2632f6483a3ceb5d8e0a5fb11142c51c43978b4 | 2017-04-13T16:59Z |
32 | CWE-399 | CWE-399 static gdImagePtr gdImageScaleTwoPass ( const gdImagePtr src , const unsigned int new_width , const unsigned int new_height ) { const unsigned int src_width = src -> sx ; const unsigned int src_height = src -> sy ; gdImagePtr tmp_im = NULL ; gdImagePtr dst = NULL ; if ( src_width == new_width && src_height == new_height ) { return gdImageClone ( src ) ; } if ( ! src -> trueColor ) { gdImagePaletteToTrueColor ( src ) ; } if ( src_width == new_width ) { tmp_im = src ; } else { tmp_im = gdImageCreateTrueColor ( new_width , src_height ) ; if ( tmp_im == NULL ) { return NULL ; } gdImageSetInterpolationMethod ( tmp_im , src -> interpolation_id ) ; _gdScalePass ( src , src_width , tmp_im , new_width , src_height , HORIZONTAL ) ; } if ( src_height == new_height ) { assert ( tmp_im != src ) ; return tmp_im ; } dst = gdImageCreateTrueColor ( new_width , new_height ) ; if ( dst != NULL ) { gdImageSetInterpolationMethod ( dst , src -> interpolation_id ) ; _gdScalePass ( tmp_im , src_height , dst , new_height , new_width , VERTICAL ) ; } if ( src != tmp_im ) { <S2SV_StartBug> gdFree ( tmp_im ) ; <S2SV_EndBug> } return dst ; }
| <S2SV_ModStart> tmp_im ) { gdImageDestroy <S2SV_ModEnd> ( tmp_im )
| libgd@libgd/4751b606fa38edc456d627140898a7ec679fcc24 | CVE-2015-8877 | https://github.com/libgd/libgd/commit/4751b606fa38edc456d627140898a7ec679fcc24 | 2016-05-22T01:59Z |
33 | CWE-200 | CWE-200 static int pn_recvmsg ( struct kiocb * iocb , struct sock * sk , struct msghdr * msg , size_t len , int noblock , int flags , int * addr_len ) { struct sk_buff * skb = NULL ; struct sockaddr_pn sa ; int rval = - EOPNOTSUPP ; int copylen ; if ( flags & ~ ( MSG_PEEK | MSG_TRUNC | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_CMSG_COMPAT ) ) <S2SV_StartBug> goto out_nofree ; <S2SV_EndBug> if ( addr_len ) * addr_len = sizeof ( sa ) ; skb = skb_recv_datagram ( sk , flags , noblock , & rval ) ; if ( skb == NULL ) goto out_nofree ; pn_skb_get_src_sockaddr ( skb , & sa ) ; copylen = skb -> len ; if ( len < copylen ) { msg -> msg_flags |= MSG_TRUNC ; copylen = len ; } rval = skb_copy_datagram_iovec ( skb , 0 , msg -> msg_iov , copylen ) ; if ( rval ) { rval = - EFAULT ; goto out ; } rval = ( flags & MSG_TRUNC ) ? skb -> len : copylen ; <S2SV_StartBug> if ( msg -> msg_name != NULL ) <S2SV_EndBug> <S2SV_StartBug> memcpy ( msg -> msg_name , & sa , sizeof ( struct sockaddr_pn ) ) ; <S2SV_EndBug> out : skb_free_datagram ( sk , skb ) ; out_nofree : return rval ; }
| <S2SV_ModStart> ) goto out_nofree <S2SV_ModEnd> ; skb = <S2SV_ModStart> != NULL ) { <S2SV_ModStart> , sizeof ( sa ) ) ; * addr_len = sizeof ( sa ) ; } <S2SV_ModEnd> out : skb_free_datagram
| torvalds@linux/bceaa90240b6019ed73b49965eac7d167610be69 | CVE-2013-7281 | https://github.com/torvalds/linux/commit/bceaa90240b6019ed73b49965eac7d167610be69 | 2014-01-08T16:55Z |
34 | CWE-125 | CWE-125 sctp_disposition_t sctp_sf_ootb ( struct net * net , const struct sctp_endpoint * ep , const struct sctp_association * asoc , const sctp_subtype_t type , void * arg , sctp_cmd_seq_t * commands ) { struct sctp_chunk * chunk = arg ; struct sk_buff * skb = chunk -> skb ; sctp_chunkhdr_t * ch ; sctp_errhdr_t * err ; __u8 * ch_end ; int ootb_shut_ack = 0 ; int ootb_cookie_ack = 0 ; SCTP_INC_STATS ( net , SCTP_MIB_OUTOFBLUES ) ; ch = ( sctp_chunkhdr_t * ) chunk -> chunk_hdr ; do { if ( ntohs ( ch -> length ) < sizeof ( sctp_chunkhdr_t ) ) return sctp_sf_violation_chunklen ( net , ep , asoc , type , arg , commands ) ; <S2SV_StartBug> if ( SCTP_CID_SHUTDOWN_ACK == ch -> type ) <S2SV_EndBug> ootb_shut_ack = 1 ; if ( SCTP_CID_ABORT == ch -> type ) return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; if ( SCTP_CID_COOKIE_ACK == ch -> type ) ootb_cookie_ack = 1 ; if ( SCTP_CID_ERROR == ch -> type ) { sctp_walk_errors ( err , ch ) { if ( SCTP_ERROR_STALE_COOKIE == err -> cause ) { ootb_cookie_ack = 1 ; break ; } } } ch_end = ( ( __u8 * ) ch ) + SCTP_PAD4 ( ntohs ( ch -> length ) ) ; if ( ch_end > skb_tail_pointer ( skb ) ) return sctp_sf_violation_chunklen ( net , ep , asoc , type , arg , commands ) ; <S2SV_StartBug> ch = ( sctp_chunkhdr_t * ) ch_end ; <S2SV_EndBug> } while ( ch_end < skb_tail_pointer ( skb ) ) ; if ( ootb_shut_ack ) return sctp_sf_shut_8_4_5 ( net , ep , asoc , type , arg , commands ) ; else if ( ootb_cookie_ack ) return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; else return sctp_sf_tabort_8_4_8 ( net , ep , asoc , type , arg , commands ) ; }
| <S2SV_ModStart> commands ) ; <S2SV_ModEnd> ch_end = ( <S2SV_ModStart> commands ) ; if ( SCTP_CID_SHUTDOWN_ACK == ch -> type ) ootb_shut_ack = 1 ; if ( SCTP_CID_ABORT == ch -> type ) return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; if ( SCTP_CID_COOKIE_ACK == ch -> type ) ootb_cookie_ack = 1 ; if ( SCTP_CID_ERROR == ch -> type ) { sctp_walk_errors ( err , ch ) { if ( SCTP_ERROR_STALE_COOKIE == err -> cause ) { ootb_cookie_ack = 1 ; break ; } } }
| torvalds@linux/bf911e985d6bbaa328c20c3e05f4eb03de11fdd6 | CVE-2016-9555 | https://github.com/torvalds/linux/commit/bf911e985d6bbaa328c20c3e05f4eb03de11fdd6 | 2016-11-28T03:59Z |
35 | CWE-119 | CWE-119 static vpx_codec_err_t ctrl_set_scale_mode ( vpx_codec_alg_priv_t * ctx , <S2SV_StartBug> int ctr_id , va_list args ) { <S2SV_EndBug> vpx_scaling_mode_t * const mode = va_arg ( args , vpx_scaling_mode_t * ) ; if ( mode ) { const int res = vp9_set_internal_size ( ctx -> cpi , ( VPX_SCALING ) mode -> h_scaling_mode , ( VPX_SCALING ) mode -> v_scaling_mode ) ; return ( res == 0 ) ? VPX_CODEC_OK : VPX_CODEC_INVALID_PARAM ; } else { return VPX_CODEC_INVALID_PARAM ; } }
| <S2SV_ModStart> * ctx , <S2SV_ModEnd> va_list args )
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
36 | CWE-787 | CWE-787 static inline int l2cap_config_req ( struct l2cap_conn * conn , struct l2cap_cmd_hdr * cmd , u16 cmd_len , u8 * data ) { struct l2cap_conf_req * req = ( struct l2cap_conf_req * ) data ; u16 dcid , flags ; u8 rsp [ 64 ] ; struct sock * sk ; int len ; dcid = __le16_to_cpu ( req -> dcid ) ; flags = __le16_to_cpu ( req -> flags ) ; BT_DBG ( "dcid<S2SV_blank>0x%4.4x<S2SV_blank>flags<S2SV_blank>0x%2.2x" , dcid , flags ) ; sk = l2cap_get_chan_by_scid ( & conn -> chan_list , dcid ) ; if ( ! sk ) return - ENOENT ; if ( sk -> sk_state == BT_DISCONN ) goto unlock ; len = cmd_len - sizeof ( * req ) ; if ( l2cap_pi ( sk ) -> conf_len + len > sizeof ( l2cap_pi ( sk ) -> conf_req ) ) { l2cap_send_cmd ( conn , cmd -> ident , L2CAP_CONF_RSP , l2cap_build_conf_rsp ( sk , rsp , L2CAP_CONF_REJECT , flags ) , rsp ) ; goto unlock ; } memcpy ( l2cap_pi ( sk ) -> conf_req + l2cap_pi ( sk ) -> conf_len , req -> data , len ) ; l2cap_pi ( sk ) -> conf_len += len ; if ( flags & 0x0001 ) { l2cap_send_cmd ( conn , cmd -> ident , L2CAP_CONF_RSP , l2cap_build_conf_rsp ( sk , rsp , L2CAP_CONF_SUCCESS , 0x0001 ) , rsp ) ; goto unlock ; } len = l2cap_parse_conf_req ( sk , rsp ) ; <S2SV_StartBug> if ( len < 0 ) <S2SV_EndBug> goto unlock ; <S2SV_StartBug> l2cap_send_cmd ( conn , cmd -> ident , L2CAP_CONF_RSP , len , rsp ) ; <S2SV_EndBug> l2cap_pi ( sk ) -> conf_len = 0 ; if ( ! ( l2cap_pi ( sk ) -> conf_state & L2CAP_CONF_OUTPUT_DONE ) ) goto unlock ; if ( l2cap_pi ( sk ) -> conf_state & L2CAP_CONF_INPUT_DONE ) { sk -> sk_state = BT_CONNECTED ; l2cap_chan_ready ( sk ) ; goto unlock ; } if ( ! ( l2cap_pi ( sk ) -> conf_state & L2CAP_CONF_REQ_SENT ) ) { u8 buf [ 64 ] ; l2cap_send_cmd ( conn , l2cap_get_ident ( conn ) , L2CAP_CONF_REQ , l2cap_build_conf_req ( sk , buf ) , buf ) ; <S2SV_StartBug> } <S2SV_EndBug> unlock : bh_unlock_sock ( sk ) ; return 0 ; }
| <S2SV_ModStart> < 0 ) { struct l2cap_disconn_req req ; req . dcid = cpu_to_le16 ( l2cap_pi ( sk ) -> dcid ) ; req . scid = cpu_to_le16 ( l2cap_pi ( sk ) -> scid ) ; l2cap_send_cmd ( conn , l2cap_get_ident ( conn ) , L2CAP_DISCONN_REQ , sizeof ( req ) , & req ) ; <S2SV_ModStart> goto unlock ; } <S2SV_ModStart> , rsp ) ; l2cap_pi ( sk ) -> num_conf_rsp ++ <S2SV_ModStart> buf ) ; l2cap_pi ( sk ) -> num_conf_req ++ ;
| torvalds@linux/f2fcfcd670257236ebf2088bbdf26f6a8ef459fe | CVE-2017-1000251 | https://github.com/torvalds/linux/commit/f2fcfcd670257236ebf2088bbdf26f6a8ef459fe | 2017-09-12T17:29Z |
37 | CWE-20 | CWE-20 static int parse_rock_ridge_inode_internal ( struct iso_directory_record * de , <S2SV_StartBug> struct inode * inode , int regard_xa ) <S2SV_EndBug> { int symlink_len = 0 ; <S2SV_StartBug> int cnt , sig ; <S2SV_EndBug> struct inode * reloc ; struct rock_ridge * rr ; int rootflag ; struct rock_state rs ; int ret = 0 ; if ( ! ISOFS_SB ( inode -> i_sb ) -> s_rock ) return 0 ; init_rock_state ( & rs , inode ) ; setup_rock_ridge ( de , inode , & rs ) ; <S2SV_StartBug> if ( regard_xa ) { <S2SV_EndBug> rs . chr += 14 ; rs . len -= 14 ; if ( rs . len < 0 ) rs . len = 0 ; } repeat : while ( rs . len > 2 ) { rr = ( struct rock_ridge * ) rs . chr ; if ( rr -> len < 3 ) goto out ; sig = isonum_721 ( rs . chr ) ; if ( rock_check_overflow ( & rs , sig ) ) goto eio ; rs . chr += rr -> len ; rs . len -= rr -> len ; if ( rs . len < 0 ) goto out ; switch ( sig ) { # ifndef CONFIG_ZISOFS case SIG ( 'R' , 'R' ) : if ( ( rr -> u . RR . flags [ 0 ] & ( RR_PX | RR_TF | RR_SL | RR_CL ) ) == 0 ) goto out ; break ; # endif case SIG ( 'S' , 'P' ) : if ( check_sp ( rr , inode ) ) goto out ; break ; case SIG ( 'C' , 'E' ) : rs . cont_extent = isonum_733 ( rr -> u . CE . extent ) ; rs . cont_offset = isonum_733 ( rr -> u . CE . offset ) ; rs . cont_size = isonum_733 ( rr -> u . CE . size ) ; break ; case SIG ( 'E' , 'R' ) : ISOFS_SB ( inode -> i_sb ) -> s_rock = 1 ; printk ( KERN_DEBUG "ISO<S2SV_blank>9660<S2SV_blank>Extensions:<S2SV_blank>" ) ; { int p ; for ( p = 0 ; p < rr -> u . ER . len_id ; p ++ ) printk ( "%c" , rr -> u . ER . data [ p ] ) ; } printk ( "\\n" ) ; break ; case SIG ( 'P' , 'X' ) : inode -> i_mode = isonum_733 ( rr -> u . PX . mode ) ; set_nlink ( inode , isonum_733 ( rr -> u . PX . n_links ) ) ; i_uid_write ( inode , isonum_733 ( rr -> u . PX . uid ) ) ; i_gid_write ( inode , isonum_733 ( rr -> u . PX . gid ) ) ; break ; case SIG ( 'P' , 'N' ) : { int high , low ; high = isonum_733 ( rr -> u . PN . dev_high ) ; low = isonum_733 ( rr -> u . PN . dev_low ) ; if ( ( low & ~ 0xff ) && high == 0 ) { inode -> i_rdev = MKDEV ( low >> 8 , low & 0xff ) ; } else { inode -> i_rdev = MKDEV ( high , low ) ; } } break ; case SIG ( 'T' , 'F' ) : cnt = 0 ; if ( rr -> u . TF . flags & TF_CREATE ) { inode -> i_ctime . tv_sec = iso_date ( rr -> u . TF . times [ cnt ++ ] . time , 0 ) ; inode -> i_ctime . tv_nsec = 0 ; } if ( rr -> u . TF . flags & TF_MODIFY ) { inode -> i_mtime . tv_sec = iso_date ( rr -> u . TF . times [ cnt ++ ] . time , 0 ) ; inode -> i_mtime . tv_nsec = 0 ; } if ( rr -> u . TF . flags & TF_ACCESS ) { inode -> i_atime . tv_sec = iso_date ( rr -> u . TF . times [ cnt ++ ] . time , 0 ) ; inode -> i_atime . tv_nsec = 0 ; } if ( rr -> u . TF . flags & TF_ATTRIBUTES ) { inode -> i_ctime . tv_sec = iso_date ( rr -> u . TF . times [ cnt ++ ] . time , 0 ) ; inode -> i_ctime . tv_nsec = 0 ; } break ; case SIG ( 'S' , 'L' ) : { int slen ; struct SL_component * slp ; struct SL_component * oldslp ; slen = rr -> len - 5 ; slp = & rr -> u . SL . link ; inode -> i_size = symlink_len ; while ( slen > 1 ) { rootflag = 0 ; switch ( slp -> flags & ~ 1 ) { case 0 : inode -> i_size += slp -> len ; break ; case 2 : inode -> i_size += 1 ; break ; case 4 : inode -> i_size += 2 ; break ; case 8 : rootflag = 1 ; inode -> i_size += 1 ; break ; default : printk ( "Symlink<S2SV_blank>component<S2SV_blank>flag<S2SV_blank>" "not<S2SV_blank>implemented\\n" ) ; } slen -= slp -> len + 2 ; oldslp = slp ; slp = ( struct SL_component * ) ( ( ( char * ) slp ) + slp -> len + 2 ) ; if ( slen < 2 ) { if ( ( ( rr -> u . SL . flags & 1 ) != 0 ) && ( ( oldslp -> flags & 1 ) == 0 ) ) inode -> i_size += 1 ; break ; } if ( ! rootflag && ( oldslp -> flags & 1 ) == 0 ) inode -> i_size += 1 ; } } symlink_len = inode -> i_size ; break ; case SIG ( 'R' , 'E' ) : printk ( KERN_WARNING "Attempt<S2SV_blank>to<S2SV_blank>read<S2SV_blank>inode<S2SV_blank>for<S2SV_blank>" "relocated<S2SV_blank>directory\\n" ) ; goto out ; case SIG ( 'C' , 'L' ) : <S2SV_StartBug> ISOFS_I ( inode ) -> i_first_extent = <S2SV_EndBug> isonum_733 ( rr -> u . CL . location ) ; reloc = <S2SV_StartBug> isofs_iget ( inode -> i_sb , <S2SV_EndBug> <S2SV_StartBug> ISOFS_I ( inode ) -> i_first_extent , <S2SV_EndBug> 0 ) ; if ( IS_ERR ( reloc ) ) { ret = PTR_ERR ( reloc ) ; goto out ; } inode -> i_mode = reloc -> i_mode ; set_nlink ( inode , reloc -> i_nlink ) ; inode -> i_uid = reloc -> i_uid ; inode -> i_gid = reloc -> i_gid ; inode -> i_rdev = reloc -> i_rdev ; inode -> i_size = reloc -> i_size ; inode -> i_blocks = reloc -> i_blocks ; inode -> i_atime = reloc -> i_atime ; inode -> i_ctime = reloc -> i_ctime ; inode -> i_mtime = reloc -> i_mtime ; iput ( reloc ) ; break ; # ifdef CONFIG_ZISOFS case SIG ( 'Z' , 'F' ) : { int algo ; if ( ISOFS_SB ( inode -> i_sb ) -> s_nocompress ) break ; algo = isonum_721 ( rr -> u . ZF . algorithm ) ; if ( algo == SIG ( 'p' , 'z' ) ) { int block_shift = isonum_711 ( & rr -> u . ZF . parms [ 1 ] ) ; if ( block_shift > 17 ) { printk ( KERN_WARNING "isofs:<S2SV_blank>" "Can\'t<S2SV_blank>handle<S2SV_blank>ZF<S2SV_blank>block<S2SV_blank>" "size<S2SV_blank>of<S2SV_blank>2^%d\\n" , block_shift ) ; } else { ISOFS_I ( inode ) -> i_file_format = isofs_file_compressed ; ISOFS_I ( inode ) -> i_format_parm [ 0 ] = isonum_711 ( & rr -> u . ZF . parms [ 0 ] ) ; ISOFS_I ( inode ) -> i_format_parm [ 1 ] = isonum_711 ( & rr -> u . ZF . parms [ 1 ] ) ; inode -> i_size = isonum_733 ( rr -> u . ZF . real_size ) ; } } else { printk ( KERN_WARNING "isofs:<S2SV_blank>Unknown<S2SV_blank>ZF<S2SV_blank>compression<S2SV_blank>" "algorithm:<S2SV_blank>%c%c\\n" , rr -> u . ZF . algorithm [ 0 ] , rr -> u . ZF . algorithm [ 1 ] ) ; } break ; } # endif default : break ; } } ret = rock_continue ( & rs ) ; if ( ret == 0 ) goto repeat ; if ( ret == 1 ) ret = 0 ; out : kfree ( rs . buffer ) ; return ret ; eio : ret = - EIO ; goto out ; }
| <S2SV_ModStart> inode , int flags <S2SV_ModEnd> ) { int <S2SV_ModStart> cnt , sig ; unsigned int reloc_block <S2SV_ModStart> ; if ( flags & RR_REGARD_XA <S2SV_ModEnd> ) { rs <S2SV_ModStart> 'L' ) : if ( flags & RR_RELOC_DE ) { printk ( KERN_ERR "ISOFS:<S2SV_blank>Recursive<S2SV_blank>directory<S2SV_blank>relocation<S2SV_blank>" "is<S2SV_blank>not<S2SV_blank>supported\\n" ) ; goto eio ; } reloc_block = isonum_733 ( rr -> u . CL . location ) ; if ( reloc_block == <S2SV_ModStart> inode ) -> i_iget5_block && ISOFS_I ( inode ) -> i_iget5_offset == 0 ) { printk ( KERN_ERR "ISOFS:<S2SV_blank>Directory<S2SV_blank>relocation<S2SV_blank>points<S2SV_blank>to<S2SV_blank>" "itself\\n" ) ; goto eio ; } ISOFS_I ( inode ) -> i_first_extent = reloc_block <S2SV_ModEnd> ; reloc = <S2SV_ModStart> ; reloc = isofs_iget_reloc <S2SV_ModEnd> ( inode -> <S2SV_ModStart> -> i_sb , reloc_block , <S2SV_ModEnd> 0 ) ;
| torvalds@linux/410dd3cf4c9b36f27ed4542ee18b1af5e68645a4 | CVE-2014-5472 | https://github.com/torvalds/linux/commit/410dd3cf4c9b36f27ed4542ee18b1af5e68645a4 | 2014-09-01T01:55Z |
38 | CWE-415 | CWE-415 static int csnmp_read_table ( host_definition_t * host , data_definition_t * data ) { struct snmp_pdu * req ; struct snmp_pdu * res = NULL ; struct variable_list * vb ; const data_set_t * ds ; size_t oid_list_len = data -> values_len + 1 ; oid_t oid_list [ oid_list_len ] ; _Bool oid_list_todo [ oid_list_len ] ; int status ; size_t i ; csnmp_list_instances_t * instance_list_head ; csnmp_list_instances_t * instance_list_tail ; csnmp_table_values_t * * value_list_head ; csnmp_table_values_t * * value_list_tail ; DEBUG ( "snmp<S2SV_blank>plugin:<S2SV_blank>csnmp_read_table<S2SV_blank>(host<S2SV_blank>=<S2SV_blank>%s,<S2SV_blank>data<S2SV_blank>=<S2SV_blank>%s)" , host -> name , data -> name ) ; if ( host -> sess_handle == NULL ) { DEBUG ( "snmp<S2SV_blank>plugin:<S2SV_blank>csnmp_read_table:<S2SV_blank>host->sess_handle<S2SV_blank>==<S2SV_blank>NULL" ) ; return ( - 1 ) ; } ds = plugin_get_ds ( data -> type ) ; if ( ! ds ) { ERROR ( "snmp<S2SV_blank>plugin:<S2SV_blank>DataSet<S2SV_blank>`%s\'<S2SV_blank>not<S2SV_blank>defined." , data -> type ) ; return ( - 1 ) ; } if ( ds -> ds_num != data -> values_len ) { ERROR ( "snmp<S2SV_blank>plugin:<S2SV_blank>DataSet<S2SV_blank>`%s\'<S2SV_blank>requires<S2SV_blank>%zu<S2SV_blank>values,<S2SV_blank>but<S2SV_blank>config<S2SV_blank>talks<S2SV_blank>" "about<S2SV_blank>%zu" , data -> type , ds -> ds_num , data -> values_len ) ; return ( - 1 ) ; } assert ( data -> values_len > 0 ) ; memcpy ( oid_list , data -> values , data -> values_len * sizeof ( oid_t ) ) ; if ( data -> instance . oid . oid_len > 0 ) memcpy ( oid_list + data -> values_len , & data -> instance . oid , sizeof ( oid_t ) ) ; else oid_list_len -- ; for ( i = 0 ; i < oid_list_len ; i ++ ) oid_list_todo [ i ] = 1 ; value_list_head = calloc ( data -> values_len , sizeof ( * value_list_head ) ) ; value_list_tail = calloc ( data -> values_len , sizeof ( * value_list_tail ) ) ; if ( ( value_list_head == NULL ) || ( value_list_tail == NULL ) ) { ERROR ( "snmp<S2SV_blank>plugin:<S2SV_blank>csnmp_read_table:<S2SV_blank>calloc<S2SV_blank>failed." ) ; sfree ( value_list_head ) ; sfree ( value_list_tail ) ; return ( - 1 ) ; } instance_list_head = NULL ; instance_list_tail = NULL ; status = 0 ; while ( status == 0 ) { int oid_list_todo_num ; req = snmp_pdu_create ( SNMP_MSG_GETNEXT ) ; if ( req == NULL ) { ERROR ( "snmp<S2SV_blank>plugin:<S2SV_blank>snmp_pdu_create<S2SV_blank>failed." ) ; status = - 1 ; break ; } oid_list_todo_num = 0 ; for ( i = 0 ; i < oid_list_len ; i ++ ) { if ( ! oid_list_todo [ i ] ) continue ; oid_list_todo_num ++ ; snmp_add_null_var ( req , oid_list [ i ] . oid , oid_list [ i ] . oid_len ) ; } if ( oid_list_todo_num == 0 ) { <S2SV_StartBug> DEBUG ( "snmp<S2SV_blank>plugin:<S2SV_blank>all<S2SV_blank>variables<S2SV_blank>have<S2SV_blank>left<S2SV_blank>their<S2SV_blank>subtree" ) ; <S2SV_EndBug> status = 0 ; break ; } res = NULL ; status = snmp_sess_synch_response ( host -> sess_handle , req , & res ) ; if ( ( status != STAT_SUCCESS ) || ( res == NULL ) ) { char * errstr = NULL ; snmp_sess_error ( host -> sess_handle , NULL , NULL , & errstr ) ; c_complain ( LOG_ERR , & host -> complaint , "snmp<S2SV_blank>plugin:<S2SV_blank>host<S2SV_blank>%s:<S2SV_blank>snmp_sess_synch_response<S2SV_blank>failed:<S2SV_blank>%s" , host -> name , ( errstr == NULL ) ? "Unknown<S2SV_blank>problem" : errstr ) ; if ( res != NULL ) snmp_free_pdu ( res ) ; res = NULL ; <S2SV_StartBug> req = NULL ; <S2SV_EndBug> sfree ( errstr ) ; csnmp_host_close_session ( host ) ; status = - 1 ; break ; } status = 0 ; assert ( res != NULL ) ; c_release ( LOG_INFO , & host -> complaint , "snmp<S2SV_blank>plugin:<S2SV_blank>host<S2SV_blank>%s:<S2SV_blank>snmp_sess_synch_response<S2SV_blank>successful." , host -> name ) ; vb = res -> variables ; if ( vb == NULL ) { status = - 1 ; break ; } for ( vb = res -> variables , i = 0 ; ( vb != NULL ) ; vb = vb -> next_variable , i ++ ) { while ( ( i < oid_list_len ) && ! oid_list_todo [ i ] ) i ++ ; if ( ( data -> instance . oid . oid_len > 0 ) && ( i == data -> values_len ) ) { if ( ( vb -> type == SNMP_ENDOFMIBVIEW ) || ( snmp_oid_ncompare ( data -> instance . oid . oid , data -> instance . oid . oid_len , vb -> name , vb -> name_length , data -> instance . oid . oid_len ) != 0 ) ) { DEBUG ( "snmp<S2SV_blank>plugin:<S2SV_blank>host<S2SV_blank>=<S2SV_blank>%s;<S2SV_blank>data<S2SV_blank>=<S2SV_blank>%s;<S2SV_blank>Instance<S2SV_blank>left<S2SV_blank>its<S2SV_blank>subtree." , host -> name , data -> name ) ; oid_list_todo [ i ] = 0 ; continue ; } if ( csnmp_instance_list_add ( & instance_list_head , & instance_list_tail , res , host , data ) != 0 ) { ERROR ( "snmp<S2SV_blank>plugin:<S2SV_blank>host<S2SV_blank>%s:<S2SV_blank>csnmp_instance_list_add<S2SV_blank>failed." , host -> name ) ; status = - 1 ; break ; } } else { csnmp_table_values_t * vt ; oid_t vb_name ; oid_t suffix ; int ret ; csnmp_oid_init ( & vb_name , vb -> name , vb -> name_length ) ; ret = csnmp_oid_suffix ( & suffix , & vb_name , data -> values + i ) ; if ( ret != 0 ) { DEBUG ( "snmp<S2SV_blank>plugin:<S2SV_blank>host<S2SV_blank>=<S2SV_blank>%s;<S2SV_blank>data<S2SV_blank>=<S2SV_blank>%s;<S2SV_blank>i<S2SV_blank>=<S2SV_blank>%zu;<S2SV_blank>" "Value<S2SV_blank>probably<S2SV_blank>left<S2SV_blank>its<S2SV_blank>subtree." , host -> name , data -> name , i ) ; oid_list_todo [ i ] = 0 ; continue ; } if ( ( value_list_tail [ i ] != NULL ) && ( csnmp_oid_compare ( & suffix , & value_list_tail [ i ] -> suffix ) <= 0 ) ) { DEBUG ( "snmp<S2SV_blank>plugin:<S2SV_blank>host<S2SV_blank>=<S2SV_blank>%s;<S2SV_blank>data<S2SV_blank>=<S2SV_blank>%s;<S2SV_blank>i<S2SV_blank>=<S2SV_blank>%zu;<S2SV_blank>" "Suffix<S2SV_blank>is<S2SV_blank>not<S2SV_blank>increasing." , host -> name , data -> name , i ) ; oid_list_todo [ i ] = 0 ; continue ; } vt = calloc ( 1 , sizeof ( * vt ) ) ; if ( vt == NULL ) { ERROR ( "snmp<S2SV_blank>plugin:<S2SV_blank>calloc<S2SV_blank>failed." ) ; status = - 1 ; break ; } vt -> value = csnmp_value_list_to_value ( vb , ds -> ds [ i ] . type , data -> scale , data -> shift , host -> name , data -> name ) ; memcpy ( & vt -> suffix , & suffix , sizeof ( vt -> suffix ) ) ; vt -> next = NULL ; if ( value_list_tail [ i ] == NULL ) value_list_head [ i ] = vt ; else value_list_tail [ i ] -> next = vt ; value_list_tail [ i ] = vt ; } memcpy ( oid_list [ i ] . oid , vb -> name , sizeof ( oid ) * vb -> name_length ) ; oid_list [ i ] . oid_len = vb -> name_length ; } if ( res != NULL ) snmp_free_pdu ( res ) ; res = NULL ; } if ( res != NULL ) snmp_free_pdu ( res ) ; res = NULL ; <S2SV_StartBug> if ( req != NULL ) <S2SV_EndBug> snmp_free_pdu ( req ) ; req = NULL ; if ( status == 0 ) csnmp_dispatch_table ( host , data , instance_list_head , value_list_head ) ; while ( instance_list_head != NULL ) { csnmp_list_instances_t * next = instance_list_head -> next ; sfree ( instance_list_head ) ; instance_list_head = next ; } for ( i = 0 ; i < data -> values_len ; i ++ ) { while ( value_list_head [ i ] != NULL ) { csnmp_table_values_t * next = value_list_head [ i ] -> next ; sfree ( value_list_head [ i ] ) ; value_list_head [ i ] = next ; } } sfree ( value_list_head ) ; sfree ( value_list_tail ) ; return ( 0 ) ; }
| <S2SV_ModStart> DEBUG ( "snmp<S2SV_blank>plugin:<S2SV_blank>all<S2SV_blank>variables<S2SV_blank>have<S2SV_blank>left<S2SV_blank>their<S2SV_blank>subtree" ) ; snmp_free_pdu ( req <S2SV_ModStart> = NULL ; <S2SV_ModEnd> sfree ( errstr <S2SV_ModStart> ; if ( <S2SV_ModEnd> status == 0
| collectd@collectd/d16c24542b2f96a194d43a73c2e5778822b9cb47 | CVE-2017-16820 | https://github.com/collectd/collectd/commit/d16c24542b2f96a194d43a73c2e5778822b9cb47 | 2017-11-14T21:29Z |
39 | CWE-119 | CWE-119 CURLcode Curl_auth_create_plain_message ( struct Curl_easy * data , const char * userp , const char * passwdp , char * * outptr , size_t * outlen ) { CURLcode result ; char * plainauth ; size_t ulen ; size_t plen ; size_t plainlen ; * outlen = 0 ; * outptr = NULL ; ulen = strlen ( userp ) ; plen = strlen ( passwdp ) ; <S2SV_StartBug> if ( ( ulen > SIZE_T_MAX / 2 ) || ( plen > ( SIZE_T_MAX / 2 - 2 ) ) ) <S2SV_EndBug> return CURLE_OUT_OF_MEMORY ; plainlen = 2 * ulen + plen + 2 ; plainauth = malloc ( plainlen ) ; if ( ! plainauth ) return CURLE_OUT_OF_MEMORY ; memcpy ( plainauth , userp , ulen ) ; plainauth [ ulen ] = '\\0' ; memcpy ( plainauth + ulen + 1 , userp , ulen ) ; plainauth [ 2 * ulen + 1 ] = '\\0' ; memcpy ( plainauth + 2 * ulen + 2 , passwdp , plen ) ; result = Curl_base64_encode ( data , plainauth , plainlen , outptr , outlen ) ; free ( plainauth ) ; return result ; }
| <S2SV_ModStart> > SIZE_T_MAX / 4 <S2SV_ModEnd> ) || (
| curl@curl/f3a24d7916b9173c69a3e0ee790102993833d6c5 | CVE-2018-16839 | https://github.com/curl/curl/commit/f3a24d7916b9173c69a3e0ee790102993833d6c5 | 2018-10-31T18:29Z |
40 | CWE-119 | CWE-119 PHP_FUNCTION ( radius_get_vendor_attr ) { <S2SV_StartBug> int res ; <S2SV_EndBug> <S2SV_StartBug> const void * data ; <S2SV_EndBug> int len ; <S2SV_StartBug> u_int32_t vendor ; <S2SV_EndBug> <S2SV_StartBug> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "s" , & data , & len ) == FAILURE ) { <S2SV_EndBug> return ; } <S2SV_StartBug> res = rad_get_vendor_attr ( & vendor , & data , ( size_t * ) & len ) ; <S2SV_EndBug> if ( res == - 1 ) { RETURN_FALSE ; } else { array_init ( return_value ) ; <S2SV_StartBug> add_assoc_long ( return_value , "attr" , res ) ; <S2SV_EndBug> add_assoc_long ( return_value , "vendor" , vendor ) ; <S2SV_StartBug> add_assoc_stringl ( return_value , "data" , ( char * ) data , len , 1 ) ; <S2SV_EndBug> return ; } }
| <S2SV_ModStart> radius_get_vendor_attr ) { <S2SV_ModEnd> const void * <S2SV_ModStart> void * data , * raw <S2SV_ModStart> ; u_int32_t vendor ; unsigned char type ; size_t data_len <S2SV_ModStart> "s" , & raw <S2SV_ModEnd> , & len <S2SV_ModStart> return ; } if ( <S2SV_ModEnd> rad_get_vendor_attr ( & <S2SV_ModStart> vendor , & type , & data , & data_len , raw , len ) <S2SV_ModEnd> == - 1 <S2SV_ModStart> , "attr" , type <S2SV_ModEnd> ) ; add_assoc_long <S2SV_ModStart> ) data , data_len <S2SV_ModEnd> , 1 )
| LawnGnome@php-radius/13c149b051f82b709e8d7cc32111e84b49d57234 | CVE-2013-2220 | https://github.com/LawnGnome/php-radius/commit/13c149b051f82b709e8d7cc32111e84b49d57234 | 2013-07-31T13:20Z |
41 | CWE-119 | CWE-119 static int cdxl_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * pkt ) { CDXLVideoContext * c = avctx -> priv_data ; AVFrame * const p = data ; int ret , w , h , encoding , aligned_width , buf_size = pkt -> size ; const uint8_t * buf = pkt -> data ; if ( buf_size < 32 ) return AVERROR_INVALIDDATA ; encoding = buf [ 1 ] & 7 ; c -> format = buf [ 1 ] & 0xE0 ; w = AV_RB16 ( & buf [ 14 ] ) ; h = AV_RB16 ( & buf [ 16 ] ) ; c -> bpp = buf [ 19 ] ; c -> palette_size = AV_RB16 ( & buf [ 20 ] ) ; c -> palette = buf + 32 ; c -> video = c -> palette + c -> palette_size ; c -> video_size = buf_size - c -> palette_size - 32 ; if ( c -> palette_size > 512 ) return AVERROR_INVALIDDATA ; if ( buf_size < c -> palette_size + 32 ) return AVERROR_INVALIDDATA ; if ( c -> bpp < 1 ) return AVERROR_INVALIDDATA ; if ( c -> format != BIT_PLANAR && c -> format != BIT_LINE && c -> format != CHUNKY ) { avpriv_request_sample ( avctx , "Pixel<S2SV_blank>format<S2SV_blank>0x%0x" , c -> format ) ; return AVERROR_PATCHWELCOME ; } if ( ( ret = ff_set_dimensions ( avctx , w , h ) ) < 0 ) return ret ; if ( c -> format == CHUNKY ) aligned_width = avctx -> width ; else aligned_width = FFALIGN ( c -> avctx -> width , 16 ) ; c -> padded_bits = aligned_width - c -> avctx -> width ; if ( c -> video_size < aligned_width * avctx -> height * ( int64_t ) c -> bpp / 8 ) return AVERROR_INVALIDDATA ; <S2SV_StartBug> if ( ! encoding && c -> palette_size && c -> bpp <= 8 ) { <S2SV_EndBug> avctx -> pix_fmt = AV_PIX_FMT_PAL8 ; } else if ( encoding == 1 && ( c -> bpp == 6 || c -> bpp == 8 ) ) { if ( c -> palette_size != ( 1 << ( c -> bpp - 1 ) ) ) return AVERROR_INVALIDDATA ; avctx -> pix_fmt = AV_PIX_FMT_BGR24 ; } else if ( ! encoding && c -> bpp == 24 && c -> format == CHUNKY && ! c -> palette_size ) { avctx -> pix_fmt = AV_PIX_FMT_RGB24 ; } else { avpriv_request_sample ( avctx , "Encoding<S2SV_blank>%d,<S2SV_blank>bpp<S2SV_blank>%d<S2SV_blank>and<S2SV_blank>format<S2SV_blank>0x%x" , encoding , c -> bpp , c -> format ) ; return AVERROR_PATCHWELCOME ; } if ( ( ret = ff_get_buffer ( avctx , p , 0 ) ) < 0 ) return ret ; p -> pict_type = AV_PICTURE_TYPE_I ; if ( encoding ) { av_fast_padded_malloc ( & c -> new_video , & c -> new_video_size , h * w + AV_INPUT_BUFFER_PADDING_SIZE ) ; if ( ! c -> new_video ) return AVERROR ( ENOMEM ) ; if ( c -> bpp == 8 ) cdxl_decode_ham8 ( c , p ) ; else cdxl_decode_ham6 ( c , p ) ; } else if ( avctx -> pix_fmt == AV_PIX_FMT_PAL8 ) { cdxl_decode_rgb ( c , p ) ; } else { cdxl_decode_raw ( c , p ) ; } * got_frame = 1 ; return buf_size ; }
| <S2SV_ModStart> bpp <= 8 && c -> format != CHUNKY
| FFmpeg@FFmpeg/e1b60aad77c27ed5d4dfc11e5e6a05a38c70489d | CVE-2017-9996 | https://github.com/FFmpeg/FFmpeg/commit/e1b60aad77c27ed5d4dfc11e5e6a05a38c70489d | 2017-06-28T06:29Z |
42 | CWE-20 | CWE-20 void httpClientParseQopParam ( const HttpParam * param , HttpWwwAuthenticateHeader * authHeader ) { # if ( HTTP_CLIENT_DIGEST_AUTH_SUPPORT == ENABLED ) size_t i ; size_t n ; authHeader -> qop = HTTP_AUTH_QOP_NONE ; for ( i = 0 ; i < param -> valueLen ; i += ( n + 1 ) ) { for ( n = 0 ; ( i + n ) < param -> valueLen ; n ++ ) { <S2SV_StartBug> if ( strchr ( ",<S2SV_blank>\\t" , param -> value [ i + n ] ) ) <S2SV_EndBug> break ; } if ( n == 4 && ! osStrncasecmp ( param -> value + i , "auth" , 4 ) ) { authHeader -> qop = HTTP_AUTH_QOP_AUTH ; } } if ( authHeader -> qop == HTTP_AUTH_QOP_NONE ) { authHeader -> mode = HTTP_AUTH_MODE_NONE ; } # endif }
| <S2SV_ModStart> { if ( osStrchr <S2SV_ModEnd> ( ",<S2SV_blank>\\t" , <S2SV_ModStart> n ] ) != NULL ) { break ; } <S2SV_ModEnd> } if (
| Oryx-Embedded@CycloneTCP/de5336016edbe1e90327d0ed1cba5c4e49114366 | CVE-2021-26788 | https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366 | 2021-03-08T13:15Z |
43 | CWE-476 | CWE-476 static int show_stream ( WriterContext * w , AVFormatContext * fmt_ctx , int stream_idx , InputStream * ist , int in_program ) { AVStream * stream = ist -> st ; AVCodecParameters * par ; AVCodecContext * dec_ctx ; char val_str [ 128 ] ; const char * s ; AVRational sar , dar ; AVBPrint pbuf ; const AVCodecDescriptor * cd ; int ret = 0 ; const char * profile = NULL ; av_bprint_init ( & pbuf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ; writer_print_section_header ( w , in_program ? SECTION_ID_PROGRAM_STREAM : SECTION_ID_STREAM ) ; print_int ( "index" , stream -> index ) ; par = stream -> codecpar ; dec_ctx = ist -> dec_ctx ; if ( cd = avcodec_descriptor_get ( par -> codec_id ) ) { print_str ( "codec_name" , cd -> name ) ; if ( ! do_bitexact ) { print_str ( "codec_long_name" , cd -> long_name ? cd -> long_name : "unknown" ) ; } } else { print_str_opt ( "codec_name" , "unknown" ) ; if ( ! do_bitexact ) { print_str_opt ( "codec_long_name" , "unknown" ) ; } } if ( ! do_bitexact && ( profile = avcodec_profile_name ( par -> codec_id , par -> profile ) ) ) print_str ( "profile" , profile ) ; else { if ( par -> profile != FF_PROFILE_UNKNOWN ) { char profile_num [ 12 ] ; snprintf ( profile_num , sizeof ( profile_num ) , "%d" , par -> profile ) ; print_str ( "profile" , profile_num ) ; } else print_str_opt ( "profile" , "unknown" ) ; } s = av_get_media_type_string ( par -> codec_type ) ; if ( s ) print_str ( "codec_type" , s ) ; else print_str_opt ( "codec_type" , "unknown" ) ; # if FF_API_LAVF_AVCTX if ( dec_ctx ) print_q ( "codec_time_base" , dec_ctx -> time_base , '/' ) ; # endif print_str ( "codec_tag_string" , av_fourcc2str ( par -> codec_tag ) ) ; print_fmt ( "codec_tag" , "0x%04" PRIx32 , par -> codec_tag ) ; switch ( par -> codec_type ) { case AVMEDIA_TYPE_VIDEO : print_int ( "width" , par -> width ) ; print_int ( "height" , par -> height ) ; if ( dec_ctx ) { print_int ( "coded_width" , dec_ctx -> coded_width ) ; print_int ( "coded_height" , dec_ctx -> coded_height ) ; } print_int ( "has_b_frames" , par -> video_delay ) ; sar = av_guess_sample_aspect_ratio ( fmt_ctx , stream , NULL ) ; if ( sar . den ) { print_q ( "sample_aspect_ratio" , sar , ':' ) ; av_reduce ( & dar . num , & dar . den , par -> width * sar . num , par -> height * sar . den , 1024 * 1024 ) ; print_q ( "display_aspect_ratio" , dar , ':' ) ; } else { print_str_opt ( "sample_aspect_ratio" , "N/A" ) ; print_str_opt ( "display_aspect_ratio" , "N/A" ) ; } s = av_get_pix_fmt_name ( par -> format ) ; if ( s ) print_str ( "pix_fmt" , s ) ; else print_str_opt ( "pix_fmt" , "unknown" ) ; print_int ( "level" , par -> level ) ; if ( par -> color_range != AVCOL_RANGE_UNSPECIFIED ) print_str ( "color_range" , av_color_range_name ( par -> color_range ) ) ; else print_str_opt ( "color_range" , "N/A" ) ; if ( par -> color_space != AVCOL_SPC_UNSPECIFIED ) print_str ( "color_space" , av_color_space_name ( par -> color_space ) ) ; else print_str_opt ( "color_space" , av_color_space_name ( par -> color_space ) ) ; if ( par -> color_trc != AVCOL_TRC_UNSPECIFIED ) print_str ( "color_transfer" , av_color_transfer_name ( par -> color_trc ) ) ; else print_str_opt ( "color_transfer" , av_color_transfer_name ( par -> color_trc ) ) ; <S2SV_StartBug> if ( par -> color_primaries != AVCOL_PRI_UNSPECIFIED ) <S2SV_EndBug> print_str ( "color_primaries" , av_color_primaries_name ( par -> color_primaries ) ) ; else print_str_opt ( "color_primaries" , av_color_primaries_name ( par -> color_primaries ) ) ; if ( par -> chroma_location != AVCHROMA_LOC_UNSPECIFIED ) print_str ( "chroma_location" , av_chroma_location_name ( par -> chroma_location ) ) ; else print_str_opt ( "chroma_location" , av_chroma_location_name ( par -> chroma_location ) ) ; if ( par -> field_order == AV_FIELD_PROGRESSIVE ) print_str ( "field_order" , "progressive" ) ; else if ( par -> field_order == AV_FIELD_TT ) print_str ( "field_order" , "tt" ) ; else if ( par -> field_order == AV_FIELD_BB ) print_str ( "field_order" , "bb" ) ; else if ( par -> field_order == AV_FIELD_TB ) print_str ( "field_order" , "tb" ) ; else if ( par -> field_order == AV_FIELD_BT ) print_str ( "field_order" , "bt" ) ; else print_str_opt ( "field_order" , "unknown" ) ; # if FF_API_PRIVATE_OPT if ( dec_ctx && dec_ctx -> timecode_frame_start >= 0 ) { char tcbuf [ AV_TIMECODE_STR_SIZE ] ; av_timecode_make_mpeg_tc_string ( tcbuf , dec_ctx -> timecode_frame_start ) ; print_str ( "timecode" , tcbuf ) ; } else { print_str_opt ( "timecode" , "N/A" ) ; } # endif if ( dec_ctx ) print_int ( "refs" , dec_ctx -> refs ) ; break ; case AVMEDIA_TYPE_AUDIO : s = av_get_sample_fmt_name ( par -> format ) ; if ( s ) print_str ( "sample_fmt" , s ) ; else print_str_opt ( "sample_fmt" , "unknown" ) ; print_val ( "sample_rate" , par -> sample_rate , unit_hertz_str ) ; print_int ( "channels" , par -> channels ) ; if ( par -> channel_layout ) { av_bprint_clear ( & pbuf ) ; av_bprint_channel_layout ( & pbuf , par -> channels , par -> channel_layout ) ; print_str ( "channel_layout" , pbuf . str ) ; } else { print_str_opt ( "channel_layout" , "unknown" ) ; } print_int ( "bits_per_sample" , av_get_bits_per_sample ( par -> codec_id ) ) ; break ; case AVMEDIA_TYPE_SUBTITLE : if ( par -> width ) print_int ( "width" , par -> width ) ; else print_str_opt ( "width" , "N/A" ) ; if ( par -> height ) print_int ( "height" , par -> height ) ; else print_str_opt ( "height" , "N/A" ) ; break ; } if ( dec_ctx && dec_ctx -> codec && dec_ctx -> codec -> priv_class && show_private_data ) { const AVOption * opt = NULL ; while ( opt = av_opt_next ( dec_ctx -> priv_data , opt ) ) { uint8_t * str ; if ( opt -> flags ) continue ; if ( av_opt_get ( dec_ctx -> priv_data , opt -> name , 0 , & str ) >= 0 ) { print_str ( opt -> name , str ) ; av_free ( str ) ; } } } if ( fmt_ctx -> iformat -> flags & AVFMT_SHOW_IDS ) print_fmt ( "id" , "0x%x" , stream -> id ) ; else print_str_opt ( "id" , "N/A" ) ; print_q ( "r_frame_rate" , stream -> r_frame_rate , '/' ) ; print_q ( "avg_frame_rate" , stream -> avg_frame_rate , '/' ) ; print_q ( "time_base" , stream -> time_base , '/' ) ; print_ts ( "start_pts" , stream -> start_time ) ; print_time ( "start_time" , stream -> start_time , & stream -> time_base ) ; print_ts ( "duration_ts" , stream -> duration ) ; print_time ( "duration" , stream -> duration , & stream -> time_base ) ; if ( par -> bit_rate > 0 ) print_val ( "bit_rate" , par -> bit_rate , unit_bit_per_second_str ) ; else print_str_opt ( "bit_rate" , "N/A" ) ; # if FF_API_LAVF_AVCTX if ( stream -> codec -> rc_max_rate > 0 ) print_val ( "max_bit_rate" , stream -> codec -> rc_max_rate , unit_bit_per_second_str ) ; else print_str_opt ( "max_bit_rate" , "N/A" ) ; # endif if ( dec_ctx && dec_ctx -> bits_per_raw_sample > 0 ) print_fmt ( "bits_per_raw_sample" , "%d" , dec_ctx -> bits_per_raw_sample ) ; else print_str_opt ( "bits_per_raw_sample" , "N/A" ) ; if ( stream -> nb_frames ) print_fmt ( "nb_frames" , "%" PRId64 , stream -> nb_frames ) ; else print_str_opt ( "nb_frames" , "N/A" ) ; if ( nb_streams_frames [ stream_idx ] ) print_fmt ( "nb_read_frames" , "%" PRIu64 , nb_streams_frames [ stream_idx ] ) ; else print_str_opt ( "nb_read_frames" , "N/A" ) ; if ( nb_streams_packets [ stream_idx ] ) print_fmt ( "nb_read_packets" , "%" PRIu64 , nb_streams_packets [ stream_idx ] ) ; else print_str_opt ( "nb_read_packets" , "N/A" ) ; if ( do_show_data ) writer_print_data ( w , "extradata" , par -> extradata , par -> extradata_size ) ; writer_print_data_hash ( w , "extradata_hash" , par -> extradata , par -> extradata_size ) ; # define PRINT_DISPOSITION ( flagname , name ) do { print_int ( name , ! ! ( stream -> disposition & AV_DISPOSITION_ ## flagname ) ) ; } while ( 0 ) if ( do_show_stream_disposition ) { writer_print_section_header ( w , in_program ? SECTION_ID_PROGRAM_STREAM_DISPOSITION : SECTION_ID_STREAM_DISPOSITION ) ; PRINT_DISPOSITION ( DEFAULT , "default" ) ; PRINT_DISPOSITION ( DUB , "dub" ) ; PRINT_DISPOSITION ( ORIGINAL , "original" ) ; PRINT_DISPOSITION ( COMMENT , "comment" ) ; PRINT_DISPOSITION ( LYRICS , "lyrics" ) ; PRINT_DISPOSITION ( KARAOKE , "karaoke" ) ; PRINT_DISPOSITION ( FORCED , "forced" ) ; PRINT_DISPOSITION ( HEARING_IMPAIRED , "hearing_impaired" ) ; PRINT_DISPOSITION ( VISUAL_IMPAIRED , "visual_impaired" ) ; PRINT_DISPOSITION ( CLEAN_EFFECTS , "clean_effects" ) ; PRINT_DISPOSITION ( ATTACHED_PIC , "attached_pic" ) ; PRINT_DISPOSITION ( TIMED_THUMBNAILS , "timed_thumbnails" ) ; writer_print_section_footer ( w ) ; } if ( do_show_stream_tags ) ret = show_tags ( w , stream -> metadata , in_program ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS ) ; if ( stream -> nb_side_data ) { print_pkt_side_data ( w , stream -> codecpar , stream -> side_data , stream -> nb_side_data , SECTION_ID_STREAM_SIDE_DATA_LIST , SECTION_ID_STREAM_SIDE_DATA ) ; } writer_print_section_footer ( w ) ; av_bprint_finalize ( & pbuf , NULL ) ; fflush ( stdout ) ; return ret ; }
| <S2SV_ModStart> ) ) ; print_primaries ( w , <S2SV_ModEnd> par -> color_primaries <S2SV_ModStart> par -> color_primaries <S2SV_ModEnd> ) ; if
| FFmpeg@FFmpeg/837cb4325b712ff1aab531bf41668933f61d75d2 | CVE-2017-14225 | https://github.com/FFmpeg/FFmpeg/commit/837cb4325b712ff1aab531bf41668933f61d75d2 | 2017-09-09T08:29Z |
44 | CWE-399 | CWE-399 static int scm_fp_copy ( struct cmsghdr * cmsg , struct scm_fp_list * * fplp ) { int * fdp = ( int * ) CMSG_DATA ( cmsg ) ; struct scm_fp_list * fpl = * fplp ; struct file * * fpp ; int i , num ; num = ( cmsg -> cmsg_len - CMSG_ALIGN ( sizeof ( struct cmsghdr ) ) ) / sizeof ( int ) ; if ( num <= 0 ) return 0 ; if ( num > SCM_MAX_FD ) return - EINVAL ; if ( ! fpl ) { fpl = kmalloc ( sizeof ( struct scm_fp_list ) , GFP_KERNEL ) ; if ( ! fpl ) return - ENOMEM ; * fplp = fpl ; fpl -> count = 0 ; fpl -> max = SCM_MAX_FD ; <S2SV_StartBug> } <S2SV_EndBug> fpp = & fpl -> fp [ fpl -> count ] ; if ( fpl -> count + num > fpl -> max ) return - EINVAL ; for ( i = 0 ; i < num ; i ++ ) { int fd = fdp [ i ] ; struct file * file ; if ( fd < 0 || ! ( file = fget_raw ( fd ) ) ) return - EBADF ; * fpp ++ = file ; fpl -> count ++ ; } <S2SV_StartBug> return num ; <S2SV_EndBug> }
| <S2SV_ModStart> = SCM_MAX_FD ; fpl -> user = NULL ; <S2SV_ModStart> ++ ; } if ( ! fpl -> user ) fpl -> user = get_uid ( current_user ( ) ) ;
| torvalds@linux/415e3d3e90ce9e18727e8843ae343eda5a58fad6 | CVE-2016-2550 | https://github.com/torvalds/linux/commit/415e3d3e90ce9e18727e8843ae343eda5a58fad6 | 2016-04-27T17:59Z |
45 | CWE-119 | CWE-119 <S2SV_StartBug> static void show_object ( struct object * object , struct strbuf * path , <S2SV_EndBug> <S2SV_StartBug> const char * last , void * data ) <S2SV_EndBug> { struct bitmap * base = data ; bitmap_set ( base , find_object_pos ( object -> oid . hash ) ) ; mark_as_seen ( object ) ; }
| <S2SV_ModStart> * object , <S2SV_ModEnd> const char * <S2SV_ModStart> const char * name <S2SV_ModEnd> , void *
| git@git/de1e67d0703894cb6ea782e36abb63976ab07e60 | CVE-2016-2315 | https://github.com/git/git/commit/de1e67d0703894cb6ea782e36abb63976ab07e60 | 2016-04-08T14:59Z |
46 | CWE-20 | CWE-20 static enum try_read_result try_read_network ( conn * c ) { enum try_read_result gotdata = READ_NO_DATA_RECEIVED ; int res ; <S2SV_StartBug> assert ( c != NULL ) ; <S2SV_EndBug> if ( c -> rcurr != c -> rbuf ) { if ( c -> rbytes != 0 ) memmove ( c -> rbuf , c -> rcurr , c -> rbytes ) ; c -> rcurr = c -> rbuf ; } while ( 1 ) { <S2SV_StartBug> if ( c -> rbytes >= c -> rsize ) { <S2SV_EndBug> char * new_rbuf = realloc ( c -> rbuf , c -> rsize * 2 ) ; if ( ! new_rbuf ) { if ( settings . verbose > 0 ) fprintf ( stderr , "Couldn\'t<S2SV_blank>realloc<S2SV_blank>input<S2SV_blank>buffer\\n" ) ; c -> rbytes = 0 ; out_string ( c , "SERVER_ERROR<S2SV_blank>out<S2SV_blank>of<S2SV_blank>memory<S2SV_blank>reading<S2SV_blank>request" ) ; c -> write_and_go = conn_closing ; return READ_MEMORY_ERROR ; } c -> rcurr = c -> rbuf = new_rbuf ; c -> rsize *= 2 ; } int avail = c -> rsize - c -> rbytes ; res = read ( c -> sfd , c -> rbuf + c -> rbytes , avail ) ; if ( res > 0 ) { pthread_mutex_lock ( & c -> thread -> stats . mutex ) ; c -> thread -> stats . bytes_read += res ; pthread_mutex_unlock ( & c -> thread -> stats . mutex ) ; gotdata = READ_DATA_RECEIVED ; c -> rbytes += res ; if ( res == avail ) { continue ; } else { break ; } } if ( res == 0 ) { return READ_ERROR ; } if ( res == - 1 ) { if ( errno == EAGAIN || errno == EWOULDBLOCK ) { break ; } return READ_ERROR ; } } return gotdata ; }
| <S2SV_ModStart> int res ; int num_allocs = 0 ; <S2SV_ModStart> rsize ) { if ( num_allocs == 4 ) { return gotdata ; } ++ num_allocs ;
| memcached@memcached/75cc83685e103bc8ba380a57468c8f04413033f9 | CVE-2010-1152 | https://github.com/memcached/memcached/commit/75cc83685e103bc8ba380a57468c8f04413033f9 | 2010-04-12T18:30Z |
47 | CWE-399 | CWE-399 static Image * ReadCAPTIONImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { char * caption , geometry [ MaxTextExtent ] , * property , * text ; const char * gravity , * option ; DrawInfo * draw_info ; Image * image ; MagickBooleanType split , status ; register ssize_t i ; size_t height , width ; TypeMetric metrics ; assert ( image_info != ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickSignature ) ; if ( image_info -> debug != MagickFalse ) ( void ) LogMagickEvent ( TraceEvent , GetMagickModule ( ) , "%s" , image_info -> filename ) ; assert ( exception != ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickSignature ) ; image = AcquireImage ( image_info ) ; ( void ) ResetImagePage ( image , "0x0+0+0" ) ; option = GetImageOption ( image_info , "filename" ) ; if ( option == ( const char * ) NULL ) property = InterpretImageProperties ( image_info , image , image_info -> filename ) ; else if ( LocaleNCompare ( option , "caption:" , 8 ) == 0 ) property = InterpretImageProperties ( image_info , image , option + 8 ) ; else property = InterpretImageProperties ( image_info , image , option ) ; ( void ) SetImageProperty ( image , "caption" , property ) ; property = DestroyString ( property ) ; caption = ConstantString ( GetImageProperty ( image , "caption" ) ) ; draw_info = CloneDrawInfo ( image_info , ( DrawInfo * ) NULL ) ; ( void ) CloneString ( & draw_info -> text , caption ) ; gravity = GetImageOption ( image_info , "gravity" ) ; if ( gravity != ( char * ) NULL ) draw_info -> gravity = ( GravityType ) ParseCommandOption ( MagickGravityOptions , MagickFalse , gravity ) ; split = MagickFalse ; status = MagickTrue ; if ( image -> columns == 0 ) { text = AcquireString ( caption ) ; i = FormatMagickCaption ( image , draw_info , split , & metrics , & text ) ; ( void ) CloneString ( & draw_info -> text , text ) ; text = DestroyString ( text ) ; ( void ) FormatLocaleString ( geometry , MaxTextExtent , "%+g%+g" , - metrics . bounds . x1 , metrics . ascent ) ; if ( draw_info -> gravity == UndefinedGravity ) ( void ) CloneString ( & draw_info -> geometry , geometry ) ; status = GetMultilineTypeMetrics ( image , draw_info , & metrics ) ; width = ( size_t ) floor ( metrics . width + draw_info -> stroke_width + 0.5 ) ; image -> columns = width ; } if ( image -> rows == 0 ) { split = MagickTrue ; text = AcquireString ( caption ) ; i = FormatMagickCaption ( image , draw_info , split , & metrics , & text ) ; ( void ) CloneString ( & draw_info -> text , text ) ; text = DestroyString ( text ) ; ( void ) FormatLocaleString ( geometry , MaxTextExtent , "%+g%+g" , - metrics . bounds . x1 , metrics . ascent ) ; if ( draw_info -> gravity == UndefinedGravity ) ( void ) CloneString ( & draw_info -> geometry , geometry ) ; status = GetMultilineTypeMetrics ( image , draw_info , & metrics ) ; image -> rows = ( size_t ) ( ( i + 1 ) * ( metrics . ascent - metrics . descent + draw_info -> interline_spacing + draw_info -> stroke_width ) + 0.5 ) ; } if ( status != MagickFalse ) status = SetImageExtent ( image , image -> columns , image -> rows ) ; if ( status == MagickFalse ) { draw_info = DestroyDrawInfo ( draw_info ) ; InheritException ( exception , & image -> exception ) ; return ( DestroyImageList ( image ) ) ; } if ( SetImageBackgroundColor ( image ) == MagickFalse ) { draw_info = DestroyDrawInfo ( draw_info ) ; InheritException ( exception , & image -> exception ) ; image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } if ( ( fabs ( image_info -> pointsize ) < MagickEpsilon ) && ( strlen ( caption ) > 0 ) ) { double high , low ; for ( ; ; draw_info -> pointsize *= 2.0 ) { text = AcquireString ( caption ) ; i = FormatMagickCaption ( image , draw_info , split , & metrics , & text ) ; ( void ) CloneString ( & draw_info -> text , text ) ; text = DestroyString ( text ) ; ( void ) FormatLocaleString ( geometry , MaxTextExtent , "%+g%+g" , - metrics . bounds . x1 , metrics . ascent ) ; if ( draw_info -> gravity == UndefinedGravity ) ( void ) CloneString ( & draw_info -> geometry , geometry ) ; status = GetMultilineTypeMetrics ( image , draw_info , & metrics ) ; ( void ) status ; width = ( size_t ) floor ( metrics . width + draw_info -> stroke_width + 0.5 ) ; height = ( size_t ) floor ( metrics . height + draw_info -> stroke_width + 0.5 ) ; if ( ( image -> columns != 0 ) && ( image -> rows != 0 ) ) { if ( ( width >= image -> columns ) && ( height >= image -> rows ) ) break ; } else if ( ( ( image -> columns != 0 ) && ( width >= image -> columns ) ) || ( ( image -> rows != 0 ) && ( height >= image -> rows ) ) ) break ; } high = draw_info -> pointsize ; for ( low = 1.0 ; ( high - low ) > 0.5 ; ) { draw_info -> pointsize = ( low + high ) / 2.0 ; text = AcquireString ( caption ) ; i = FormatMagickCaption ( image , draw_info , split , & metrics , & text ) ; ( void ) CloneString ( & draw_info -> text , text ) ; text = DestroyString ( text ) ; ( void ) FormatLocaleString ( geometry , MaxTextExtent , "%+g%+g" , - metrics . bounds . x1 , metrics . ascent ) ; if ( draw_info -> gravity == UndefinedGravity ) ( void ) CloneString ( & draw_info -> geometry , geometry ) ; ( void ) GetMultilineTypeMetrics ( image , draw_info , & metrics ) ; width = ( size_t ) floor ( metrics . width + draw_info -> stroke_width + 0.5 ) ; height = ( size_t ) floor ( metrics . height + draw_info -> stroke_width + 0.5 ) ; if ( ( image -> columns != 0 ) && ( image -> rows != 0 ) ) { if ( ( width < image -> columns ) && ( height < image -> rows ) ) low = draw_info -> pointsize + 0.5 ; else high = draw_info -> pointsize - 0.5 ; } else if ( ( ( image -> columns != 0 ) && ( width < image -> columns ) ) || ( ( image -> rows != 0 ) && ( height < image -> rows ) ) ) low = draw_info -> pointsize + 0.5 ; else high = draw_info -> pointsize - 0.5 ; } draw_info -> pointsize = floor ( ( low + high ) / 2.0 - 0.5 ) ; } i = FormatMagickCaption ( image , draw_info , split , & metrics , & caption ) ; ( void ) CloneString ( & draw_info -> text , caption ) ; ( void ) FormatLocaleString ( geometry , MaxTextExtent , "%+g%+g" , MagickMax ( draw_info -> direction == RightToLeftDirection ? image -> columns - metrics . bounds . x2 : - metrics . bounds . x1 , 0.0 ) , draw_info -> gravity == UndefinedGravity ? metrics . ascent : 0.0 ) ; <S2SV_StartBug> draw_info -> geometry = AcquireString ( geometry ) ; <S2SV_EndBug> status = AnnotateImage ( image , draw_info ) ; if ( image_info -> pointsize == 0.0 ) { char pointsize [ MaxTextExtent ] ; ( void ) FormatLocaleString ( pointsize , MaxTextExtent , "%.20g" , draw_info -> pointsize ) ; ( void ) SetImageProperty ( image , "caption:pointsize" , pointsize ) ; } draw_info = DestroyDrawInfo ( draw_info ) ; caption = DestroyString ( caption ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } return ( GetFirstImageInList ( image ) ) ; }
| <S2SV_ModStart> 0.0 ) ; ( void ) CloneString ( & <S2SV_ModStart> draw_info -> geometry , <S2SV_ModEnd> geometry ) ;
| ImageMagick@ImageMagick/aeff00de228bc5a158c2a975ab47845d8a1db456 | CVE-2016-10146 | https://github.com/ImageMagick/ImageMagick/commit/aeff00de228bc5a158c2a975ab47845d8a1db456 | 2017-03-24T15:59Z |
48 | CWE-59 | CWE-59 static void fifo_open ( notify_fifo_t * fifo , int ( * script_exit ) ( thread_t * ) , const char * type ) { int ret ; int sav_errno ; if ( fifo -> name ) { sav_errno = 0 ; if ( ! ( ret = mkfifo ( fifo -> name , S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ) ) ) fifo -> created_fifo = true ; else { sav_errno = errno ; if ( sav_errno != EEXIST ) log_message ( LOG_INFO , "Unable<S2SV_blank>to<S2SV_blank>create<S2SV_blank>%snotify<S2SV_blank>fifo<S2SV_blank>%s" , type , fifo -> name ) ; } if ( ! sav_errno || sav_errno == EEXIST ) { if ( fifo -> script ) notify_fifo_exec ( master , script_exit , fifo , fifo -> script ) ; <S2SV_StartBug> if ( ( fifo -> fd = open ( fifo -> name , O_RDWR | O_CLOEXEC | O_NONBLOCK ) ) == - 1 ) { <S2SV_EndBug> log_message ( LOG_INFO , "Unable<S2SV_blank>to<S2SV_blank>open<S2SV_blank>%snotify<S2SV_blank>fifo<S2SV_blank>%s<S2SV_blank>-<S2SV_blank>errno<S2SV_blank>%d" , type , fifo -> name , errno ) ; if ( fifo -> created_fifo ) { unlink ( fifo -> name ) ; fifo -> created_fifo = false ; } } } if ( fifo -> fd == - 1 ) { FREE ( fifo -> name ) ; fifo -> name = NULL ; } } }
| <S2SV_ModStart> O_CLOEXEC | O_NONBLOCK | O_NOFOLLOW
| acassen@keepalived/04f2d32871bb3b11d7dc024039952f2fe2750306 | CVE-2018-19044 | https://github.com/acassen/keepalived/commit/04f2d32871bb3b11d7dc024039952f2fe2750306 | 2018-11-08T20:29Z |
49 | CWE-129 | CWE-129 int snmp_helper ( void * context , size_t hdrlen , unsigned char tag , const void * data , size_t datalen ) { struct snmp_ctx * ctx = ( struct snmp_ctx * ) context ; <S2SV_StartBug> __be32 * pdata = ( __be32 * ) data ; <S2SV_EndBug> if ( * pdata == ctx -> from ) { pr_debug ( "%s:<S2SV_blank>%pI4<S2SV_blank>to<S2SV_blank>%pI4\\n" , __func__ , ( void * ) & ctx -> from , ( void * ) & ctx -> to ) ; if ( * ctx -> check ) fast_csum ( ctx , ( unsigned char * ) data - ctx -> begin ) ; * pdata = ctx -> to ; } return 1 ; }
| <S2SV_ModStart> ; __be32 * pdata ; if ( datalen != 4 ) return - EINVAL ;
| torvalds@linux/c4c07b4d6fa1f11880eab8e076d3d060ef3f55fc | CVE-2019-9162 | https://github.com/torvalds/linux/commit/c4c07b4d6fa1f11880eab8e076d3d060ef3f55fc | 2019-02-25T23:29Z |
50 | CWE-000 | CWE-000 static int ghash_update ( struct shash_desc * desc , const u8 * src , unsigned int srclen ) { struct ghash_desc_ctx * dctx = shash_desc_ctx ( desc ) ; struct ghash_ctx * ctx = crypto_shash_ctx ( desc -> tfm ) ; u8 * dst = dctx -> buffer ; <S2SV_StartBug> if ( dctx -> bytes ) { <S2SV_EndBug> int n = min ( srclen , dctx -> bytes ) ; u8 * pos = dst + ( GHASH_BLOCK_SIZE - dctx -> bytes ) ; dctx -> bytes -= n ; srclen -= n ; while ( n -- ) * pos ++ ^= * src ++ ; if ( ! dctx -> bytes ) gf128mul_4k_lle ( ( be128 * ) dst , ctx -> gf128 ) ; } while ( srclen >= GHASH_BLOCK_SIZE ) { crypto_xor ( dst , src , GHASH_BLOCK_SIZE ) ; gf128mul_4k_lle ( ( be128 * ) dst , ctx -> gf128 ) ; src += GHASH_BLOCK_SIZE ; srclen -= GHASH_BLOCK_SIZE ; } if ( srclen ) { dctx -> bytes = GHASH_BLOCK_SIZE - srclen ; while ( srclen -- ) * dst ++ ^= * src ++ ; } return 0 ; }
| <S2SV_ModStart> ; if ( ! ctx -> gf128 ) return - ENOKEY ; if (
| torvalds@linux/7ed47b7d142ec99ad6880bbbec51e9f12b3af74c | CVE-2011-4081 | https://github.com/torvalds/linux/commit/7ed47b7d142ec99ad6880bbbec51e9f12b3af74c | 2012-05-24T23:55Z |
51 | CWE-835 | CWE-835 int WavpackSetConfiguration64 ( WavpackContext * wpc , WavpackConfig * config , int64_t total_samples , const unsigned char * chan_ids ) { uint32_t flags , bps = 0 ; uint32_t chan_mask = config -> channel_mask ; int num_chans = config -> num_channels ; <S2SV_StartBug> int i ; <S2SV_EndBug> wpc -> stream_version = ( config -> flags & CONFIG_COMPATIBLE_WRITE ) ? CUR_STREAM_VERS : MAX_STREAM_VERS ; if ( ( config -> qmode & QMODE_DSD_AUDIO ) && config -> bytes_per_sample == 1 && config -> bits_per_sample == 8 ) { # ifdef ENABLE_DSD wpc -> dsd_multiplier = 1 ; flags = DSD_FLAG ; for ( i = 14 ; i >= 0 ; -- i ) if ( config -> sample_rate % sample_rates [ i ] == 0 ) { int divisor = config -> sample_rate / sample_rates [ i ] ; if ( divisor && ( divisor & ( divisor - 1 ) ) == 0 ) { config -> sample_rate /= divisor ; wpc -> dsd_multiplier = divisor ; break ; } } if ( config -> flags & CONFIG_HYBRID_FLAG ) { strcpy ( wpc -> error_message , "hybrid<S2SV_blank>mode<S2SV_blank>not<S2SV_blank>available<S2SV_blank>for<S2SV_blank>DSD!" ) ; return FALSE ; } config -> flags &= ( CONFIG_HIGH_FLAG | CONFIG_MD5_CHECKSUM | CONFIG_PAIR_UNDEF_CHANS ) ; config -> float_norm_exp = config -> xmode = 0 ; # else strcpy ( wpc -> error_message , "libwavpack<S2SV_blank>not<S2SV_blank>configured<S2SV_blank>for<S2SV_blank>DSD!" ) ; return FALSE ; # endif } else flags = config -> bytes_per_sample - 1 ; wpc -> total_samples = total_samples ; wpc -> config . sample_rate = config -> sample_rate ; wpc -> config . num_channels = config -> num_channels ; wpc -> config . channel_mask = config -> channel_mask ; wpc -> config . bits_per_sample = config -> bits_per_sample ; wpc -> config . bytes_per_sample = config -> bytes_per_sample ; wpc -> config . block_samples = config -> block_samples ; wpc -> config . flags = config -> flags ; wpc -> config . qmode = config -> qmode ; if ( config -> flags & CONFIG_VERY_HIGH_FLAG ) wpc -> config . flags |= CONFIG_HIGH_FLAG ; for ( i = 0 ; i < 15 ; ++ i ) if ( wpc -> config . sample_rate == sample_rates [ i ] ) break ; flags |= i << SRATE_LSB ; if ( ! ( flags & DSD_FLAG ) ) { if ( config -> float_norm_exp ) { wpc -> config . float_norm_exp = config -> float_norm_exp ; wpc -> config . flags |= CONFIG_FLOAT_DATA ; flags |= FLOAT_DATA ; } else flags |= ( ( config -> bytes_per_sample * 8 ) - config -> bits_per_sample ) << SHIFT_LSB ; if ( config -> flags & CONFIG_HYBRID_FLAG ) { flags |= HYBRID_FLAG | HYBRID_BITRATE | HYBRID_BALANCE ; if ( ! ( wpc -> config . flags & CONFIG_SHAPE_OVERRIDE ) ) { wpc -> config . flags |= CONFIG_HYBRID_SHAPE | CONFIG_AUTO_SHAPING ; flags |= HYBRID_SHAPE | NEW_SHAPING ; } else if ( wpc -> config . flags & CONFIG_HYBRID_SHAPE ) { wpc -> config . shaping_weight = config -> shaping_weight ; flags |= HYBRID_SHAPE | NEW_SHAPING ; } if ( wpc -> config . flags & ( CONFIG_CROSS_DECORR | CONFIG_OPTIMIZE_WVC ) ) flags |= CROSS_DECORR ; if ( config -> flags & CONFIG_BITRATE_KBPS ) { bps = ( uint32_t ) floor ( config -> bitrate * 256000.0 / config -> sample_rate / config -> num_channels + 0.5 ) ; if ( bps > ( 64 << 8 ) ) bps = 64 << 8 ; } else bps = ( uint32_t ) floor ( config -> bitrate * 256.0 + 0.5 ) ; } else flags |= CROSS_DECORR ; if ( ! ( config -> flags & CONFIG_JOINT_OVERRIDE ) || ( config -> flags & CONFIG_JOINT_STEREO ) ) flags |= JOINT_STEREO ; if ( config -> flags & CONFIG_CREATE_WVC ) wpc -> wvc_flag = TRUE ; } if ( chan_ids ) { int lastchan = 0 , mask_copy = chan_mask ; if ( ( int ) strlen ( ( char * ) chan_ids ) > num_chans ) { strcpy ( wpc -> error_message , "chan_ids<S2SV_blank>longer<S2SV_blank>than<S2SV_blank>num<S2SV_blank>channels!" ) ; return FALSE ; } while ( * chan_ids ) if ( * chan_ids <= 32 && * chan_ids > lastchan && ( mask_copy & ( 1 << ( * chan_ids - 1 ) ) ) ) { mask_copy &= ~ ( 1 << ( * chan_ids - 1 ) ) ; lastchan = * chan_ids ++ ; } else break ; for ( i = 0 ; chan_ids [ i ] ; i ++ ) if ( chan_ids [ i ] != 0xff ) { wpc -> channel_identities = ( unsigned char * ) strdup ( ( char * ) chan_ids ) ; break ; } } for ( wpc -> current_stream = 0 ; num_chans ; wpc -> current_stream ++ ) { WavpackStream * wps = malloc ( sizeof ( WavpackStream ) ) ; unsigned char left_chan_id = 0 , right_chan_id = 0 ; int pos , chans = 1 ; wpc -> streams = realloc ( wpc -> streams , ( wpc -> current_stream + 1 ) * sizeof ( wpc -> streams [ 0 ] ) ) ; wpc -> streams [ wpc -> current_stream ] = wps ; CLEAR ( * wps ) ; if ( chan_mask ) for ( pos = 0 ; pos < 32 ; ++ pos ) if ( chan_mask & ( 1 << pos ) ) { if ( left_chan_id ) { right_chan_id = pos + 1 ; break ; } else { chan_mask &= ~ ( 1 << pos ) ; left_chan_id = pos + 1 ; } } while ( ! right_chan_id && chan_ids && * chan_ids ) if ( left_chan_id ) right_chan_id = * chan_ids ; else left_chan_id = * chan_ids ++ ; if ( ! left_chan_id ) left_chan_id = right_chan_id = 0xff ; else if ( ! right_chan_id ) right_chan_id = 0xff ; if ( num_chans >= 2 ) { if ( ( config -> flags & CONFIG_PAIR_UNDEF_CHANS ) && left_chan_id == 0xff && right_chan_id == 0xff ) chans = 2 ; else for ( i = 0 ; i < NUM_STEREO_PAIRS ; ++ i ) if ( ( left_chan_id == stereo_pairs [ i ] . a && right_chan_id == stereo_pairs [ i ] . b ) || ( left_chan_id == stereo_pairs [ i ] . b && right_chan_id == stereo_pairs [ i ] . a ) ) { if ( right_chan_id <= 32 && ( chan_mask & ( 1 << ( right_chan_id - 1 ) ) ) ) chan_mask &= ~ ( 1 << ( right_chan_id - 1 ) ) ; else if ( chan_ids && * chan_ids == right_chan_id ) chan_ids ++ ; chans = 2 ; break ; } } num_chans -= chans ; if ( num_chans && wpc -> current_stream == NEW_MAX_STREAMS - 1 ) break ; memcpy ( wps -> wphdr . ckID , "wvpk" , 4 ) ; wps -> wphdr . ckSize = sizeof ( WavpackHeader ) - 8 ; SET_TOTAL_SAMPLES ( wps -> wphdr , wpc -> total_samples ) ; wps -> wphdr . version = wpc -> stream_version ; wps -> wphdr . flags = flags ; wps -> bits = bps ; if ( ! wpc -> current_stream ) wps -> wphdr . flags |= INITIAL_BLOCK ; if ( ! num_chans ) wps -> wphdr . flags |= FINAL_BLOCK ; if ( chans == 1 ) { wps -> wphdr . flags &= ~ ( JOINT_STEREO | CROSS_DECORR | HYBRID_BALANCE ) ; wps -> wphdr . flags |= MONO_FLAG ; } } wpc -> num_streams = wpc -> current_stream ; wpc -> current_stream = 0 ; if ( num_chans ) { strcpy ( wpc -> error_message , "too<S2SV_blank>many<S2SV_blank>channels!" ) ; return FALSE ; } if ( config -> flags & CONFIG_EXTRA_MODE ) wpc -> config . xmode = config -> xmode ? config -> xmode : 1 ; return TRUE ; }
| <S2SV_ModStart> int i ; if ( ! config -> sample_rate ) { strcpy ( wpc -> error_message , "sample<S2SV_blank>rate<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>zero!" ) ; return FALSE ; }
| dbry@WavPack/070ef6f138956d9ea9612e69586152339dbefe51 | CVE-2018-19840 | https://github.com/dbry/WavPack/commit/070ef6f138956d9ea9612e69586152339dbefe51 | 2018-12-04T09:29Z |
52 | CWE-125 | CWE-125 static stmt_ty ast_for_funcdef ( struct compiling * c , const node * n , asdl_seq * decorator_seq ) { return ast_for_funcdef_impl ( c , n , decorator_seq , <S2SV_StartBug> 0 ) ; <S2SV_EndBug> }
| <S2SV_ModStart> , decorator_seq , false <S2SV_ModEnd> ) ; }
| python@typed_ast/156afcb26c198e162504a57caddfe0acd9ed7dce | CVE-2019-19275 | https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce | 2019-11-26T15:15Z |
53 | CWE-119 | CWE-119 static void scsi_write_complete ( void * opaque , int ret ) { SCSIDiskReq * r = ( SCSIDiskReq * ) opaque ; SCSIDiskState * s = DO_UPCAST ( SCSIDiskState , qdev , r -> req . dev ) ; <S2SV_StartBug> uint32_t len ; <S2SV_EndBug> uint32_t n ; if ( r -> req . aiocb != NULL ) { r -> req . aiocb = NULL ; bdrv_acct_done ( s -> bs , & r -> acct ) ; } if ( ret ) { if ( scsi_handle_rw_error ( r , - ret , SCSI_REQ_STATUS_RETRY_WRITE ) ) { return ; } } <S2SV_StartBug> n = r -> iov . iov_len / 512 ; <S2SV_EndBug> r -> sector += n ; r -> sector_count -= n ; if ( r -> sector_count == 0 ) { scsi_req_complete ( & r -> req , GOOD ) ; } else { <S2SV_StartBug> len = r -> sector_count * 512 ; <S2SV_EndBug> if ( len > SCSI_DMA_BUF_SIZE ) { len = SCSI_DMA_BUF_SIZE ; } r -> iov . iov_len = len ; <S2SV_StartBug> DPRINTF ( "Write<S2SV_blank>complete<S2SV_blank>tag=0x%x<S2SV_blank>more=%d\\n" , r -> req . tag , len ) ; <S2SV_EndBug> <S2SV_StartBug> scsi_req_data ( & r -> req , len ) ; <S2SV_EndBug> } }
| <S2SV_ModStart> ) ; uint32_t <S2SV_ModEnd> n ; if <S2SV_ModStart> = r -> qiov . size <S2SV_ModEnd> / 512 ; <S2SV_ModStart> } else { scsi_init_iovec ( r ) <S2SV_ModEnd> ; DPRINTF ( <S2SV_ModStart> . tag , r -> qiov . size <S2SV_ModEnd> ) ; scsi_req_data <S2SV_ModStart> -> req , r -> qiov . size <S2SV_ModEnd> ) ; }
| bonzini@qemu/103b40f51e4012b3b0ad20f615562a1806d7f49a | CVE-2011-3346 | https://github.com/bonzini/qemu/commit/103b40f51e4012b3b0ad20f615562a1806d7f49a | 2014-04-01T06:35Z |
54 | CWE-787 | CWE-787 <S2SV_StartBug> static MagickPixelPacket * * AcquirePixelThreadSet ( const Image * image ) <S2SV_EndBug> { MagickPixelPacket * * pixels ; register ssize_t i , j ; size_t <S2SV_StartBug> number_threads ; <S2SV_EndBug> number_threads = ( size_t ) GetMagickResourceLimit ( ThreadResource ) ; pixels = ( MagickPixelPacket * * ) AcquireQuantumMemory ( number_threads , sizeof ( * pixels ) ) ; if ( pixels == ( MagickPixelPacket * * ) NULL ) return ( ( MagickPixelPacket * * ) NULL ) ; ( void ) memset ( pixels , 0 , number_threads * sizeof ( * pixels ) ) ; <S2SV_StartBug> for ( i = 0 ; i < ( ssize_t ) number_threads ; i ++ ) <S2SV_EndBug> { <S2SV_StartBug> pixels [ i ] = ( MagickPixelPacket * ) AcquireQuantumMemory ( image -> columns , <S2SV_EndBug> sizeof ( * * pixels ) ) ; if ( pixels [ i ] == ( MagickPixelPacket * ) NULL ) return ( DestroyPixelThreadSet ( pixels ) ) ; <S2SV_StartBug> for ( j = 0 ; j < ( ssize_t ) image -> columns ; j ++ ) <S2SV_EndBug> <S2SV_StartBug> GetMagickPixelPacket ( image , & pixels [ i ] [ j ] ) ; <S2SV_EndBug> } return ( pixels ) ; }
| <S2SV_ModStart> const Image * images ) { const Image * next ; <S2SV_ModEnd> MagickPixelPacket * * <S2SV_ModStart> j ; size_t columns , <S2SV_ModStart> ) ) ; columns = images -> columns ; for ( next = images ; next != ( Image * ) NULL ; next = next -> next ) columns = MagickMax ( next -> columns , columns ) ; for ( <S2SV_ModEnd> i = 0 <S2SV_ModStart> ) AcquireQuantumMemory ( <S2SV_ModEnd> columns , sizeof <S2SV_ModStart> ( ssize_t ) <S2SV_ModEnd> columns ; j <S2SV_ModStart> ) GetMagickPixelPacket ( images <S2SV_ModEnd> , & pixels
| ImageMagick@ImageMagick/5e409ae7a389cdf2ed17469303be3f3f21cec450 | CVE-2019-13300 | https://github.com/ImageMagick/ImageMagick/commit/5e409ae7a389cdf2ed17469303be3f3f21cec450 | 2019-07-05T01:15Z |
55 | CWE-119 | CWE-119 void vp8_create_common ( VP8_COMMON * oci ) { vp8_machine_specific_config ( oci ) ; vp8_init_mbmode_probs ( oci ) ; vp8_default_bmode_probs ( oci -> fc . bmode_prob ) ; oci -> mb_no_coeff_skip = 1 ; oci -> no_lpf = 0 ; oci -> filter_type = NORMAL_LOOPFILTER ; oci -> use_bilinear_mc_filter = 0 ; oci -> full_pixel = 0 ; oci -> multi_token_partition = ONE_PARTITION ; oci -> clamp_type = RECON_CLAMP_REQUIRED ; <S2SV_StartBug> vpx_memset ( oci -> ref_frame_sign_bias , 0 , sizeof ( oci -> ref_frame_sign_bias ) ) ; <S2SV_EndBug> oci -> copy_buffer_to_gf = 0 ; oci -> copy_buffer_to_arf = 0 ; }
| <S2SV_ModStart> = RECON_CLAMP_REQUIRED ; memset <S2SV_ModEnd> ( oci ->
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
56 | CWE-125 | CWE-125 void icmp_print ( netdissect_options * ndo , const u_char * bp , u_int plen , const u_char * bp2 , int fragmented ) { char * cp ; const struct icmp * dp ; const struct icmp_ext_t * ext_dp ; const struct ip * ip ; const char * str , * fmt ; const struct ip * oip ; const struct udphdr * ouh ; const uint8_t * obj_tptr ; uint32_t raw_label ; const u_char * snapend_save ; const struct icmp_mpls_ext_object_header_t * icmp_mpls_ext_object_header ; u_int hlen , dport , mtu , obj_tlen , obj_class_num , obj_ctype ; char buf [ MAXHOSTNAMELEN + 100 ] ; struct cksum_vec vec [ 1 ] ; dp = ( const struct icmp * ) bp ; ext_dp = ( const struct icmp_ext_t * ) bp ; ip = ( const struct ip * ) bp2 ; str = buf ; ND_TCHECK ( dp -> icmp_code ) ; switch ( dp -> icmp_type ) { case ICMP_ECHO : case ICMP_ECHOREPLY : ND_TCHECK ( dp -> icmp_seq ) ; ( void ) snprintf ( buf , sizeof ( buf ) , "echo<S2SV_blank>%s,<S2SV_blank>id<S2SV_blank>%u,<S2SV_blank>seq<S2SV_blank>%u" , dp -> icmp_type == ICMP_ECHO ? "request" : "reply" , EXTRACT_16BITS ( & dp -> icmp_id ) , EXTRACT_16BITS ( & dp -> icmp_seq ) ) ; break ; case ICMP_UNREACH : ND_TCHECK ( dp -> icmp_ip . ip_dst ) ; switch ( dp -> icmp_code ) { case ICMP_UNREACH_PROTOCOL : ND_TCHECK ( dp -> icmp_ip . ip_p ) ; ( void ) snprintf ( buf , sizeof ( buf ) , "%s<S2SV_blank>protocol<S2SV_blank>%d<S2SV_blank>unreachable" , ipaddr_string ( ndo , & dp -> icmp_ip . ip_dst ) , dp -> icmp_ip . ip_p ) ; break ; case ICMP_UNREACH_PORT : ND_TCHECK ( dp -> icmp_ip . ip_p ) ; oip = & dp -> icmp_ip ; hlen = IP_HL ( oip ) * 4 ; ouh = ( const struct udphdr * ) ( ( ( const u_char * ) oip ) + hlen ) ; ND_TCHECK ( ouh -> uh_dport ) ; dport = EXTRACT_16BITS ( & ouh -> uh_dport ) ; switch ( oip -> ip_p ) { case IPPROTO_TCP : ( void ) snprintf ( buf , sizeof ( buf ) , "%s<S2SV_blank>tcp<S2SV_blank>port<S2SV_blank>%s<S2SV_blank>unreachable" , ipaddr_string ( ndo , & oip -> ip_dst ) , tcpport_string ( ndo , dport ) ) ; break ; case IPPROTO_UDP : ( void ) snprintf ( buf , sizeof ( buf ) , "%s<S2SV_blank>udp<S2SV_blank>port<S2SV_blank>%s<S2SV_blank>unreachable" , ipaddr_string ( ndo , & oip -> ip_dst ) , udpport_string ( ndo , dport ) ) ; break ; default : ( void ) snprintf ( buf , sizeof ( buf ) , "%s<S2SV_blank>protocol<S2SV_blank>%d<S2SV_blank>port<S2SV_blank>%d<S2SV_blank>unreachable" , ipaddr_string ( ndo , & oip -> ip_dst ) , oip -> ip_p , dport ) ; break ; } break ; case ICMP_UNREACH_NEEDFRAG : { register const struct mtu_discovery * mp ; mp = ( const struct mtu_discovery * ) ( const u_char * ) & dp -> icmp_void ; mtu = EXTRACT_16BITS ( & mp -> nexthopmtu ) ; if ( mtu ) { ( void ) snprintf ( buf , sizeof ( buf ) , "%s<S2SV_blank>unreachable<S2SV_blank>-<S2SV_blank>need<S2SV_blank>to<S2SV_blank>frag<S2SV_blank>(mtu<S2SV_blank>%d)" , ipaddr_string ( ndo , & dp -> icmp_ip . ip_dst ) , mtu ) ; } else { ( void ) snprintf ( buf , sizeof ( buf ) , "%s<S2SV_blank>unreachable<S2SV_blank>-<S2SV_blank>need<S2SV_blank>to<S2SV_blank>frag" , ipaddr_string ( ndo , & dp -> icmp_ip . ip_dst ) ) ; } } break ; default : fmt = tok2str ( unreach2str , "#%d<S2SV_blank>%%s<S2SV_blank>unreachable" , dp -> icmp_code ) ; ( void ) snprintf ( buf , sizeof ( buf ) , fmt , ipaddr_string ( ndo , & dp -> icmp_ip . ip_dst ) ) ; break ; } break ; case ICMP_REDIRECT : ND_TCHECK ( dp -> icmp_ip . ip_dst ) ; fmt = tok2str ( type2str , "redirect-#%d<S2SV_blank>%%s<S2SV_blank>to<S2SV_blank>net<S2SV_blank>%%s" , dp -> icmp_code ) ; ( void ) snprintf ( buf , sizeof ( buf ) , fmt , ipaddr_string ( ndo , & dp -> icmp_ip . ip_dst ) , ipaddr_string ( ndo , & dp -> icmp_gwaddr ) ) ; break ; case ICMP_ROUTERADVERT : { register const struct ih_rdiscovery * ihp ; register const struct id_rdiscovery * idp ; u_int lifetime , num , size ; ( void ) snprintf ( buf , sizeof ( buf ) , "router<S2SV_blank>advertisement" ) ; cp = buf + strlen ( buf ) ; ihp = ( const struct ih_rdiscovery * ) & dp -> icmp_void ; ND_TCHECK ( * ihp ) ; ( void ) strncpy ( cp , "<S2SV_blank>lifetime<S2SV_blank>" , sizeof ( buf ) - ( cp - buf ) ) ; cp = buf + strlen ( buf ) ; lifetime = EXTRACT_16BITS ( & ihp -> ird_lifetime ) ; if ( lifetime < 60 ) { ( void ) snprintf ( cp , sizeof ( buf ) - ( cp - buf ) , "%u" , lifetime ) ; } else if ( lifetime < 60 * 60 ) { ( void ) snprintf ( cp , sizeof ( buf ) - ( cp - buf ) , "%u:%02u" , lifetime / 60 , lifetime % 60 ) ; } else { ( void ) snprintf ( cp , sizeof ( buf ) - ( cp - buf ) , "%u:%02u:%02u" , lifetime / 3600 , ( lifetime % 3600 ) / 60 , lifetime % 60 ) ; } cp = buf + strlen ( buf ) ; num = ihp -> ird_addrnum ; ( void ) snprintf ( cp , sizeof ( buf ) - ( cp - buf ) , "<S2SV_blank>%d:" , num ) ; cp = buf + strlen ( buf ) ; size = ihp -> ird_addrsiz ; if ( size != 2 ) { ( void ) snprintf ( cp , sizeof ( buf ) - ( cp - buf ) , "<S2SV_blank>[size<S2SV_blank>%d]" , size ) ; break ; } idp = ( const struct id_rdiscovery * ) & dp -> icmp_data ; while ( num -- > 0 ) { ND_TCHECK ( * idp ) ; ( void ) snprintf ( cp , sizeof ( buf ) - ( cp - buf ) , "<S2SV_blank>{%s<S2SV_blank>%u}" , ipaddr_string ( ndo , & idp -> ird_addr ) , EXTRACT_32BITS ( & idp -> ird_pref ) ) ; cp = buf + strlen ( buf ) ; ++ idp ; } } break ; case ICMP_TIMXCEED : ND_TCHECK ( dp -> icmp_ip . ip_dst ) ; switch ( dp -> icmp_code ) { case ICMP_TIMXCEED_INTRANS : str = "time<S2SV_blank>exceeded<S2SV_blank>in-transit" ; break ; case ICMP_TIMXCEED_REASS : str = "ip<S2SV_blank>reassembly<S2SV_blank>time<S2SV_blank>exceeded" ; break ; default : ( void ) snprintf ( buf , sizeof ( buf ) , "time<S2SV_blank>exceeded-#%d" , dp -> icmp_code ) ; break ; } break ; case ICMP_PARAMPROB : if ( dp -> icmp_code ) ( void ) snprintf ( buf , sizeof ( buf ) , "parameter<S2SV_blank>problem<S2SV_blank>-<S2SV_blank>code<S2SV_blank>%d" , dp -> icmp_code ) ; else { ND_TCHECK ( dp -> icmp_pptr ) ; ( void ) snprintf ( buf , sizeof ( buf ) , "parameter<S2SV_blank>problem<S2SV_blank>-<S2SV_blank>octet<S2SV_blank>%d" , dp -> icmp_pptr ) ; } break ; case ICMP_MASKREPLY : ND_TCHECK ( dp -> icmp_mask ) ; ( void ) snprintf ( buf , sizeof ( buf ) , "address<S2SV_blank>mask<S2SV_blank>is<S2SV_blank>0x%08x" , EXTRACT_32BITS ( & dp -> icmp_mask ) ) ; break ; case ICMP_TSTAMP : ND_TCHECK ( dp -> icmp_seq ) ; ( void ) snprintf ( buf , sizeof ( buf ) , "time<S2SV_blank>stamp<S2SV_blank>query<S2SV_blank>id<S2SV_blank>%u<S2SV_blank>seq<S2SV_blank>%u" , EXTRACT_16BITS ( & dp -> icmp_id ) , EXTRACT_16BITS ( & dp -> icmp_seq ) ) ; break ; case ICMP_TSTAMPREPLY : ND_TCHECK ( dp -> icmp_ttime ) ; ( void ) snprintf ( buf , sizeof ( buf ) , "time<S2SV_blank>stamp<S2SV_blank>reply<S2SV_blank>id<S2SV_blank>%u<S2SV_blank>seq<S2SV_blank>%u:<S2SV_blank>org<S2SV_blank>%s" , EXTRACT_16BITS ( & dp -> icmp_id ) , EXTRACT_16BITS ( & dp -> icmp_seq ) , icmp_tstamp_print ( EXTRACT_32BITS ( & dp -> icmp_otime ) ) ) ; ( void ) snprintf ( buf + strlen ( buf ) , sizeof ( buf ) - strlen ( buf ) , ",<S2SV_blank>recv<S2SV_blank>%s" , icmp_tstamp_print ( EXTRACT_32BITS ( & dp -> icmp_rtime ) ) ) ; ( void ) snprintf ( buf + strlen ( buf ) , sizeof ( buf ) - strlen ( buf ) , ",<S2SV_blank>xmit<S2SV_blank>%s" , icmp_tstamp_print ( EXTRACT_32BITS ( & dp -> icmp_ttime ) ) ) ; break ; default : str = tok2str ( icmp2str , "type-#%d" , dp -> icmp_type ) ; break ; } ND_PRINT ( ( ndo , "ICMP<S2SV_blank>%s,<S2SV_blank>length<S2SV_blank>%u" , str , plen ) ) ; if ( ndo -> ndo_vflag && ! fragmented ) { uint16_t sum , icmp_sum ; if ( ND_TTEST2 ( * bp , plen ) ) { vec [ 0 ] . ptr = ( const uint8_t * ) ( const void * ) dp ; vec [ 0 ] . len = plen ; sum = in_cksum ( vec , 1 ) ; if ( sum != 0 ) { icmp_sum = EXTRACT_16BITS ( & dp -> icmp_cksum ) ; ND_PRINT ( ( ndo , "<S2SV_blank>(wrong<S2SV_blank>icmp<S2SV_blank>cksum<S2SV_blank>%x<S2SV_blank>(->%x)!)" , icmp_sum , in_cksum_shouldbe ( icmp_sum , sum ) ) ) ; } } } if ( ndo -> ndo_vflag >= 1 && ICMP_ERRTYPE ( dp -> icmp_type ) ) { bp += 8 ; ND_PRINT ( ( ndo , "\\n\\t" ) ) ; ip = ( const struct ip * ) bp ; snapend_save = ndo -> ndo_snapend ; ip_print ( ndo , bp , EXTRACT_16BITS ( & ip -> ip_len ) ) ; ndo -> ndo_snapend = snapend_save ; } if ( ndo -> ndo_vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MPLS_EXT_TYPE ( dp -> icmp_type ) ) { ND_TCHECK ( * ext_dp ) ; <S2SV_StartBug> if ( ! ext_dp -> icmp_length ) { <S2SV_EndBug> vec [ 0 ] . ptr = ( const uint8_t * ) ( const void * ) & ext_dp -> icmp_ext_version_res ; vec [ 0 ] . len = plen - ICMP_EXTD_MINLEN ; if ( in_cksum ( vec , 1 ) ) { return ; } } ND_PRINT ( ( ndo , "\\n\\tMPLS<S2SV_blank>extension<S2SV_blank>v%u" , ICMP_MPLS_EXT_EXTRACT_VERSION ( * ( ext_dp -> icmp_ext_version_res ) ) ) ) ; if ( ICMP_MPLS_EXT_EXTRACT_VERSION ( * ( ext_dp -> icmp_ext_version_res ) ) != ICMP_MPLS_EXT_VERSION ) { ND_PRINT ( ( ndo , "<S2SV_blank>packet<S2SV_blank>not<S2SV_blank>supported" ) ) ; return ; } hlen = plen - ICMP_EXTD_MINLEN ; <S2SV_StartBug> vec [ 0 ] . ptr = ( const uint8_t * ) ( const void * ) & ext_dp -> icmp_ext_version_res ; <S2SV_EndBug> vec [ 0 ] . len = hlen ; ND_PRINT ( ( ndo , ",<S2SV_blank>checksum<S2SV_blank>0x%04x<S2SV_blank>(%scorrect),<S2SV_blank>length<S2SV_blank>%u" , EXTRACT_16BITS ( ext_dp -> icmp_ext_checksum ) , in_cksum ( vec , 1 ) ? "in" : "" , hlen ) ) ; <S2SV_StartBug> hlen -= 4 ; <S2SV_EndBug> obj_tptr = ( const uint8_t * ) ext_dp -> icmp_ext_data ; while ( hlen > sizeof ( struct icmp_mpls_ext_object_header_t ) ) { icmp_mpls_ext_object_header = ( const struct icmp_mpls_ext_object_header_t * ) obj_tptr ; ND_TCHECK ( * icmp_mpls_ext_object_header ) ; obj_tlen = EXTRACT_16BITS ( icmp_mpls_ext_object_header -> length ) ; obj_class_num = icmp_mpls_ext_object_header -> class_num ; obj_ctype = icmp_mpls_ext_object_header -> ctype ; obj_tptr += sizeof ( struct icmp_mpls_ext_object_header_t ) ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>%s<S2SV_blank>Object<S2SV_blank>(%u),<S2SV_blank>Class-Type:<S2SV_blank>%u,<S2SV_blank>length<S2SV_blank>%u" , tok2str ( icmp_mpls_ext_obj_values , "unknown" , obj_class_num ) , obj_class_num , obj_ctype , obj_tlen ) ) ; hlen -= sizeof ( struct icmp_mpls_ext_object_header_t ) ; if ( ( obj_class_num == 0 ) || ( obj_tlen < sizeof ( struct icmp_mpls_ext_object_header_t ) ) ) { return ; } obj_tlen -= sizeof ( struct icmp_mpls_ext_object_header_t ) ; switch ( obj_class_num ) { case 1 : switch ( obj_ctype ) { case 1 : ND_TCHECK2 ( * obj_tptr , 4 ) ; raw_label = EXTRACT_32BITS ( obj_tptr ) ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>label<S2SV_blank>%u,<S2SV_blank>exp<S2SV_blank>%u" , MPLS_LABEL ( raw_label ) , MPLS_EXP ( raw_label ) ) ) ; if ( MPLS_STACK ( raw_label ) ) ND_PRINT ( ( ndo , ",<S2SV_blank>[S]" ) ) ; ND_PRINT ( ( ndo , ",<S2SV_blank>ttl<S2SV_blank>%u" , MPLS_TTL ( raw_label ) ) ) ; break ; default : print_unknown_data ( ndo , obj_tptr , "\\n\\t<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" , obj_tlen ) ; } break ; case 2 : default : print_unknown_data ( ndo , obj_tptr , "\\n\\t<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" , obj_tlen ) ; break ; } if ( hlen < obj_tlen ) break ; hlen -= obj_tlen ; obj_tptr += obj_tlen ; } } return ; trunc : ND_PRINT ( ( ndo , "[|icmp]" ) ) ; }
| <S2SV_ModStart> ext_dp -> icmp_length && ND_TTEST2 ( ext_dp -> icmp_ext_version_res , plen - ICMP_EXTD_MINLEN ) <S2SV_ModStart> - ICMP_EXTD_MINLEN ; if ( ND_TTEST2 ( ext_dp -> icmp_ext_version_res , hlen ) ) { <S2SV_ModStart> ) ) ; }
| the-tcpdump-group@tcpdump/2b62d1dda41590db29368ec7ba5f4faf3464765a | CVE-2017-12895 | https://github.com/the-tcpdump-group/tcpdump/commit/2b62d1dda41590db29368ec7ba5f4faf3464765a | 2017-09-14T06:29Z |
57 | CWE-189 | CWE-189 void jiffies_to_timespec ( const unsigned long jiffies , struct timespec * value ) { <S2SV_StartBug> u64 nsec = ( u64 ) jiffies * TICK_NSEC ; <S2SV_EndBug> <S2SV_StartBug> value -> tv_sec = div_long_long_rem ( nsec , NSEC_PER_SEC , & value -> tv_nsec ) ; <S2SV_EndBug> }
| <S2SV_ModStart> value ) { u32 rem ; value -> tv_sec = div_u64_rem ( <S2SV_ModEnd> ( u64 ) <S2SV_ModStart> jiffies * TICK_NSEC , NSEC_PER_SEC , & rem ) <S2SV_ModStart> ; value -> tv_nsec = rem <S2SV_ModEnd> ; } <S2SV_null>
| torvalds@linux/f8bd2258e2d520dff28c855658bd24bdafb5102d | CVE-2011-3209 | https://github.com/torvalds/linux/commit/f8bd2258e2d520dff28c855658bd24bdafb5102d | 2012-10-03T11:02Z |
58 | CWE-20 | CWE-20 void enc624j600UpdateMacConfig ( NetInterface * interface ) { uint16_t duplexMode ; <S2SV_StartBug> duplexMode = enc624j600ReadReg ( interface , ENC624J600_REG_ESTAT ) & ESTAT_PHYDPX ; <S2SV_EndBug> if ( duplexMode ) { <S2SV_StartBug> enc624j600WriteReg ( interface , ENC624J600_REG_MACON2 , MACON2_DEFER | <S2SV_EndBug> MACON2_PADCFG2 | MACON2_PADCFG0 | MACON2_TXCRCEN | MACON2_R1 | MACON2_FULDPX ) ; <S2SV_StartBug> enc624j600WriteReg ( interface , ENC624J600_REG_MABBIPG , 0x15 ) ; <S2SV_EndBug> } else { <S2SV_StartBug> enc624j600WriteReg ( interface , ENC624J600_REG_MACON2 , MACON2_DEFER | <S2SV_EndBug> MACON2_PADCFG2 | MACON2_PADCFG0 | MACON2_TXCRCEN | MACON2_R1 ) ; <S2SV_StartBug> enc624j600WriteReg ( interface , ENC624J600_REG_MABBIPG , 0x12 ) ; <S2SV_EndBug> } }
| <S2SV_ModStart> ( interface , ENC624J600_ESTAT ) & ENC624J600_ESTAT_PHYDPX <S2SV_ModEnd> ; if ( <S2SV_ModStart> ( interface , ENC624J600_MACON2 , ENC624J600_MACON2_DEFER | ENC624J600_MACON2_PADCFG_AUTO | ENC624J600_MACON2_TXCRCEN | ENC624J600_MACON2_R1_DEFAULT | ENC624J600_MACON2_FULDPX <S2SV_ModEnd> ) ; enc624j600WriteReg <S2SV_ModStart> ( interface , ENC624J600_MABBIPG , ENC624J600_MABBIPG_BBIPG_DEFAULT_FD <S2SV_ModEnd> ) ; } <S2SV_ModStart> ( interface , ENC624J600_MACON2 , ENC624J600_MACON2_DEFER | ENC624J600_MACON2_PADCFG_AUTO | ENC624J600_MACON2_TXCRCEN | ENC624J600_MACON2_R1_DEFAULT <S2SV_ModEnd> ) ; enc624j600WriteReg <S2SV_ModStart> ( interface , ENC624J600_MABBIPG , ENC624J600_MABBIPG_BBIPG_DEFAULT_HD <S2SV_ModEnd> ) ; }
| Oryx-Embedded@CycloneTCP/de5336016edbe1e90327d0ed1cba5c4e49114366 | CVE-2021-26788 | https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366 | 2021-03-08T13:15Z |
59 | CWE-787 | CWE-787 GF_Err adts_dmx_process ( GF_Filter * filter ) { GF_ADTSDmxCtx * ctx = gf_filter_get_udta ( filter ) ; GF_FilterPacket * pck , * dst_pck ; u8 * data , * output ; u8 * start ; u32 pck_size , remain , prev_pck_size ; u64 cts = GF_FILTER_NO_TS ; if ( ! ctx -> duration . num ) adts_dmx_check_dur ( filter , ctx ) ; if ( ctx -> opid && ! ctx -> is_playing ) return GF_OK ; pck = gf_filter_pid_get_packet ( ctx -> ipid ) ; if ( ! pck ) { if ( gf_filter_pid_is_eos ( ctx -> ipid ) ) { if ( ! ctx -> adts_buffer_size ) { if ( ctx -> opid ) gf_filter_pid_set_eos ( ctx -> opid ) ; if ( ctx -> src_pck ) gf_filter_pck_unref ( ctx -> src_pck ) ; ctx -> src_pck = NULL ; return GF_EOS ; } } else { return GF_OK ; } } prev_pck_size = ctx -> adts_buffer_size ; if ( pck && ! ctx -> resume_from ) { data = ( char * ) gf_filter_pck_get_data ( pck , & pck_size ) ; if ( ! pck_size ) { gf_filter_pid_drop_packet ( ctx -> ipid ) ; return GF_OK ; } if ( ctx -> byte_offset != GF_FILTER_NO_BO ) { u64 byte_offset = gf_filter_pck_get_byte_offset ( pck ) ; if ( ! ctx -> adts_buffer_size ) { ctx -> byte_offset = byte_offset ; } else if ( ctx -> byte_offset + ctx -> adts_buffer_size != byte_offset ) { ctx -> byte_offset = GF_FILTER_NO_BO ; if ( ( byte_offset != GF_FILTER_NO_BO ) && ( byte_offset > ctx -> adts_buffer_size ) ) { ctx -> byte_offset = byte_offset - ctx -> adts_buffer_size ; } } } if ( ctx -> adts_buffer_size + pck_size > ctx -> adts_buffer_alloc ) { ctx -> adts_buffer_alloc = ctx -> adts_buffer_size + pck_size ; ctx -> adts_buffer = gf_realloc ( ctx -> adts_buffer , ctx -> adts_buffer_alloc ) ; } memcpy ( ctx -> adts_buffer + ctx -> adts_buffer_size , data , pck_size ) ; ctx -> adts_buffer_size += pck_size ; } if ( ctx -> timescale && pck ) { cts = gf_filter_pck_get_cts ( pck ) ; } if ( cts == GF_FILTER_NO_TS ) { prev_pck_size = 0 ; } remain = ctx -> adts_buffer_size ; start = ctx -> adts_buffer ; if ( ctx -> resume_from ) { start += ctx -> resume_from - 1 ; remain -= ctx -> resume_from - 1 ; ctx -> resume_from = 0 ; } while ( remain ) { u8 * sync ; u32 sync_pos , size , offset , bytes_to_drop = 0 , nb_blocks_per_frame ; if ( ! ctx -> tag_size && ( remain > 3 ) ) { if ( start [ 0 ] == 'I' && start [ 1 ] == 'D' && start [ 2 ] == '3' ) { if ( remain < 10 ) return GF_OK ; ctx -> tag_size = ( ( start [ 9 ] & 0x7f ) + ( ( start [ 8 ] & 0x7f ) << 7 ) + ( ( start [ 7 ] & 0x7f ) << 14 ) + ( ( start [ 6 ] & 0x7f ) << 21 ) ) ; bytes_to_drop = 10 ; if ( ctx -> id3_buffer_alloc < ctx -> tag_size + 10 ) { ctx -> id3_buffer = gf_realloc ( ctx -> id3_buffer , ctx -> tag_size + 10 ) ; ctx -> id3_buffer_alloc = ctx -> tag_size + 10 ; } memcpy ( ctx -> id3_buffer , start , 10 ) ; ctx -> id3_buffer_size = 10 ; goto drop_byte ; } } if ( ctx -> tag_size ) { if ( ctx -> tag_size > remain ) { bytes_to_drop = remain ; ctx -> tag_size -= remain ; } else { bytes_to_drop = ctx -> tag_size ; ctx -> tag_size = 0 ; } memcpy ( ctx -> id3_buffer + ctx -> id3_buffer_size , start , bytes_to_drop ) ; ctx -> id3_buffer_size += bytes_to_drop ; if ( ! ctx -> tag_size && ctx -> opid ) { id3dmx_flush ( filter , ctx -> id3_buffer , ctx -> id3_buffer_size , ctx -> opid , ctx -> expart ? & ctx -> vpid : NULL ) ; ctx -> id3_buffer_size = 0 ; } goto drop_byte ; } sync = memchr ( start , 0xFF , remain ) ; sync_pos = ( u32 ) ( sync ? sync - start : remain ) ; if ( remain - sync_pos < 7 ) { break ; } if ( ( sync [ 1 ] & 0xF0 ) != 0xF0 ) { GF_LOG ( ctx -> nb_frames ? GF_LOG_WARNING : GF_LOG_DEBUG , GF_LOG_PARSER , ( "[ADTSDmx]<S2SV_blank>invalid<S2SV_blank>ADTS<S2SV_blank>sync<S2SV_blank>bytes,<S2SV_blank>resyncing\\n" ) ) ; ctx -> nb_frames = 0 ; goto drop_byte ; } if ( ! ctx -> bs ) { ctx -> bs = gf_bs_new ( sync + 1 , remain - sync_pos - 1 , GF_BITSTREAM_READ ) ; } else { gf_bs_reassign_buffer ( ctx -> bs , sync + 1 , remain - sync_pos - 1 ) ; } gf_bs_read_int ( ctx -> bs , 4 ) ; ctx -> hdr . is_mp2 = ( Bool ) gf_bs_read_int ( ctx -> bs , 1 ) ; ctx -> hdr . is_mp2 = 0 ; gf_bs_read_int ( ctx -> bs , 2 ) ; ctx -> hdr . no_crc = ( Bool ) gf_bs_read_int ( ctx -> bs , 1 ) ; ctx -> hdr . profile = 1 + gf_bs_read_int ( ctx -> bs , 2 ) ; ctx -> hdr . sr_idx = gf_bs_read_int ( ctx -> bs , 4 ) ; gf_bs_read_int ( ctx -> bs , 1 ) ; ctx -> hdr . nb_ch = gf_bs_read_int ( ctx -> bs , 3 ) ; gf_bs_read_int ( ctx -> bs , 4 ) ; ctx -> hdr . frame_size = gf_bs_read_int ( ctx -> bs , 13 ) ; gf_bs_read_int ( ctx -> bs , 11 ) ; nb_blocks_per_frame = gf_bs_read_int ( ctx -> bs , 2 ) ; ctx -> hdr . hdr_size = 7 ; if ( ! ctx -> hdr . no_crc ) { u32 skip ; if ( ! nb_blocks_per_frame ) { skip = 2 ; } else { skip = 2 + 2 * nb_blocks_per_frame ; } ctx -> hdr . hdr_size += skip ; gf_bs_skip_bytes ( ctx -> bs , skip ) ; } if ( ! ctx -> hdr . frame_size || ! GF_M4ASampleRates [ ctx -> hdr . sr_idx ] ) { GF_LOG ( GF_LOG_DEBUG , GF_LOG_PARSER , ( "[ADTSDmx]<S2SV_blank>Invalid<S2SV_blank>ADTS<S2SV_blank>frame<S2SV_blank>header,<S2SV_blank>resyncing\\n" ) ) ; ctx -> nb_frames = 0 ; goto drop_byte ; } if ( ( nb_blocks_per_frame > 2 ) || ( nb_blocks_per_frame && ctx -> hdr . nb_ch ) ) { GF_LOG ( GF_LOG_ERROR , GF_LOG_PARSER , ( "[ADTSDmx]<S2SV_blank>Unsupported<S2SV_blank>multi-block<S2SV_blank>ADTS<S2SV_blank>frame<S2SV_blank>header<S2SV_blank>-<S2SV_blank>patch<S2SV_blank>welcome\\n" ) ) ; ctx -> nb_frames = 0 ; goto drop_byte ; } else if ( ! nb_blocks_per_frame ) { if ( ctx -> aacchcfg < 0 ) ctx -> hdr . nb_ch = - ctx -> aacchcfg ; else if ( ! ctx -> hdr . nb_ch ) ctx -> hdr . nb_ch = ctx -> aacchcfg ; if ( ! ctx -> hdr . nb_ch ) { GF_LOG ( GF_LOG_WARNING , GF_LOG_PARSER , ( "[ADTSDmx]<S2SV_blank>Missing<S2SV_blank>channel<S2SV_blank>configuration<S2SV_blank>in<S2SV_blank>ADTS<S2SV_blank>frame<S2SV_blank>header,<S2SV_blank>defaulting<S2SV_blank>to<S2SV_blank>stereo<S2SV_blank>-<S2SV_blank>use<S2SV_blank>`--aacchcfg`<S2SV_blank>to<S2SV_blank>force<S2SV_blank>config\\n" ) ) ; ctx -> hdr . nb_ch = ctx -> aacchcfg = 2 ; } } if ( nb_blocks_per_frame == 2 ) { u32 pos = ( u32 ) gf_bs_get_position ( ctx -> bs ) ; gf_m4a_parse_program_config_element ( ctx -> bs , & ctx -> acfg ) ; if ( ! ctx -> hdr . no_crc ) gf_bs_skip_bytes ( ctx -> bs , 2 ) ; ctx -> hdr . hdr_size += ( u32 ) gf_bs_get_position ( ctx -> bs ) - pos ; } if ( ctx -> hdr . nb_ch == 7 ) ctx -> hdr . nb_ch = 8 ; if ( ctx -> hdr . frame_size + 1 < remain ) { u32 next_frame = ctx -> hdr . frame_size ; if ( ( sync [ next_frame ] != 0xFF ) || ( ( sync [ next_frame + 1 ] & 0xF0 ) != 0xF0 ) ) { GF_LOG ( ctx -> nb_frames ? GF_LOG_WARNING : GF_LOG_DEBUG , GF_LOG_PARSER , ( "[ADTSDmx]<S2SV_blank>invalid<S2SV_blank>next<S2SV_blank>ADTS<S2SV_blank>frame<S2SV_blank>sync,<S2SV_blank>resyncing\\n" ) ) ; ctx -> nb_frames = 0 ; goto drop_byte ; } } else if ( pck ) { if ( ctx -> timescale && ! prev_pck_size && ( cts != GF_FILTER_NO_TS ) ) { ctx -> cts = cts ; } break ; } <S2SV_StartBug> adts_dmx_check_pid ( filter , ctx ) ; <S2SV_EndBug> if ( ! ctx -> is_playing ) { ctx -> resume_from = 1 + ctx -> adts_buffer_size - remain ; return GF_OK ; } ctx -> nb_frames ++ ; size = ctx -> hdr . frame_size - ctx -> hdr . hdr_size ; offset = ctx -> hdr . hdr_size ; if ( ( nb_blocks_per_frame == 2 ) && ! ctx -> hdr . no_crc ) size -= 2 ; if ( ctx -> in_seek ) { u64 nb_samples_at_seek = ( u64 ) ( ctx -> start_range * GF_M4ASampleRates [ ctx -> sr_idx ] ) ; if ( ctx -> cts + ctx -> dts_inc >= nb_samples_at_seek ) { ctx -> in_seek = GF_FALSE ; } } bytes_to_drop = ctx -> hdr . frame_size ; if ( ctx -> timescale && ! prev_pck_size && ( cts != GF_FILTER_NO_TS ) ) { ctx -> cts = cts ; cts = GF_FILTER_NO_TS ; } if ( ! ctx -> in_seek ) { dst_pck = gf_filter_pck_new_alloc ( ctx -> opid , size , & output ) ; if ( ctx -> src_pck ) gf_filter_pck_merge_properties ( ctx -> src_pck , dst_pck ) ; memcpy ( output , sync + offset , size ) ; gf_filter_pck_set_dts ( dst_pck , ctx -> cts ) ; gf_filter_pck_set_cts ( dst_pck , ctx -> cts ) ; gf_filter_pck_set_duration ( dst_pck , ctx -> dts_inc ) ; gf_filter_pck_set_framing ( dst_pck , GF_TRUE , GF_TRUE ) ; gf_filter_pck_set_sap ( dst_pck , GF_FILTER_SAP_1 ) ; if ( ctx -> byte_offset != GF_FILTER_NO_BO ) { gf_filter_pck_set_byte_offset ( dst_pck , ctx -> byte_offset + ctx -> hdr . hdr_size ) ; } gf_filter_pck_send ( dst_pck ) ; } adts_dmx_update_cts ( ctx ) ; if ( bytes_to_drop > remain ) { GF_LOG ( GF_LOG_WARNING , GF_LOG_PARSER , ( "[ADTSDmx]<S2SV_blank>truncated<S2SV_blank>ADTS<S2SV_blank>frame!\\n" ) ) ; bytes_to_drop = remain ; } drop_byte : if ( ! bytes_to_drop ) { bytes_to_drop = 1 ; } start += bytes_to_drop ; remain -= bytes_to_drop ; if ( prev_pck_size ) { if ( prev_pck_size > bytes_to_drop ) prev_pck_size -= bytes_to_drop ; else { prev_pck_size = 0 ; if ( ctx -> src_pck ) gf_filter_pck_unref ( ctx -> src_pck ) ; ctx -> src_pck = pck ; if ( pck ) gf_filter_pck_ref_props ( & ctx -> src_pck ) ; } } if ( ctx -> byte_offset != GF_FILTER_NO_BO ) ctx -> byte_offset += bytes_to_drop ; } if ( ! pck ) { ctx -> adts_buffer_size = 0 ; return adts_dmx_process ( filter ) ; } else { if ( remain ) { memmove ( ctx -> adts_buffer , start , remain ) ; } ctx -> adts_buffer_size = remain ; gf_filter_pid_drop_packet ( ctx -> ipid ) ; } return GF_OK ; }
| <S2SV_ModStart> break ; } if ( ctx -> hdr . frame_size < ctx -> hdr . hdr_size ) { GF_LOG ( GF_LOG_WARNING , GF_LOG_PARSER , ( "[ADTSDmx]<S2SV_blank>Corrupted<S2SV_blank>ADTS<S2SV_blank>frame<S2SV_blank>header,<S2SV_blank>resyncing\\n" ) ) ; ctx -> nb_frames = 0 ; goto drop_byte ; }
| gpac@gpac/22774aa9e62f586319c8f107f5bae950fed900bc | CVE-2021-30019 | https://github.com/gpac/gpac/commit/22774aa9e62f586319c8f107f5bae950fed900bc | 2021-04-19T20:15Z |
60 | CWE-119 | CWE-119 <S2SV_StartBug> void vp9_rc_update_rate_correction_factors ( VP9_COMP * cpi , int damp_var ) { <S2SV_EndBug> const VP9_COMMON * const cm = & cpi -> common ; int correction_factor = 100 ; double rate_correction_factor = get_rate_correction_factor ( cpi ) ; double adjustment_limit ; int projected_size_based_on_q = 0 ; <S2SV_StartBug> vp9_clear_system_state ( ) ; <S2SV_EndBug> projected_size_based_on_q = estimate_bits_at_q ( cm -> frame_type , cm -> base_qindex , cm -> MBs , <S2SV_StartBug> rate_correction_factor ) ; <S2SV_EndBug> <S2SV_StartBug> if ( projected_size_based_on_q > 0 ) <S2SV_EndBug> correction_factor = ( 100 * cpi -> rc . projected_frame_size ) / projected_size_based_on_q ; switch ( damp_var ) { case 0 : adjustment_limit = 0.75 ; break ; case 1 : adjustment_limit = 0.375 ; break ; case 2 : default : adjustment_limit = 0.25 ; break ; } if ( correction_factor > 102 ) { correction_factor = ( int ) ( 100 + ( ( correction_factor - 100 ) * adjustment_limit ) ) ; rate_correction_factor = ( rate_correction_factor * correction_factor ) / 100 ; if ( rate_correction_factor > MAX_BPB_FACTOR ) rate_correction_factor = MAX_BPB_FACTOR ; } else if ( correction_factor < 99 ) { correction_factor = ( int ) ( 100 - ( ( 100 - correction_factor ) * adjustment_limit ) ) ; rate_correction_factor = ( rate_correction_factor * correction_factor ) / 100 ; if ( rate_correction_factor < MIN_BPB_FACTOR ) rate_correction_factor = MIN_BPB_FACTOR ; } set_rate_correction_factor ( cpi , rate_correction_factor ) ; }
| <S2SV_ModStart> VP9_COMP * cpi <S2SV_ModEnd> ) { const <S2SV_ModStart> = 0 ; if ( cpi -> rc . is_src_frame_alt_ref ) return ; vpx_clear_system_state ( ) ; if ( cpi -> oxcf . aq_mode == CYCLIC_REFRESH_AQ && cpi -> common . seg . enabled ) { projected_size_based_on_q = vp9_cyclic_refresh_estimate_bits_at_q ( cpi , rate_correction_factor ) ; } else { projected_size_based_on_q = vp9_estimate_bits_at_q ( cpi -> common . <S2SV_ModEnd> frame_type , cm <S2SV_ModStart> MBs , rate_correction_factor , cm -> bit_depth ) ; } <S2SV_ModEnd> if ( projected_size_based_on_q <S2SV_ModStart> ( projected_size_based_on_q > FRAME_OVERHEAD_BITS ) correction_factor = ( int ) ( ( 100 * ( int64_t ) cpi -> rc . projected_frame_size ) / projected_size_based_on_q ) ; adjustment_limit = 0.25 + 0.5 * MIN ( 1 , fabs ( log10 ( 0.01 * correction_factor ) ) ) ; cpi -> rc . q_2_frame = cpi -> rc . q_1_frame ; cpi -> rc . q_1_frame = cm -> base_qindex ; cpi -> rc . rc_2_frame = cpi -> rc . rc_1_frame ; if ( correction_factor > 110 ) cpi -> rc . rc_1_frame = - 1 ; else if ( correction_factor < 90 ) cpi -> rc . rc_1_frame = 1 ; else cpi -> rc . rc_1_frame = 0 ; <S2SV_ModEnd> if ( correction_factor
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
61 | CWE-79 | CWE-79 void interprete ( char * lbook , char * path ) { int status , i , j , n , message_id , inactive ; char list [ 1000 ] , section [ 256 ] , str [ NAME_LENGTH ] , str1 [ NAME_LENGTH ] , str2 [ NAME_LENGTH ] , edit_id [ 80 ] , file_name [ 256 ] , command [ 256 ] , enc_path [ 256 ] , dec_path [ 256 ] , uname [ 80 ] , full_name [ 256 ] , user_email [ 256 ] , logbook [ 256 ] , logbook_enc [ 256 ] , * experiment , group [ 256 ] , css [ 256 ] , * pfile , attachment [ MAX_PATH_LENGTH ] , str3 [ NAME_LENGTH ] , thumb_name [ 256 ] , sid [ 32 ] , error_str [ 256 ] , subdir [ 256 ] , * s ; LOGBOOK * lbs ; FILE * f ; strcpy ( dec_path , path ) ; url_decode ( dec_path ) ; strcpy ( enc_path , dec_path ) ; url_encode ( enc_path , sizeof ( enc_path ) ) ; strencode2 ( command , isparam ( "cmd" ) ? getparam ( "cmd" ) : "" , sizeof ( command ) ) ; strencode2 ( group , isparam ( "group" ) ? getparam ( "group" ) : "" , sizeof ( group ) ) ; experiment = getparam ( "exp" ) ; if ( getcfg ( lbook , "Logging<S2SV_blank>Level" , str , sizeof ( str ) ) ) _logging_level = atoi ( str ) ; else _logging_level = 2 ; set_condition ( "" ) ; message_id = atoi ( dec_path ) ; if ( isparam ( "jcmd" ) && * getparam ( "jcmd" ) ) strlcpy ( command , getparam ( "jcmd" ) , sizeof ( command ) ) ; if ( stricmp ( command , "loc" ) == 0 ) { show_http_header ( NULL , FALSE , NULL ) ; <S2SV_StartBug> if ( isparam ( "value" ) && * getparam ( "value" ) ) <S2SV_EndBug> <S2SV_StartBug> rsputs ( loc ( getparam ( "value" ) ) ) ; <S2SV_EndBug> s = loc ( "Drop<S2SV_blank>attachments<S2SV_blank>here..." ) ; s = loc ( "Insert<S2SV_blank>Timestamp" ) ; if ( s ) s = NULL ; return ; } if ( experiment && experiment [ 0 ] ) { strcpy ( logbook_enc , experiment ) ; strcpy ( logbook , experiment ) ; url_decode ( logbook ) ; for ( i = 0 ; ; i ++ ) { if ( ! enumgrp ( i , str ) ) break ; if ( strieq ( logbook , str ) ) break ; } if ( ! strieq ( logbook , str ) ) { sprintf ( str , "Error:<S2SV_blank>logbook<S2SV_blank>\\"%s\\"<S2SV_blank>not<S2SV_blank>defined<S2SV_blank>in<S2SV_blank>%s" , logbook_enc , CFGFILE ) ; show_error ( str ) ; return ; } } else { strcpy ( logbook_enc , lbook ) ; strcpy ( logbook , lbook ) ; url_decode ( logbook ) ; } setcfg_topgroup ( "" ) ; sprintf ( str , "Top<S2SV_blank>group<S2SV_blank>%s" , logbook ) ; if ( getcfg ( "global" , str , list , sizeof ( list ) ) ) { setcfg_topgroup ( logbook ) ; logbook [ 0 ] = 0 ; } for ( i = j = 0 ; ; i ++ ) { if ( ! enumgrp ( i , str ) ) break ; if ( is_logbook ( str ) ) { if ( ! strieq ( str , lb_list [ j ++ ] . name ) ) { el_index_logbooks ( ) ; break ; } } } if ( lb_list [ j ] . name [ 0 ] != 0 ) el_index_logbooks ( ) ; if ( ! logbook [ 0 ] ) { if ( getcfg ( group , "Self<S2SV_blank>register" , str , sizeof ( str ) ) && atoi ( str ) > 0 ) { if ( ! do_self_register ( NULL , getparam ( "cmd" ) ) ) return ; } if ( strieq ( command , loc ( "Activate" ) ) && isparam ( "new_user_name" ) && isparam ( "code" ) ) { if ( ! activate_user ( NULL , getparam ( "new_user_name" ) , atoi ( getparam ( "code" ) ) ) ) return ; setparam ( "cfg_user" , getparam ( "new_user_name" ) ) ; get_user_line ( NULL , getparam ( "new_user_name" ) , NULL , full_name , user_email , NULL , NULL , NULL ) ; sprintf ( str , "%s<S2SV_blank><b><%s></b>" , full_name , user_email ) ; sprintf ( str2 , loc ( "Activation<S2SV_blank>notice<S2SV_blank>has<S2SV_blank>been<S2SV_blank>sent<S2SV_blank>to<S2SV_blank>%s" ) , str ) ; setparam ( "notice" , str2 ) ; show_config_page ( NULL ) ; return ; } if ( strieq ( command , loc ( "Save" ) ) ) { if ( isparam ( "config" ) ) { if ( ! isparam ( "config" ) || ! save_user_config ( NULL , getparam ( "config" ) , FALSE ) ) return ; } redirect ( NULL , "." ) ; return ; } if ( isparam ( "cmd" ) || isparam ( "newpwd" ) ) { if ( isparam ( "newpwd" ) || strieq ( command , loc ( "Change<S2SV_blank>password" ) ) ) { if ( sid_check ( getparam ( "sid" ) , uname ) ) setparam ( "unm" , uname ) ; show_change_pwd_page ( NULL ) ; return ; } } if ( isparam ( "uname" ) && isparam ( "upassword" ) ) { strlcpy ( uname , getparam ( "uname" ) , sizeof ( uname ) ) ; sprintf ( str , "LOGIN<S2SV_blank>user<S2SV_blank>\\"%s\\"<S2SV_blank>(attempt)<S2SV_blank>for<S2SV_blank>logbook<S2SV_blank>selection<S2SV_blank>page" , uname ) ; write_logfile ( NULL , str ) ; if ( isparam ( "redir" ) ) strlcpy ( str , getparam ( "redir" ) , sizeof ( str ) ) ; else strlcpy ( str , isparam ( "cmdline" ) ? getparam ( "cmdline" ) : "" , sizeof ( str ) ) ; if ( ! auth_verify_password ( NULL , uname , getparam ( "upassword" ) , error_str , sizeof ( error_str ) ) ) { if ( error_str [ 0 ] ) show_error ( error_str ) ; else show_login_page ( NULL , str , 1 ) ; return ; } if ( get_user_line ( NULL , uname , NULL , full_name , NULL , NULL , NULL , NULL ) == 2 ) { if ( ! getcfg ( group , "Self<S2SV_blank>register" , str , sizeof ( str ) ) || atoi ( str ) == 0 ) { show_login_page ( NULL , str , 1 ) ; return ; } # ifdef HAVE_PAM getcfg ( NULL , "Authentication" , str , sizeof ( str ) ) ; if ( stristr ( str , "PAM" ) ) { show_new_user_page ( NULL , uname ) ; return ; } # endif } set_user_password ( NULL , uname , getparam ( "upassword" ) ) ; sprintf ( str , "LOGIN<S2SV_blank>user<S2SV_blank>\\"%s\\"<S2SV_blank>(success)" , uname ) ; write_logfile ( NULL , str ) ; sid_new ( NULL , uname , ( char * ) inet_ntoa ( rem_addr ) , sid ) ; set_sid_cookie ( NULL , sid , full_name ) ; return ; } if ( ! logbook [ 0 ] && getcfg ( "global" , "Selection<S2SV_blank>page" , str , sizeof ( str ) ) ) { if ( strstr ( str , "http://" ) || strstr ( str , "https://" ) ) { redirect ( NULL , str ) ; return ; } if ( str [ 0 ] == DIR_SEPARATOR || str [ 1 ] == ':' ) strlcpy ( file_name , str , sizeof ( file_name ) ) ; else { strlcpy ( file_name , logbook_dir , sizeof ( file_name ) ) ; strlcat ( file_name , str , sizeof ( file_name ) ) ; } send_file_direct ( file_name ) ; return ; } if ( strieq ( command , "Synchronize" ) ) { synchronize ( NULL , SYNC_HTML ) ; return ; } } for ( n = 0 ; lb_list [ n ] . name [ 0 ] ; n ++ ) ; if ( ! logbook [ 0 ] && ! path [ 0 ] ) { if ( n > 1 ) { if ( strieq ( command , loc ( "Forgot" ) ) ) { show_forgot_pwd_page ( NULL ) ; return ; } show_selection_page ( ) ; return ; } strcpy ( logbook , lb_list [ 0 ] . name ) ; strcpy ( logbook_enc , logbook ) ; url_encode ( logbook_enc , sizeof ( logbook_enc ) ) ; } for ( i = 0 ; lb_list [ i ] . name [ 0 ] ; i ++ ) if ( strieq ( logbook , lb_list [ i ] . name ) ) break ; lbs = & lb_list [ i ] ; if ( lbs -> top_group [ 0 ] ) setcfg_topgroup ( lbs -> top_group ) ; if ( getcfg ( logbook , "Theme" , str , sizeof ( str ) ) ) strlcpy ( theme_name , str , sizeof ( theme_name ) ) ; else strlcpy ( theme_name , "default" , sizeof ( theme_name ) ) ; lbs = lb_list + i ; lbs -> n_attr = scan_attributes ( lbs -> name ) ; if ( lbs -> n_attr < 0 ) return ; if ( isparam ( "acmd" ) && * getparam ( "acmd" ) ) { if ( strieq ( getparam ( "acmd" ) , "Upload" ) ) show_uploader_json ( lbs ) ; return ; } getcfg ( lbs -> name , "Authentication" , str , sizeof ( str ) ) ; if ( stristr ( str , "Webserver" ) ) { if ( http_user [ 0 ] ) { if ( ! sid_check ( getparam ( "sid" ) , http_user ) ) { sid_new ( lbs , http_user , ( char * ) inet_ntoa ( rem_addr ) , sid ) ; set_sid_cookie ( lbs , sid , http_user ) ; } } else { sprintf ( str , "Error:<S2SV_blank>Misconfigured<S2SV_blank>webserver,<S2SV_blank>did<S2SV_blank>not<S2SV_blank>get<S2SV_blank>X-Forwarded-User<S2SV_blank>from<S2SV_blank>it." ) ; show_error ( str ) ; return ; } } if ( isparam ( "uname" ) && isparam ( "upassword" ) ) { strlcpy ( uname , getparam ( "uname" ) , sizeof ( uname ) ) ; sprintf ( str , "LOGIN<S2SV_blank>user<S2SV_blank>\\"%s\\"<S2SV_blank>(attempt)" , uname ) ; write_logfile ( lbs , str ) ; if ( isparam ( "redir" ) ) strlcpy ( str , getparam ( "redir" ) , sizeof ( str ) ) ; else strlcpy ( str , isparam ( "cmdline" ) ? getparam ( "cmdline" ) : "" , sizeof ( str ) ) ; if ( ! auth_verify_password ( lbs , uname , getparam ( "upassword" ) , error_str , sizeof ( error_str ) ) ) { if ( error_str [ 0 ] ) show_error ( error_str ) ; else show_login_page ( lbs , str , 1 ) ; return ; } if ( get_user_line ( lbs , uname , NULL , full_name , NULL , NULL , NULL , & inactive ) == 2 ) { if ( ! getcfg ( lbs -> name , "Self<S2SV_blank>register" , str , sizeof ( str ) ) || atoi ( str ) == 0 ) { show_login_page ( lbs , str , 1 ) ; return ; } # ifdef HAVE_PAM getcfg ( lbs -> name , "Authentication" , str , sizeof ( str ) ) ; if ( stristr ( str , "PAM" ) ) { show_new_user_page ( lbs , uname ) ; return ; } # endif } if ( inactive ) { show_error ( "This<S2SV_blank>account<S2SV_blank>is<S2SV_blank>currently<S2SV_blank>deactivated" ) ; return ; } if ( ! check_login_user ( lbs , getparam ( "uname" ) ) ) { show_error ( "User<S2SV_blank>has<S2SV_blank>no<S2SV_blank>access<S2SV_blank>to<S2SV_blank>this<S2SV_blank>logbook" ) ; return ; } set_user_password ( lbs , uname , getparam ( "upassword" ) ) ; sprintf ( str , "LOGIN<S2SV_blank>user<S2SV_blank>\\"%s\\"<S2SV_blank>(success)" , uname ) ; write_logfile ( lbs , str ) ; sid_new ( lbs , uname , ( char * ) inet_ntoa ( rem_addr ) , sid ) ; set_sid_cookie ( lbs , sid , full_name ) ; return ; } if ( chkext ( path , ".gif" ) || chkext ( path , ".jpg" ) || chkext ( path , ".png" ) || chkext ( path , ".ico" ) || chkext ( path , ".htm" ) || chkext ( path , ".css" ) ) { strlcpy ( str , resource_dir , sizeof ( str ) ) ; strlcat ( str , path , sizeof ( str ) ) ; if ( exist_file ( str ) ) { send_file_direct ( str ) ; return ; } else { strlcpy ( str , resource_dir , sizeof ( str ) ) ; strlcat ( str , "themes" , sizeof ( str ) ) ; strlcat ( str , DIR_SEPARATOR_STR , sizeof ( str ) ) ; strlcat ( str , theme_name , sizeof ( str ) ) ; strlcat ( str , DIR_SEPARATOR_STR , sizeof ( str ) ) ; strlcat ( str , path , sizeof ( str ) ) ; if ( exist_file ( str ) ) { send_file_direct ( str ) ; return ; } } } if ( ! logbook [ 0 ] ) { strencode2 ( str2 , path , sizeof ( str2 ) ) ; sprintf ( str , "%s:<S2SV_blank><b>%s</b>" , loc ( "Invalid<S2SV_blank>URL" ) , str2 ) ; show_error ( str ) ; return ; } if ( strieq ( command , loc ( "Activate" ) ) && isparam ( "unm" ) && isparam ( "code" ) && ! isparam ( "new_user_name" ) ) { strlcpy ( uname , getparam ( "unm" ) , sizeof ( uname ) ) ; if ( ! activate_user ( lbs , uname , atoi ( getparam ( "code" ) ) ) ) return ; sprintf ( str , "ACTIVATE<S2SV_blank>user<S2SV_blank>\\"%s\\"<S2SV_blank>(success)" , uname ) ; write_logfile ( lbs , str ) ; sid_new ( lbs , uname , ( char * ) inet_ntoa ( rem_addr ) , sid ) ; sprintf ( str , "?cmd=%s¬ice=%s.<S2SV_blank>%s" , loc ( "Config" ) , loc ( "Your<S2SV_blank>account<S2SV_blank>has<S2SV_blank>been<S2SV_blank>activated" ) , loc ( "Please<S2SV_blank>subscribe<S2SV_blank>to<S2SV_blank>logbooks<S2SV_blank>if<S2SV_blank>you<S2SV_blank>want<S2SV_blank>to<S2SV_blank>receive<S2SV_blank>automatic<S2SV_blank>email<S2SV_blank>notifications" ) ) ; setparam ( "redir" , str ) ; set_sid_cookie ( lbs , sid , uname ) ; return ; } # ifdef HAVE_PAM if ( strieq ( command , loc ( "Save" ) ) && isparam ( "new_user_name" ) && ! isparam ( "config" ) ) { save_user_config ( NULL , getparam ( "new_user_name" ) , 1 ) ; redirect ( lbs , "" ) ; check_login ( lbs , NULL ) ; return ; } # endif if ( getcfg ( lbs -> name , "Password<S2SV_blank>file" , str , sizeof ( str ) ) ) { strlcpy ( css , "elog.css" , sizeof ( css ) ) ; if ( lbs != NULL && getcfg ( lbs -> name , "CSS" , str , sizeof ( str ) ) ) strlcpy ( css , str , sizeof ( css ) ) ; else if ( lbs == NULL && getcfg ( "global" , "CSS" , str , sizeof ( str ) ) ) strlcpy ( css , str , sizeof ( css ) ) ; if ( getcfg ( lbs -> name , "Guest<S2SV_blank>menu<S2SV_blank>commands" , str , sizeof ( str ) ) ) { if ( sid_check ( getparam ( "sid" ) , uname ) ) setparam ( "unm" , uname ) ; } if ( uname [ 0 ] && ! isparam ( "new_user_name" ) ) { if ( ! set_user_login_time ( lbs , uname ) ) { show_error ( loc ( "File<S2SV_blank>system<S2SV_blank>full,<S2SV_blank>ELOG<S2SV_blank>cannot<S2SV_blank>continue<S2SV_blank>to<S2SV_blank>work" ) ) ; return ; } } if ( ! ( getcfg ( lbs -> name , "Guest<S2SV_blank>menu<S2SV_blank>commands" , str , sizeof ( str ) ) && ! isparam ( "fail" ) ) ) { if ( strcmp ( path , css ) != 0 ) { if ( getcfg ( lbs -> name , "Self<S2SV_blank>register" , str , sizeof ( str ) ) && atoi ( str ) > 0 ) { if ( ! do_self_register ( lbs , command ) ) return ; } if ( ! check_login ( lbs , getparam ( "sid" ) ) ) return ; } } } if ( strieq ( command , loc ( "Login" ) ) ) { check_login ( lbs , "" ) ; return ; } if ( strieq ( command , loc ( "New" ) ) || strieq ( command , loc ( "Edit" ) ) || strieq ( command , loc ( "Reply" ) ) || strieq ( command , loc ( "Duplicate" ) ) || strieq ( command , loc ( "Delete" ) ) || strieq ( command , loc ( "Upload" ) ) || strieq ( command , loc ( "Submit" ) ) || strieq ( command , loc ( "Preview" ) ) ) { sprintf ( str , "%s?cmd=%s" , path , command ) ; } if ( strieq ( command , loc ( "Delete" ) ) || strieq ( command , loc ( "Config" ) ) || strieq ( command , loc ( "Copy<S2SV_blank>to" ) ) || strieq ( command , loc ( "Move<S2SV_blank>to" ) ) ) { sprintf ( str , "%s?cmd=%s" , path , command ) ; } if ( strieq ( command , loc ( "Back" ) ) ) { if ( isparam ( "edit_id" ) ) { el_lock_message ( lbs , atoi ( getparam ( "edit_id" ) ) , NULL , FALSE ) ; el_draft_message ( lbs , atoi ( getparam ( "edit_id" ) ) , NULL , FALSE ) ; strlcpy ( edit_id , getparam ( "edit_id" ) , sizeof ( edit_id ) ) ; sprintf ( str , "../%s/%s" , logbook_enc , edit_id ) ; } else sprintf ( str , "../%s/" , logbook_enc ) ; if ( getcfg ( lbs -> name , "Back<S2SV_blank>to<S2SV_blank>main" , str , sizeof ( str ) ) && atoi ( str ) == 1 ) strcpy ( str , "../" ) ; redirect ( lbs , str ) ; return ; } if ( strieq ( command , "XDelete" ) ) { if ( getparam ( "edit_id" ) ) { status = el_delete_message ( lbs , atoi ( getparam ( "edit_id" ) ) , TRUE , NULL , TRUE , TRUE ) ; if ( status != EL_SUCCESS ) { sprintf ( str , "%s<S2SV_blank>=<S2SV_blank>%d" , loc ( "Error<S2SV_blank>deleting<S2SV_blank>message:<S2SV_blank>status" ) , status ) ; show_error ( str ) ; return ; } } redirect ( lbs , "" ) ; return ; } if ( strieq ( command , "Unlock" ) ) { if ( isparam ( "edit_id" ) ) { el_lock_message ( lbs , atoi ( getparam ( "edit_id" ) ) , NULL , FALSE ) ; strlcpy ( edit_id , getparam ( "edit_id" ) , sizeof ( edit_id ) ) ; sprintf ( str , "../%s/%s" , logbook_enc , edit_id ) ; } else sprintf ( str , "../%s/" , logbook_enc ) ; if ( getcfg ( lbs -> name , "Back<S2SV_blank>to<S2SV_blank>main" , str , sizeof ( str ) ) && atoi ( str ) == 1 ) strcpy ( str , "../" ) ; redirect ( lbs , str ) ; return ; } if ( strieq ( command , loc ( "List" ) ) ) { if ( getcfg ( lbs -> name , "Back<S2SV_blank>to<S2SV_blank>main" , str , sizeof ( str ) ) && atoi ( str ) == 1 ) { redirect ( lbs , "../" ) ; return ; } show_elog_list ( lbs , 0 , 0 , 0 , TRUE , NULL ) ; return ; } if ( strieq ( command , loc ( "Cancel" ) ) ) { sprintf ( str , "../%s/%s" , logbook_enc , path ) ; redirect ( lbs , str ) ; return ; } strlcpy ( str , isparam ( "last" ) ? getparam ( "last" ) : "" , sizeof ( str ) ) ; if ( strchr ( str , '<S2SV_blank>' ) ) { i = atoi ( strchr ( str , '<S2SV_blank>' ) ) ; sprintf ( str , "last%d" , i ) ; if ( isparam ( "mode" ) ) { sprintf ( str + strlen ( str ) , "?mode=" ) ; strlcat ( str , getparam ( "mode" ) , sizeof ( str ) ) ; } redirect ( lbs , str ) ; return ; } strlcpy ( str , isparam ( "past" ) ? getparam ( "past" ) : "" , sizeof ( str ) ) ; if ( strchr ( str , '<S2SV_blank>' ) ) { i = atoi ( strchr ( str , '<S2SV_blank>' ) ) ; sprintf ( str , "past%d" , i ) ; redirect ( lbs , str ) ; return ; } if ( strncmp ( path , "past" , 4 ) == 0 && ( isdigit ( path [ 4 ] ) || isdigit ( path [ 5 ] ) ) && isparam ( "cmd" ) == 0 ) { show_elog_list ( lbs , atoi ( path + 4 ) , 0 , 0 , FALSE , NULL ) ; return ; } if ( strncmp ( path , "last" , 4 ) == 0 && ! chkext ( path , ".png" ) && ( ! isparam ( "cmd" ) || strieq ( getparam ( "cmd" ) , loc ( "Select" ) ) ) && ! isparam ( "newpwd" ) && atoi ( path + 4 ) > 0 ) { show_elog_list ( lbs , 0 , atoi ( path + 4 ) , 0 , FALSE , NULL ) ; return ; } if ( strncmp ( path , "page" , 4 ) == 0 && isparam ( "cmd" ) == 0 ) { if ( ! path [ 4 ] ) show_elog_list ( lbs , 0 , 0 , - 1 , FALSE , NULL ) ; else show_elog_list ( lbs , 0 , 0 , atoi ( path + 4 ) , FALSE , NULL ) ; return ; } if ( strieq ( dec_path , "cal.html" ) ) { show_calendar ( lbs ) ; return ; } if ( strieq ( dec_path , "elog.rdf" ) ) { show_rss_feed ( lbs ) ; return ; } if ( strieq ( dec_path , "upload.html" ) ) { show_uploader ( lbs ) ; return ; } if ( isparam ( "jcmd" ) && isparam ( "jcmd" ) && strieq ( getparam ( "jcmd" ) , "JUpload" ) ) { show_uploader_finished ( lbs ) ; return ; } pfile = dec_path ; if ( strchr ( pfile , '/' ) && pfile [ 13 ] != '/' && isdigit ( pfile [ 0 ] ) ) pfile = strchr ( pfile , '/' ) + 1 ; if ( ( strlen ( pfile ) > 13 && pfile [ 6 ] == '_' && pfile [ 13 ] == '_' ) || ( strlen ( pfile ) > 13 && pfile [ 6 ] == '_' && pfile [ 13 ] == '/' ) || chkext ( pfile , ".gif" ) || chkext ( pfile , ".ico" ) || chkext ( pfile , ".jpg" ) || chkext ( pfile , ".jpeg" ) || chkext ( pfile , ".png" ) || chkext ( pfile , ".css" ) || chkext ( pfile , ".js" ) || chkext ( pfile , ".html" ) ) { if ( ( strlen ( pfile ) > 13 && pfile [ 6 ] == '_' && pfile [ 13 ] == '_' ) || ( strlen ( pfile ) > 13 && pfile [ 6 ] == '_' && pfile [ 13 ] == '/' ) ) { if ( pfile [ 13 ] == '/' ) pfile [ 13 ] = '_' ; strlcpy ( file_name , lbs -> data_dir , sizeof ( file_name ) ) ; generate_subdir_name ( pfile , subdir , sizeof ( subdir ) ) ; strlcat ( file_name , subdir , sizeof ( file_name ) ) ; strlcat ( file_name , pfile , sizeof ( file_name ) ) ; } else { strlcpy ( file_name , resource_dir , sizeof ( file_name ) ) ; if ( file_name [ 0 ] && file_name [ strlen ( file_name ) - 1 ] != DIR_SEPARATOR ) strlcat ( file_name , DIR_SEPARATOR_STR , sizeof ( file_name ) ) ; strlcat ( file_name , "themes" , sizeof ( file_name ) ) ; strlcat ( file_name , DIR_SEPARATOR_STR , sizeof ( file_name ) ) ; if ( theme_name [ 0 ] ) { strlcat ( file_name , theme_name , sizeof ( file_name ) ) ; strlcat ( file_name , DIR_SEPARATOR_STR , sizeof ( file_name ) ) ; } strlcat ( file_name , pfile , sizeof ( file_name ) ) ; } if ( isparam ( "thumb" ) ) { get_thumb_name ( file_name , thumb_name , sizeof ( thumb_name ) , 0 ) ; if ( thumb_name [ 0 ] ) send_file_direct ( thumb_name ) ; else send_file_direct ( file_name ) ; } else send_file_direct ( file_name ) ; return ; } if ( ! logbook [ 0 ] ) { show_selection_page ( ) ; return ; } if ( strchr ( dec_path , '/' ) ) { message_id = atoi ( dec_path ) ; n = atoi ( strchr ( dec_path , '/' ) + 1 ) - 1 ; status = el_retrieve_attachment ( lbs , message_id , n , attachment ) ; if ( status != EL_SUCCESS || n >= MAX_ATTACHMENTS ) { sprintf ( str , "Attachment<S2SV_blank>#%d<S2SV_blank>of<S2SV_blank>entry<S2SV_blank>#%d<S2SV_blank>not<S2SV_blank>found" , n + 1 , message_id ) ; show_error ( str ) ; } else { if ( isparam ( "thumb" ) ) strlcat ( attachment , "?thumb=1" , sizeof ( attachment ) ) ; redirect ( lbs , attachment ) ; } return ; } if ( getcfg ( lbs -> name , "Types" , str , sizeof ( str ) ) ) { show_upgrade_page ( lbs ) ; return ; } if ( isparam ( "cmd_first.x" ) ) strcpy ( command , loc ( "First" ) ) ; if ( isparam ( "cmd_previous.x" ) ) strcpy ( command , loc ( "Previous" ) ) ; if ( isparam ( "cmd_next.x" ) ) strcpy ( command , loc ( "Next" ) ) ; if ( isparam ( "cmd_last.x" ) ) strcpy ( command , loc ( "Last" ) ) ; if ( command [ 0 ] && ! is_user_allowed ( lbs , command ) ) { if ( isparam ( "uname" ) ) get_full_name ( lbs , getparam ( "uname" ) , full_name ) ; else full_name [ 0 ] = 0 ; strencode2 ( str2 , command , sizeof ( str2 ) ) ; strencode2 ( str3 , full_name , sizeof ( str3 ) ) ; sprintf ( str , loc ( "Error:<S2SV_blank>Command<S2SV_blank>\\"<b>%s</b>\\"<S2SV_blank>is<S2SV_blank>not<S2SV_blank>allowed<S2SV_blank>for<S2SV_blank>user<S2SV_blank>\\"<b>%s</b>\\"" ) , str2 , str3 ) ; show_error ( str ) ; return ; } if ( ! is_command_allowed ( lbs , command , message_id ) ) { if ( strieq ( command , loc ( "New" ) ) && ! isparam ( "unm" ) ) { show_login_page ( lbs , _cmdline , 0 ) ; return ; } strencode2 ( str2 , command , sizeof ( str3 ) ) ; sprintf ( str , loc ( "Error:<S2SV_blank>Command<S2SV_blank>\\"<b>%s</b>\\"<S2SV_blank>not<S2SV_blank>allowed" ) , str2 ) ; show_error ( str ) ; return ; } if ( strieq ( command , loc ( "Help" ) ) ) { if ( getcfg ( lbs -> name , "Help<S2SV_blank>URL" , str , sizeof ( str ) ) ) { if ( strstr ( str , "http://" ) || strstr ( str , "https://" ) ) { redirect ( lbs , str ) ; return ; } strlcpy ( file_name , resource_dir , sizeof ( file_name ) ) ; strlcat ( file_name , "resources" , sizeof ( file_name ) ) ; strlcat ( file_name , DIR_SEPARATOR_STR , sizeof ( file_name ) ) ; strlcat ( file_name , str , sizeof ( file_name ) ) ; f = fopen ( file_name , "r" ) ; if ( f == NULL ) { sprintf ( str , "Cannot<S2SV_blank>find<S2SV_blank>file<S2SV_blank>\\"%s\\"" , file_name ) ; show_error ( str ) ; } else { fclose ( f ) ; send_file_direct ( file_name ) ; } return ; } strlcpy ( file_name , resource_dir , sizeof ( file_name ) ) ; strlcat ( file_name , "resources" , sizeof ( file_name ) ) ; strlcat ( file_name , DIR_SEPARATOR_STR , sizeof ( file_name ) ) ; strlcat ( file_name , "eloghelp_" , sizeof ( file_name ) ) ; if ( getcfg ( "global" , "Language" , str , sizeof ( str ) ) ) { for ( i = 0 ; i < ( int ) strlen ( str ) ; i ++ ) str [ i ] = my_tolower ( str [ i ] ) ; strlcat ( file_name , str , sizeof ( file_name ) ) ; } else strlcat ( file_name , "english" , sizeof ( file_name ) ) ; strlcat ( file_name , ".html" , sizeof ( file_name ) ) ; f = fopen ( file_name , "r" ) ; if ( f == NULL ) redirect ( lbs , "https://elog.psi.ch/elog/eloghelp_english.html" ) ; else { fclose ( f ) ; send_file_direct ( file_name ) ; } return ; } if ( strieq ( command , loc ( "HelpELCode" ) ) ) { strlcpy ( file_name , resource_dir , sizeof ( file_name ) ) ; strlcat ( file_name , "resources" , sizeof ( file_name ) ) ; strlcat ( file_name , DIR_SEPARATOR_STR , sizeof ( file_name ) ) ; strlcat ( file_name , "elcode_" , sizeof ( file_name ) ) ; if ( getcfg ( "global" , "Language" , str , sizeof ( str ) ) ) { for ( i = 0 ; i < ( int ) strlen ( str ) ; i ++ ) str [ i ] = my_tolower ( str [ i ] ) ; strlcat ( file_name , str , sizeof ( file_name ) ) ; } else strlcat ( file_name , "english" , sizeof ( file_name ) ) ; strlcat ( file_name , ".html" , sizeof ( file_name ) ) ; f = fopen ( file_name , "r" ) ; if ( f == NULL ) redirect ( lbs , "https://elog.psi.ch/elog/elcode_english.html" ) ; else { fclose ( f ) ; send_file_direct ( file_name ) ; } return ; } if ( strieq ( command , loc ( "New" ) ) ) { if ( check_drafts ( lbs ) ) return ; show_edit_form ( lbs , 0 , FALSE , FALSE , FALSE , FALSE , FALSE , FALSE ) ; return ; } for ( i = 0 ; i < MAX_ATTACHMENTS ; i ++ ) { sprintf ( str , "delatt%d" , i ) ; if ( isparam ( str ) || ( isparam ( "smcmd" ) && stricmp ( getparam ( "smcmd" ) , str ) == 0 ) ) { sprintf ( str , "attachment%d" , i ) ; strlcpy ( file_name , getparam ( str ) , sizeof ( file_name ) ) ; el_delete_attachment ( lbs , file_name ) ; for ( j = i ; j < MAX_ATTACHMENTS ; j ++ ) { sprintf ( str , "attachment%d" , j + 1 ) ; if ( isparam ( str ) ) strlcpy ( file_name , getparam ( str ) , sizeof ( file_name ) ) ; else file_name [ 0 ] = 0 ; sprintf ( str , "attachment%d" , j ) ; if ( file_name [ 0 ] ) setparam ( str , file_name ) ; else unsetparam ( str ) ; } show_edit_form ( lbs , isparam ( "edit_id" ) ? atoi ( getparam ( "edit_id" ) ) : 0 , FALSE , TRUE , TRUE , FALSE , FALSE , FALSE ) ; return ; } } if ( strieq ( command , loc ( "Upload" ) ) || strieq ( command , "Upload" ) ) { show_edit_form ( lbs , isparam ( "edit_id" ) ? atoi ( getparam ( "edit_id" ) ) : 0 , FALSE , TRUE , TRUE , FALSE , FALSE , FALSE ) ; return ; } if ( strieq ( command , loc ( "Edit" ) ) ) { if ( message_id ) { show_edit_form ( lbs , message_id , FALSE , TRUE , FALSE , FALSE , FALSE , FALSE ) ; return ; } else if ( isparam ( "nsel" ) ) { show_edit_form ( lbs , 0 , FALSE , TRUE , FALSE , FALSE , FALSE , FALSE ) ; return ; } } if ( strieq ( command , loc ( "Reply" ) ) ) { show_edit_form ( lbs , message_id , TRUE , FALSE , FALSE , FALSE , FALSE , FALSE ) ; return ; } if ( strieq ( command , loc ( "Update" ) ) ) { show_edit_form ( lbs , isparam ( "edit_id" ) ? atoi ( getparam ( "edit_id" ) ) : 0 , FALSE , TRUE , FALSE , TRUE , FALSE , FALSE ) ; return ; } if ( ( strieq ( command , loc ( "Save" ) ) || strieq ( command , "Save" ) ) && ! isparam ( "cfgpage" ) && ! isparam ( "new_user_name" ) ) { if ( isparam ( "unm" ) ) strlcpy ( str , getparam ( "unm" ) , sizeof ( str ) ) ; else strlcpy ( str , loc ( "user" ) , sizeof ( str ) ) ; setparam ( "draft" , str ) ; submit_elog ( lbs ) ; return ; } if ( strieq ( command , loc ( "Duplicate" ) ) ) { if ( message_id ) { show_edit_form ( lbs , message_id , FALSE , FALSE , FALSE , FALSE , TRUE , FALSE ) ; return ; } } if ( strieq ( command , loc ( "Preview" ) ) ) { show_edit_form ( lbs , isparam ( "edit_id" ) ? atoi ( getparam ( "edit_id" ) ) : 0 , FALSE , TRUE , FALSE , TRUE , FALSE , TRUE ) ; return ; } if ( strieq ( command , loc ( "Submit" ) ) || strieq ( command , "Submit" ) ) { if ( isparam ( "mirror_id" ) ) submit_elog_mirror ( lbs ) ; else submit_elog ( lbs ) ; if ( isparam ( "sidclose" ) ) sid_remove ( getparam ( "sid" ) ) ; return ; } if ( strieq ( command , loc ( "Find" ) ) ) { if ( dec_path [ 0 ] ) { sprintf ( str , "../%s/?cmd=%s" , lbs -> name_enc , loc ( "Find" ) ) ; redirect ( lbs , str ) ; return ; } show_find_form ( lbs ) ; return ; } if ( strieq ( command , loc ( "Search" ) ) ) { if ( dec_path [ 0 ] && atoi ( dec_path ) == 0 && strchr ( dec_path , '/' ) != NULL ) { strencode2 ( str2 , dec_path , sizeof ( str2 ) ) ; sprintf ( str , "%s:<S2SV_blank><b>%s</b>" , loc ( "Invalid<S2SV_blank>URL" ) , str2 ) ; show_error ( str ) ; return ; } show_elog_list ( lbs , 0 , 0 , 0 , TRUE , NULL ) ; return ; } if ( strieq ( command , loc ( "Last<S2SV_blank>day" ) ) ) { redirect ( lbs , "past1" ) ; return ; } if ( strieq ( command , loc ( "Last<S2SV_blank>10" ) ) ) { redirect ( lbs , "last10" ) ; return ; } if ( strieq ( command , loc ( "Copy<S2SV_blank>to" ) ) ) { copy_to ( lbs , message_id , isparam ( "destc" ) ? getparam ( "destc" ) : "" , 0 , 0 ) ; return ; } if ( strieq ( command , loc ( "Move<S2SV_blank>to" ) ) ) { copy_to ( lbs , message_id , isparam ( "destm" ) ? getparam ( "destm" ) : "" , 1 , 0 ) ; return ; } if ( strieq ( command , loc ( "Admin" ) ) || strieq ( command , loc ( "Change<S2SV_blank>config<S2SV_blank>file" ) ) ) { show_admin_page ( lbs , NULL ) ; return ; } sprintf ( str , loc ( "Change<S2SV_blank>%s" ) , "[global]" ) ; if ( strieq ( command , str ) ) { show_admin_page ( lbs , "global" ) ; return ; } sprintf ( str2 , "[global<S2SV_blank>%s]" , lbs -> top_group ) ; sprintf ( str , loc ( "Change<S2SV_blank>%s" ) , str2 ) ; if ( strieq ( command , str ) ) { show_admin_page ( lbs , lbs -> top_group ) ; return ; } if ( strieq ( command , loc ( "Delete<S2SV_blank>this<S2SV_blank>logbook" ) ) ) { show_logbook_delete ( lbs ) ; return ; } if ( strieq ( command , loc ( "Rename<S2SV_blank>this<S2SV_blank>logbook" ) ) ) { show_logbook_rename ( lbs ) ; return ; } if ( strieq ( command , loc ( "Create<S2SV_blank>new<S2SV_blank>logbook" ) ) ) { if ( isparam ( "tmp" ) && strieq ( getparam ( "tmp" ) , "Cancel" ) ) { if ( getcfg ( lbs -> name , "Password<S2SV_blank>file" , str , sizeof ( str ) ) ) sprintf ( str , "?cmd=%s" , loc ( "Change<S2SV_blank>config<S2SV_blank>file" ) ) ; else sprintf ( str , "?cmd=%s" , loc ( "Config" ) ) ; redirect ( lbs , str ) ; return ; } show_logbook_new ( lbs ) ; return ; } if ( strieq ( command , "GetPwdFile" ) ) { char allow [ 256 ] ; allow [ 0 ] = 0 ; getcfg ( "global" , "Allow<S2SV_blank>clone" , allow , sizeof ( allow ) ) ; if ( atoi ( allow ) == 1 ) { if ( get_password_file ( lbs , file_name , sizeof ( file_name ) ) ) send_file_direct ( file_name ) ; } else { show_http_header ( NULL , FALSE , NULL ) ; rsputs ( loc ( "Cloning<S2SV_blank>not<S2SV_blank>allowed.<S2SV_blank>Set<S2SV_blank>\\"Allow<S2SV_blank>clone<S2SV_blank>=<S2SV_blank>1\\"<S2SV_blank>to<S2SV_blank>enable<S2SV_blank>cloning." ) ) ; rsputs ( "\\r\\n" ) ; return ; } return ; } if ( strieq ( command , loc ( "Change<S2SV_blank>password" ) ) || ( isparam ( "newpwd" ) && ! strieq ( command , loc ( "Cancel" ) ) && ! strieq ( command , loc ( "Save" ) ) ) ) { show_change_pwd_page ( lbs ) ; return ; } if ( strieq ( command , loc ( "Save" ) ) && ( isparam ( "cfgpage" ) || isparam ( "new_user_name" ) ) ) { if ( isparam ( "config" ) && isparam ( "new_user_name" ) ) { if ( ! strieq ( getparam ( "config" ) , getparam ( "new_user_name" ) ) ) { if ( get_user_line ( lbs , getparam ( "new_user_name" ) , NULL , NULL , NULL , NULL , NULL , NULL ) == 1 ) { sprintf ( str , "%s<S2SV_blank>\\"%s\\"<S2SV_blank>%s" , loc ( "Login<S2SV_blank>name" ) , getparam ( "new_user_name" ) , loc ( "exists<S2SV_blank>already" ) ) ; show_error ( str ) ; return ; } } if ( ! save_user_config ( lbs , isparam ( "config" ) ? getparam ( "config" ) : "" , FALSE ) ) return ; redirect ( lbs , "" ) ; return ; } else if ( isparam ( "new_user_name" ) ) { if ( ! save_user_config ( lbs , getparam ( "new_user_name" ) , TRUE ) ) return ; } else { if ( isparam ( "global" ) ) { if ( strieq ( getparam ( "global" ) , "global" ) ) strcpy ( section , "global" ) ; else { sprintf ( section , "global<S2SV_blank>" ) ; strlcat ( section , getparam ( "global" ) , sizeof ( section ) ) ; } } else strlcpy ( section , lbs -> name , sizeof ( section ) ) ; if ( ! save_admin_config ( section , _mtext , str ) ) { show_error ( str ) ; return ; } } if ( lbs ) sprintf ( str , "../%s/" , lbs -> name_enc ) ; else sprintf ( str , "." ) ; if ( isparam ( "new_user_name" ) ) { sprintf ( str + strlen ( str ) , "?cmd=%s&cfg_user=" , loc ( "Config" ) ) ; strlcat ( str , getparam ( "new_user_name" ) , sizeof ( str ) ) ; } else if ( isparam ( "cfg_user" ) ) { sprintf ( str + strlen ( str ) , "?cmd=%s&cfg_user=" , loc ( "Config" ) ) ; strlcat ( str , getparam ( "cfg_user" ) , sizeof ( str ) ) ; } else if ( getcfg ( lbs -> name , "password<S2SV_blank>file" , str2 , sizeof ( str2 ) ) ) sprintf ( str + strlen ( str ) , "?cmd=%s" , loc ( "Config" ) ) ; redirect ( lbs , str ) ; return ; } if ( strieq ( command , loc ( "Activate" ) ) && isparam ( "new_user_name" ) && isparam ( "code" ) ) { if ( ! activate_user ( lbs , getparam ( "new_user_name" ) , atoi ( getparam ( "code" ) ) ) ) return ; setparam ( "cfg_user" , getparam ( "new_user_name" ) ) ; get_user_line ( lbs , getparam ( "new_user_name" ) , NULL , full_name , user_email , NULL , NULL , NULL ) ; sprintf ( str , "%s<S2SV_blank><b><%s></b>" , full_name , user_email ) ; sprintf ( str2 , loc ( "Activation<S2SV_blank>notice<S2SV_blank>has<S2SV_blank>been<S2SV_blank>sent<S2SV_blank>to<S2SV_blank>%s" ) , str ) ; setparam ( "notice" , str2 ) ; show_config_page ( lbs ) ; return ; } if ( strieq ( command , loc ( "Remove<S2SV_blank>user" ) ) && isparam ( "config" ) ) { if ( ! remove_user ( lbs , getparam ( "config" ) ) ) return ; if ( isparam ( "unm" ) && strieq ( getparam ( "config" ) , getparam ( "unm" ) ) ) { write_logfile ( lbs , "LOGOUT" ) ; sid_remove ( getparam ( "sid" ) ) ; set_sid_cookie ( lbs , "" , "" ) ; } unsetparam ( "cfg_user" ) ; show_config_page ( lbs ) ; return ; } if ( strieq ( command , loc ( "New<S2SV_blank>user" ) ) ) { show_new_user_page ( lbs , NULL ) ; return ; } if ( strieq ( command , loc ( "Forgot" ) ) ) { show_forgot_pwd_page ( lbs ) ; return ; } if ( strieq ( command , loc ( "Config" ) ) ) { if ( ! getcfg ( lbs -> name , "Password<S2SV_blank>file" , str , sizeof ( str ) ) ) show_admin_page ( lbs , NULL ) ; else show_config_page ( lbs ) ; return ; } if ( strieq ( command , loc ( "Download" ) ) || strieq ( command , "Download" ) ) { show_download_page ( lbs , dec_path ) ; return ; } if ( strieq ( command , loc ( "Import" ) ) ) { strcpy ( str , loc ( "CSV<S2SV_blank>Import" ) ) ; url_encode ( str , sizeof ( str ) ) ; sprintf ( str1 , "?cmd=%s" , str ) ; strcpy ( str , loc ( "XML<S2SV_blank>Import" ) ) ; url_encode ( str , sizeof ( str ) ) ; sprintf ( str2 , "?cmd=%s" , str ) ; show_query ( lbs , loc ( "ELOG<S2SV_blank>import" ) , loc ( "Please<S2SV_blank>choose<S2SV_blank>format<S2SV_blank>to<S2SV_blank>import:" ) , "CSV" , str1 , "XML" , str2 ) ; return ; } if ( strieq ( command , loc ( "CSV<S2SV_blank>Import" ) ) ) { show_import_page_csv ( lbs ) ; return ; } if ( strieq ( command , loc ( "XML<S2SV_blank>Import" ) ) ) { show_import_page_xml ( lbs ) ; return ; } if ( strieq ( command , "getmd5" ) ) { show_md5_page ( lbs ) ; return ; } if ( strieq ( command , loc ( "Synchronize" ) ) ) { synchronize ( lbs , SYNC_HTML ) ; return ; } if ( strieq ( command , loc ( "Logout" ) ) ) { write_logfile ( lbs , "LOGOUT" ) ; if ( getcfg ( lbs -> name , "Logout<S2SV_blank>to<S2SV_blank>main" , str , sizeof ( str ) ) && atoi ( str ) == 1 ) { sprintf ( str , "../" ) ; setparam ( "redir" , str ) ; } else { if ( getcfg ( lbs -> name , "Logout<S2SV_blank>to<S2SV_blank>URL" , str , sizeof ( str ) ) ) setparam ( "redir" , str ) ; } set_sid_cookie ( lbs , "" , "" ) ; sid_remove ( getparam ( "sid" ) ) ; return ; } if ( strieq ( command , loc ( "Delete" ) ) ) { show_elog_delete ( lbs , message_id ) ; return ; } if ( strieq ( command , "IM" ) ) { call_image_magick ( lbs ) ; return ; } if ( ! _cmdline [ 0 ] && getcfg ( lbs -> name , "Welcome<S2SV_blank>page" , str , sizeof ( str ) ) && str [ 0 ] ) { if ( str [ 0 ] == DIR_SEPARATOR || str [ 1 ] == ':' ) strcpy ( file_name , str ) ; else { strlcpy ( file_name , resource_dir , sizeof ( file_name ) ) ; strlcat ( file_name , str , sizeof ( file_name ) ) ; } send_file_direct ( file_name ) ; return ; } if ( ! _cmdline [ 0 ] && getcfg ( lbs -> name , "Start<S2SV_blank>page" , str , sizeof ( str ) ) && str [ 0 ] ) { redirect ( lbs , str ) ; return ; } if ( dec_path [ 0 ] == 0 ) show_elog_list ( lbs , 0 , 0 , 0 , TRUE , NULL ) ; else show_elog_entry ( lbs , dec_path , command ) ; return ; }
| <S2SV_ModStart> "value" ) ) { strencode2 ( str , getparam ( "value" ) , sizeof ( str ) ) ; <S2SV_ModStart> ( loc ( str ) ) ; } <S2SV_ModEnd> s = loc
| ritt@elog/eefdabb714f26192f585083ef96c8413e459a1d1 | CVE-2019-20375 | https://bitbucket.org/ritt/elog/commit/eefdabb714f26192f585083ef96c8413e459a1d1 | 2020-01-10T05:15Z |
62 | CWE-119 | CWE-119 static int header_gets ( SF_PRIVATE * psf , char * ptr , int bufsize ) { int k ; <S2SV_StartBug> for ( k = 0 ; k < bufsize - 1 ; k ++ ) <S2SV_EndBug> <S2SV_StartBug> { if ( psf -> headindex < psf -> headend ) <S2SV_EndBug> { ptr [ k ] = psf -> header [ psf -> headindex ] ; psf -> headindex ++ ; } else <S2SV_StartBug> { psf -> headend += psf_fread ( psf -> header + psf -> headend , 1 , 1 , psf ) ; <S2SV_EndBug> <S2SV_StartBug> ptr [ k ] = psf -> header [ psf -> headindex ] ; <S2SV_EndBug> psf -> headindex = psf -> headend ; } ; if ( ptr [ k ] == '\\n' ) break ; } ; ptr [ k ] = 0 ; return k ; }
| <S2SV_ModStart> int k ; if ( psf -> header . indx + bufsize >= psf -> header . len && psf_bump_header_allocation ( psf , bufsize ) ) return 0 ; <S2SV_ModStart> ( psf -> header . indx <S2SV_ModEnd> < psf -> <S2SV_ModStart> < psf -> header . end ) { ptr [ k ] = psf -> header . ptr [ psf -> header . indx ] ; psf -> header . indx <S2SV_ModEnd> ++ ; } <S2SV_ModStart> { psf -> header . end <S2SV_ModEnd> += psf_fread ( <S2SV_ModStart> psf -> header . ptr <S2SV_ModStart> + psf -> header . end <S2SV_ModEnd> , 1 , <S2SV_ModStart> psf -> header . ptr [ psf -> header . indx ] ; psf -> header . indx = psf -> header . end <S2SV_ModEnd> ; } ;
| erikd@libsndfile/708e996c87c5fae77b104ccfeb8f6db784c32074 | CVE-2017-7586 | https://github.com/erikd/libsndfile/commit/708e996c87c5fae77b104ccfeb8f6db784c32074 | 2017-04-07T20:59Z |
63 | CWE-78 | CWE-78 static int compile_search ( struct Context * ctx , const struct Pattern * pat , struct Buffer * buf ) { if ( do_search ( pat , 0 ) == 0 ) return 0 ; if ( pat -> not ) mutt_buffer_addstr ( buf , "NOT<S2SV_blank>" ) ; if ( pat -> child ) { int clauses ; clauses = do_search ( pat -> child , 1 ) ; if ( clauses > 0 ) { const struct Pattern * clause = pat -> child ; mutt_buffer_addch ( buf , '(' ) ; while ( clauses ) { if ( do_search ( clause , 0 ) ) { if ( pat -> op == MUTT_OR && clauses > 1 ) mutt_buffer_addstr ( buf , "OR<S2SV_blank>" ) ; clauses -- ; if ( compile_search ( ctx , clause , buf ) < 0 ) return - 1 ; if ( clauses ) mutt_buffer_addch ( buf , '<S2SV_blank>' ) ; } clause = clause -> next ; } mutt_buffer_addch ( buf , ')' ) ; } } else { char term [ STRING ] ; char * delim = NULL ; switch ( pat -> op ) { case MUTT_HEADER : mutt_buffer_addstr ( buf , "HEADER<S2SV_blank>" ) ; delim = strchr ( pat -> p . str , ':' ) ; if ( ! delim ) { mutt_error ( _ ( "Header<S2SV_blank>search<S2SV_blank>without<S2SV_blank>header<S2SV_blank>name:<S2SV_blank>%s" ) , pat -> p . str ) ; return - 1 ; } * delim = '\\0' ; <S2SV_StartBug> imap_quote_string ( term , sizeof ( term ) , pat -> p . str ) ; <S2SV_EndBug> mutt_buffer_addstr ( buf , term ) ; mutt_buffer_addch ( buf , '<S2SV_blank>' ) ; * delim = ':' ; delim ++ ; SKIPWS ( delim ) ; <S2SV_StartBug> imap_quote_string ( term , sizeof ( term ) , delim ) ; <S2SV_EndBug> mutt_buffer_addstr ( buf , term ) ; break ; case MUTT_BODY : mutt_buffer_addstr ( buf , "BODY<S2SV_blank>" ) ; <S2SV_StartBug> imap_quote_string ( term , sizeof ( term ) , pat -> p . str ) ; <S2SV_EndBug> mutt_buffer_addstr ( buf , term ) ; break ; case MUTT_WHOLE_MSG : mutt_buffer_addstr ( buf , "TEXT<S2SV_blank>" ) ; <S2SV_StartBug> imap_quote_string ( term , sizeof ( term ) , pat -> p . str ) ; <S2SV_EndBug> mutt_buffer_addstr ( buf , term ) ; break ; case MUTT_SERVERSEARCH : { struct ImapData * idata = ctx -> data ; if ( ! mutt_bit_isset ( idata -> capabilities , X_GM_EXT1 ) ) { mutt_error ( _ ( "Server-side<S2SV_blank>custom<S2SV_blank>search<S2SV_blank>not<S2SV_blank>supported:<S2SV_blank>%s" ) , pat -> p . str ) ; return - 1 ; } } mutt_buffer_addstr ( buf , "X-GM-RAW<S2SV_blank>" ) ; <S2SV_StartBug> imap_quote_string ( term , sizeof ( term ) , pat -> p . str ) ; <S2SV_EndBug> mutt_buffer_addstr ( buf , term ) ; break ; } } return 0 ; }
| <S2SV_ModStart> p . str , false <S2SV_ModStart> ) , delim , false <S2SV_ModStart> p . str , false <S2SV_ModStart> p . str , false <S2SV_ModStart> p . str , false
| neomutt@neomutt/e52393740334443ae0206cab2d7caef381646725 | CVE-2018-14357 | https://github.com/neomutt/neomutt/commit/e52393740334443ae0206cab2d7caef381646725 | 2018-07-17T17:29Z |
64 | CWE-190 | CWE-190 <S2SV_StartBug> int jas_matrix_resize ( jas_matrix_t * matrix , int numrows , int numcols ) <S2SV_EndBug> { <S2SV_StartBug> int size ; <S2SV_EndBug> int i ; size = numrows * numcols ; if ( size > matrix -> datasize_ || numrows > matrix -> maxrows_ ) { return - 1 ; } matrix -> numrows_ = numrows ; matrix -> numcols_ = numcols ; for ( i = 0 ; i < numrows ; ++ i ) { matrix -> rows_ [ i ] = & matrix -> data_ [ numcols * i ] ; } return 0 ; }
| <S2SV_ModStart> * matrix , jas_matind_t numrows , jas_matind_t <S2SV_ModEnd> numcols ) { <S2SV_ModStart> numcols ) { jas_matind_t size ; jas_matind_t <S2SV_ModEnd> i ; size
| mdadams@jasper/d42b2388f7f8e0332c846675133acea151fc557a | CVE-2016-9557 | https://github.com/mdadams/jasper/commit/d42b2388f7f8e0332c846675133acea151fc557a | 2017-03-23T18:59Z |
65 | CWE-20 | CWE-20 int res_inverse ( vorbis_dsp_state * vd , vorbis_info_residue * info , ogg_int32_t * * in , int * nonzero , int ch ) { int i , j , k , s , used = 0 ; codec_setup_info * ci = ( codec_setup_info * ) vd -> vi -> codec_setup ; codebook * phrasebook = ci -> book_param + info -> groupbook ; int samples_per_partition = info -> grouping ; int partitions_per_word = phrasebook -> dim ; int pcmend = ci -> blocksizes [ vd -> W ] ; if ( info -> type < 2 ) { int max = pcmend >> 1 ; int end = ( info -> end < max ? info -> end : max ) ; int n = end - info -> begin ; if ( n > 0 ) { int partvals = n / samples_per_partition ; int partwords = ( partvals + partitions_per_word - 1 ) / partitions_per_word ; for ( i = 0 ; i < ch ; i ++ ) if ( nonzero [ i ] ) in [ used ++ ] = in [ i ] ; ch = used ; if ( used ) { char * * partword = ( char * * ) alloca ( ch * sizeof ( * partword ) ) ; for ( j = 0 ; j < ch ; j ++ ) partword [ j ] = ( char * ) alloca ( partwords * partitions_per_word * sizeof ( * partword [ j ] ) ) ; for ( s = 0 ; s < info -> stages ; s ++ ) { for ( i = 0 ; i < partvals ; ) { if ( s == 0 ) { partword [ 0 ] [ i + partitions_per_word - 1 ] = 1 ; for ( k = partitions_per_word - 2 ; k >= 0 ; k -- ) partword [ 0 ] [ i + k ] = partword [ 0 ] [ i + k + 1 ] * info -> partitions ; for ( j = 1 ; j < ch ; j ++ ) for ( k = partitions_per_word - 1 ; k >= 0 ; k -- ) partword [ j ] [ i + k ] = partword [ j - 1 ] [ i + k ] ; for ( j = 0 ; j < ch ; j ++ ) { int temp = vorbis_book_decode ( phrasebook , & vd -> opb ) ; if ( temp == - 1 ) goto eopbreak ; for ( k = 0 ; k < partitions_per_word ; k ++ ) { ogg_uint32_t div = partword [ j ] [ i + k ] ; partword [ j ] [ i + k ] = temp / div ; temp -= partword [ j ] [ i + k ] * div ; } } } for ( k = 0 ; k < partitions_per_word && i < partvals ; k ++ , i ++ ) for ( j = 0 ; j < ch ; j ++ ) { long offset = info -> begin + i * samples_per_partition ; <S2SV_StartBug> if ( info -> stagemasks [ ( int ) partword [ j ] [ i ] ] & ( 1 << s ) ) { <S2SV_EndBug> codebook * stagebook = ci -> book_param + info -> stagebooks [ ( partword [ j ] [ i ] << 3 ) + s ] ; if ( info -> type ) { if ( vorbis_book_decodev_add ( stagebook , in [ j ] + offset , & vd -> opb , samples_per_partition , - 8 ) == - 1 ) goto eopbreak ; } else { if ( vorbis_book_decodevs_add ( stagebook , in [ j ] + offset , & vd -> opb , samples_per_partition , - 8 ) == - 1 ) goto eopbreak ; } } } } } } } } else { int max = ( pcmend * ch ) >> 1 ; int end = ( info -> end < max ? info -> end : max ) ; int n = end - info -> begin ; if ( n > 0 ) { int partvals = n / samples_per_partition ; int partwords = ( partvals + partitions_per_word - 1 ) / partitions_per_word ; char * partword = ( char * ) alloca ( partwords * partitions_per_word * sizeof ( * partword ) ) ; int beginoff = info -> begin / ch ; for ( i = 0 ; i < ch ; i ++ ) if ( nonzero [ i ] ) break ; if ( i == ch ) return ( 0 ) ; samples_per_partition /= ch ; for ( s = 0 ; s < info -> stages ; s ++ ) { for ( i = 0 ; i < partvals ; ) { if ( s == 0 ) { int temp ; partword [ i + partitions_per_word - 1 ] = 1 ; for ( k = partitions_per_word - 2 ; k >= 0 ; k -- ) partword [ i + k ] = partword [ i + k + 1 ] * info -> partitions ; temp = vorbis_book_decode ( phrasebook , & vd -> opb ) ; if ( temp == - 1 ) goto eopbreak ; for ( k = 0 ; k < partitions_per_word ; k ++ ) { ogg_uint32_t div = partword [ i + k ] ; partword [ i + k ] = temp / div ; temp -= partword [ i + k ] * div ; } } for ( k = 0 ; k < partitions_per_word && i < partvals ; k ++ , i ++ ) if ( info -> stagemasks [ ( int ) partword [ i ] ] & ( 1 << s ) ) { codebook * stagebook = ci -> book_param + info -> stagebooks [ ( partword [ i ] << 3 ) + s ] ; if ( vorbis_book_decodevv_add ( stagebook , in , i * samples_per_partition + beginoff , ch , & vd -> opb , samples_per_partition , - 8 ) == - 1 ) goto eopbreak ; } } } } } eopbreak : return 0 ; }
| <S2SV_ModStart> * samples_per_partition ; int idx = ( int ) partword [ j ] [ i ] ; if ( idx < info -> partitions && <S2SV_ModEnd> info -> stagemasks <S2SV_ModStart> -> stagemasks [ idx <S2SV_ModEnd> ] & (
| external@tremolo/659030a2e80c38fb8da0a4eb68695349eec6778b | CVE-2016-3756 | https://android.googlesource.com/platform/external/tremolo/+/659030a2e80c38fb8da0a4eb68695349eec6778b | 2016-07-11T01:59Z |
66 | CWE-552 | CWE-552 ssize_t oe_recvfrom ( int sockfd , void * buf , size_t len , int flags , <S2SV_StartBug> const struct oe_sockaddr * src_addr , <S2SV_EndBug> oe_socklen_t * addrlen ) { ssize_t ret = - 1 ; oe_fd_t * sock ; if ( ! ( sock = oe_fdtable_get ( sockfd , OE_FD_TYPE_SOCKET ) ) ) OE_RAISE_ERRNO ( oe_errno ) ; ret = sock -> ops . socket . recvfrom ( sock , buf , len , flags , src_addr , addrlen ) ; done : return ret ; }
| <S2SV_ModStart> int flags , <S2SV_ModEnd> struct oe_sockaddr *
| openenclave@openenclave/bcac8e7acb514429fee9e0b5d0c7a0308fd4d76b | CVE-2020-15224 | https://github.com/openenclave/openenclave/commit/bcac8e7acb514429fee9e0b5d0c7a0308fd4d76b | 2020-10-14T19:15Z |
67 | CWE-399 | CWE-399 static int dcbnl_cee_fill ( struct sk_buff * skb , struct net_device * netdev ) { struct nlattr * cee , * app ; struct dcb_app_type * itr ; const struct dcbnl_rtnl_ops * ops = netdev -> dcbnl_ops ; int dcbx , i , err = - EMSGSIZE ; u8 value ; if ( nla_put_string ( skb , DCB_ATTR_IFNAME , netdev -> name ) ) goto nla_put_failure ; cee = nla_nest_start ( skb , DCB_ATTR_CEE ) ; if ( ! cee ) goto nla_put_failure ; if ( ops -> getpgtccfgtx && ops -> getpgbwgcfgtx ) { err = dcbnl_cee_pg_fill ( skb , netdev , 1 ) ; if ( err ) goto nla_put_failure ; } if ( ops -> getpgtccfgrx && ops -> getpgbwgcfgrx ) { err = dcbnl_cee_pg_fill ( skb , netdev , 0 ) ; if ( err ) goto nla_put_failure ; } if ( ops -> getpfccfg ) { struct nlattr * pfc_nest = nla_nest_start ( skb , DCB_ATTR_CEE_PFC ) ; if ( ! pfc_nest ) goto nla_put_failure ; for ( i = DCB_PFC_UP_ATTR_0 ; i <= DCB_PFC_UP_ATTR_7 ; i ++ ) { ops -> getpfccfg ( netdev , i - DCB_PFC_UP_ATTR_0 , & value ) ; if ( nla_put_u8 ( skb , i , value ) ) goto nla_put_failure ; } nla_nest_end ( skb , pfc_nest ) ; } spin_lock ( & dcb_lock ) ; app = nla_nest_start ( skb , DCB_ATTR_CEE_APP_TABLE ) ; if ( ! app ) goto dcb_unlock ; list_for_each_entry ( itr , & dcb_app_list , list ) { if ( itr -> ifindex == netdev -> ifindex ) { struct nlattr * app_nest = nla_nest_start ( skb , DCB_ATTR_APP ) ; if ( ! app_nest ) goto dcb_unlock ; err = nla_put_u8 ( skb , DCB_APP_ATTR_IDTYPE , itr -> app . selector ) ; if ( err ) goto dcb_unlock ; err = nla_put_u16 ( skb , DCB_APP_ATTR_ID , itr -> app . protocol ) ; if ( err ) goto dcb_unlock ; err = nla_put_u8 ( skb , DCB_APP_ATTR_PRIORITY , itr -> app . priority ) ; if ( err ) goto dcb_unlock ; nla_nest_end ( skb , app_nest ) ; } } nla_nest_end ( skb , app ) ; if ( netdev -> dcbnl_ops -> getdcbx ) dcbx = netdev -> dcbnl_ops -> getdcbx ( netdev ) ; else dcbx = - EOPNOTSUPP ; spin_unlock ( & dcb_lock ) ; if ( ops -> getfeatcfg ) { struct nlattr * feat = nla_nest_start ( skb , DCB_ATTR_CEE_FEAT ) ; if ( ! feat ) goto nla_put_failure ; for ( i = DCB_FEATCFG_ATTR_ALL + 1 ; i <= DCB_FEATCFG_ATTR_MAX ; i ++ ) if ( ! ops -> getfeatcfg ( netdev , i , & value ) && nla_put_u8 ( skb , i , value ) ) goto nla_put_failure ; nla_nest_end ( skb , feat ) ; } if ( ops -> cee_peer_getpg ) { struct cee_pg pg ; <S2SV_StartBug> err = ops -> cee_peer_getpg ( netdev , & pg ) ; <S2SV_EndBug> if ( ! err && nla_put ( skb , DCB_ATTR_CEE_PEER_PG , sizeof ( pg ) , & pg ) ) goto nla_put_failure ; } if ( ops -> cee_peer_getpfc ) { <S2SV_StartBug> struct cee_pfc pfc ; <S2SV_EndBug> err = ops -> cee_peer_getpfc ( netdev , & pfc ) ; if ( ! err && nla_put ( skb , DCB_ATTR_CEE_PEER_PFC , sizeof ( pfc ) , & pfc ) ) goto nla_put_failure ; } if ( ops -> peer_getappinfo && ops -> peer_getapptable ) { err = dcbnl_build_peer_app ( netdev , skb , DCB_ATTR_CEE_PEER_APP_TABLE , DCB_ATTR_CEE_PEER_APP_INFO , DCB_ATTR_CEE_PEER_APP ) ; if ( err ) goto nla_put_failure ; } nla_nest_end ( skb , cee ) ; if ( dcbx >= 0 ) { err = nla_put_u8 ( skb , DCB_ATTR_DCBX , dcbx ) ; if ( err ) goto nla_put_failure ; } return 0 ; dcb_unlock : spin_unlock ( & dcb_lock ) ; nla_put_failure : return err ; }
| <S2SV_ModStart> cee_pg pg ; memset ( & pg , 0 , sizeof ( pg ) ) ; <S2SV_ModStart> struct cee_pfc pfc ; memset ( & pfc , 0 , sizeof ( pfc ) )
| torvalds@linux/29cd8ae0e1a39e239a3a7b67da1986add1199fc0 | CVE-2013-2634 | https://github.com/torvalds/linux/commit/29cd8ae0e1a39e239a3a7b67da1986add1199fc0 | 2013-03-22T11:59Z |
68 | CWE-119 | CWE-119 static int complete_emulated_mmio ( struct kvm_vcpu * vcpu ) { struct kvm_run * run = vcpu -> run ; struct kvm_mmio_fragment * frag ; unsigned len ; BUG_ON ( ! vcpu -> mmio_needed ) ; frag = & vcpu -> mmio_fragments [ vcpu -> mmio_cur_fragment ] ; len = min ( 8u , frag -> len ) ; if ( ! vcpu -> mmio_is_write ) memcpy ( frag -> data , run -> mmio . data , len ) ; if ( frag -> len <= 8 ) { frag ++ ; vcpu -> mmio_cur_fragment ++ ; } else { frag -> data += len ; frag -> gpa += len ; frag -> len -= len ; } <S2SV_StartBug> if ( vcpu -> mmio_cur_fragment == vcpu -> mmio_nr_fragments ) { <S2SV_EndBug> vcpu -> mmio_needed = 0 ; if ( vcpu -> mmio_is_write ) return 1 ; vcpu -> mmio_read_completed = 1 ; return complete_emulated_io ( vcpu ) ; } run -> exit_reason = KVM_EXIT_MMIO ; run -> mmio . phys_addr = frag -> gpa ; if ( vcpu -> mmio_is_write ) memcpy ( run -> mmio . data , frag -> data , min ( 8u , frag -> len ) ) ; run -> mmio . len = min ( 8u , frag -> len ) ; run -> mmio . is_write = vcpu -> mmio_is_write ; vcpu -> arch . complete_userspace_io = complete_emulated_mmio ; return 0 ; }
| <S2SV_ModStart> vcpu -> mmio_cur_fragment >= <S2SV_ModEnd> vcpu -> mmio_nr_fragments
| torvalds@linux/a08d3b3b99efd509133946056531cdf8f3a0c09b | CVE-2014-0049 | https://github.com/torvalds/linux/commit/a08d3b3b99efd509133946056531cdf8f3a0c09b | 2014-03-11T13:01Z |
69 | CWE-674 | CWE-674 static krb5_error_code split_der ( asn1buf * buf , uint8_t * const * der , size_t len , taginfo * tag_out ) { krb5_error_code ret ; const uint8_t * contents , * remainder ; size_t clen , rlen ; <S2SV_StartBug> ret = get_tag ( * der , len , tag_out , & contents , & clen , & remainder , & rlen ) ; <S2SV_EndBug> if ( ret ) return ret ; if ( rlen != 0 ) return ASN1_BAD_LENGTH ; insert_bytes ( buf , contents , clen ) ; return 0 ; }
| <S2SV_ModStart> , & rlen , 0
| krb5@krb5/57415dda6cf04e73ffc3723be518eddfae599bfd | CVE-2020-28196 | https://github.com/krb5/krb5/commit/57415dda6cf04e73ffc3723be518eddfae599bfd | 2020-11-06T08:15Z |
70 | CWE-20 | CWE-20 static int fsck_gitmodules_fn ( const char * var , const char * value , void * vdata ) { struct fsck_gitmodules_data * data = vdata ; const char * subsection , * key ; int subsection_len ; char * name ; if ( parse_config_key ( var , "submodule" , & subsection , & subsection_len , & key ) < 0 || ! subsection ) return 0 ; name = xmemdupz ( subsection , subsection_len ) ; if ( check_submodule_name ( name ) < 0 ) data -> ret |= report ( data -> options , data -> obj , FSCK_MSG_GITMODULES_NAME , "disallowed<S2SV_blank>submodule<S2SV_blank>name:<S2SV_blank>%s" , name ) ; if ( ! strcmp ( key , "url" ) && value && looks_like_command_line_option ( value ) ) data -> ret |= report ( data -> options , data -> obj , FSCK_MSG_GITMODULES_URL , "disallowed<S2SV_blank>submodule<S2SV_blank>url:<S2SV_blank>%s" , value ) ; <S2SV_StartBug> free ( name ) ; <S2SV_EndBug> return 0 ; }
| <S2SV_ModStart> value ) ; if ( ! strcmp ( key , "path" ) && value && looks_like_command_line_option ( value ) ) data -> ret |= report ( data -> options , data -> obj , FSCK_MSG_GITMODULES_PATH , "disallowed<S2SV_blank>submodule<S2SV_blank>path:<S2SV_blank>%s" , value ) ;
| git@git/1a7fd1fb2998002da6e9ff2ee46e1bdd25ee8404 | CVE-2018-17456 | https://github.com/git/git/commit/1a7fd1fb2998002da6e9ff2ee46e1bdd25ee8404 | 2018-10-06T14:29Z |
71 | CWE-264 | CWE-264 static void chase_port ( struct edgeport_port * port , unsigned long timeout , int flush ) { int baud_rate ; struct tty_struct * tty = tty_port_tty_get ( & port -> port -> port ) ; struct usb_serial * serial = port -> port -> serial ; wait_queue_t wait ; <S2SV_StartBug> unsigned long flags ; <S2SV_EndBug> if ( ! timeout ) timeout = ( HZ * EDGE_CLOSING_WAIT ) / 100 ; spin_lock_irqsave ( & port -> ep_lock , flags ) ; init_waitqueue_entry ( & wait , current ) ; add_wait_queue ( & tty -> write_wait , & wait ) ; for ( ; ; ) { set_current_state ( TASK_INTERRUPTIBLE ) ; if ( kfifo_len ( & port -> write_fifo ) == 0 || timeout == 0 || signal_pending ( current ) || serial -> disconnected ) break ; spin_unlock_irqrestore ( & port -> ep_lock , flags ) ; timeout = schedule_timeout ( timeout ) ; spin_lock_irqsave ( & port -> ep_lock , flags ) ; } set_current_state ( TASK_RUNNING ) ; remove_wait_queue ( & tty -> write_wait , & wait ) ; if ( flush ) kfifo_reset_out ( & port -> write_fifo ) ; spin_unlock_irqrestore ( & port -> ep_lock , flags ) ; tty_kref_put ( tty ) ; timeout += jiffies ; while ( ( long ) ( jiffies - timeout ) < 0 && ! signal_pending ( current ) && ! serial -> disconnected ) { if ( ! tx_active ( port ) ) break ; msleep ( 10 ) ; } if ( serial -> disconnected ) return ; baud_rate = port -> baud_rate ; if ( baud_rate == 0 ) baud_rate = 50 ; msleep ( max ( 1 , DIV_ROUND_UP ( 10000 , baud_rate ) ) ) ; }
| <S2SV_ModStart> unsigned long flags ; if ( ! tty ) return
| torvalds@linux/1ee0a224bc9aad1de496c795f96bc6ba2c394811 | CVE-2013-1774 | https://github.com/torvalds/linux/commit/1ee0a224bc9aad1de496c795f96bc6ba2c394811 | 2013-02-28T19:55Z |
72 | CWE-119 | CWE-119 static int atusb_get_and_show_revision ( struct atusb * atusb ) { struct usb_device * usb_dev = atusb -> usb_dev ; <S2SV_StartBug> unsigned char buffer [ 3 ] ; <S2SV_EndBug> int ret ; ret = atusb_control_msg ( atusb , usb_rcvctrlpipe ( usb_dev , 0 ) , ATUSB_ID , ATUSB_REQ_FROM_DEV , 0 , 0 , buffer , 3 , 1000 ) ; if ( ret >= 0 ) { atusb -> fw_ver_maj = buffer [ 0 ] ; atusb -> fw_ver_min = buffer [ 1 ] ; atusb -> fw_hw_type = buffer [ 2 ] ; dev_info ( & usb_dev -> dev , "Firmware:<S2SV_blank>major:<S2SV_blank>%u,<S2SV_blank>minor:<S2SV_blank>%u,<S2SV_blank>hardware<S2SV_blank>type:<S2SV_blank>%u\\n" , atusb -> fw_ver_maj , atusb -> fw_ver_min , atusb -> fw_hw_type ) ; } if ( atusb -> fw_ver_maj == 0 && atusb -> fw_ver_min < 2 ) { dev_info ( & usb_dev -> dev , "Firmware<S2SV_blank>version<S2SV_blank>(%u.%u)<S2SV_blank>predates<S2SV_blank>our<S2SV_blank>first<S2SV_blank>public<S2SV_blank>release." , atusb -> fw_ver_maj , atusb -> fw_ver_min ) ; dev_info ( & usb_dev -> dev , "Please<S2SV_blank>update<S2SV_blank>to<S2SV_blank>version<S2SV_blank>0.2<S2SV_blank>or<S2SV_blank>newer" ) ; } <S2SV_StartBug> return ret ; <S2SV_EndBug> }
| <S2SV_ModStart> ; unsigned char * buffer ; int ret ; buffer = kmalloc ( 3 , GFP_KERNEL ) ; if ( ! buffer ) return - ENOMEM <S2SV_ModEnd> ; ret = <S2SV_ModStart> ) ; } kfree ( buffer ) ;
| torvalds@linux/05a974efa4bdf6e2a150e3f27dc6fcf0a9ad5655 | CVE-2017-5548 | https://github.com/torvalds/linux/commit/05a974efa4bdf6e2a150e3f27dc6fcf0a9ad5655 | 2017-02-06T06:59Z |
73 | CWE-345 | CWE-345 static int daemon_AuthUserPwd ( char * username , char * password , char * errbuf ) { # ifdef _WIN32 <S2SV_StartBug> HANDLE Token ; <S2SV_EndBug> <S2SV_StartBug> if ( LogonUser ( username , "." , password , LOGON32_LOGON_NETWORK , LOGON32_PROVIDER_DEFAULT , & Token ) == 0 ) <S2SV_EndBug> { <S2SV_StartBug> pcap_fmt_errmsg_for_win32_err ( errbuf , PCAP_ERRBUF_SIZE , <S2SV_EndBug> <S2SV_StartBug> GetLastError ( ) , "LogonUser()<S2SV_blank>failed" ) ; <S2SV_EndBug> return - 1 ; } <S2SV_StartBug> if ( ImpersonateLoggedOnUser ( Token ) == 0 ) <S2SV_EndBug> { pcap_fmt_errmsg_for_win32_err ( errbuf , PCAP_ERRBUF_SIZE , GetLastError ( ) , "ImpersonateLoggedOnUser()<S2SV_blank>failed" ) ; CloseHandle ( Token ) ; <S2SV_StartBug> return - 1 ; <S2SV_EndBug> } CloseHandle ( Token ) ; return 0 ; <S2SV_StartBug> # else <S2SV_EndBug> struct passwd * user ; char * user_password ; # ifdef HAVE_GETSPNAM struct spwd * usersp ; # endif char * crypt_password ; if ( ( user = getpwnam ( username ) ) == NULL ) { <S2SV_StartBug> pcap_snprintf ( errbuf , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed:<S2SV_blank>user<S2SV_blank>name<S2SV_blank>or<S2SV_blank>password<S2SV_blank>incorrect" ) ; <S2SV_EndBug> return - 1 ; } # ifdef HAVE_GETSPNAM if ( ( usersp = getspnam ( username ) ) == NULL ) { <S2SV_StartBug> pcap_snprintf ( errbuf , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed:<S2SV_blank>user<S2SV_blank>name<S2SV_blank>or<S2SV_blank>password<S2SV_blank>incorrect" ) ; <S2SV_EndBug> return - 1 ; } user_password = usersp -> sp_pwdp ; # else user_password = user -> pw_passwd ; # endif <S2SV_StartBug> crypt_password = crypt ( password , user_password ) ; <S2SV_EndBug> if ( crypt_password == NULL ) { <S2SV_StartBug> pcap_snprintf ( errbuf , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed" ) ; <S2SV_EndBug> return - 1 ; } if ( strcmp ( user_password , crypt_password ) != 0 ) { <S2SV_StartBug> pcap_snprintf ( errbuf , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed:<S2SV_blank>user<S2SV_blank>name<S2SV_blank>or<S2SV_blank>password<S2SV_blank>incorrect" ) ; <S2SV_EndBug> return - 1 ; } if ( setuid ( user -> pw_uid ) ) { <S2SV_StartBug> pcap_fmt_errmsg_for_errno ( errbuf , PCAP_ERRBUF_SIZE , <S2SV_EndBug> <S2SV_StartBug> errno , "setuid" ) ; <S2SV_EndBug> <S2SV_StartBug> return - 1 ; <S2SV_EndBug> } return 0 ; # endif }
| <S2SV_ModStart> # ifdef _WIN32 DWORD error ; <S2SV_ModStart> HANDLE Token ; char errmsgbuf [ PCAP_ERRBUF_SIZE ] ; <S2SV_ModStart> 0 ) { pcap_snprintf ( errbuf , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed" ) ; error = GetLastError ( ) ; if ( error != ERROR_LOGON_FAILURE ) { pcap_fmt_errmsg_for_win32_err ( errmsgbuf , PCAP_ERRBUF_SIZE , error , "LogonUser()<S2SV_blank>failed" ) ; rpcapd_log ( LOGPRIO_ERROR , "%s" , errmsgbuf ) ; } return - 1 ; } if ( ImpersonateLoggedOnUser ( Token ) == 0 ) { pcap_snprintf ( errbuf , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed" ) ; pcap_fmt_errmsg_for_win32_err ( errmsgbuf <S2SV_ModEnd> , PCAP_ERRBUF_SIZE , <S2SV_ModStart> ( ) , "ImpersonateLoggedOnUser()<S2SV_blank>failed" ) ; rpcapd_log ( LOGPRIO_ERROR , "%s" , errmsgbuf ) ; CloseHandle <S2SV_ModEnd> ( Token ) <S2SV_ModStart> ( Token ) ; return - 1 ; } <S2SV_ModEnd> CloseHandle ( Token <S2SV_ModStart> ) ; return <S2SV_ModEnd> 0 ; # <S2SV_ModStart> ; # else int error ; <S2SV_ModStart> , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed" <S2SV_ModEnd> ) ; return <S2SV_ModStart> , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed" <S2SV_ModEnd> ) ; return <S2SV_ModStart> ; # endif errno = 0 ; <S2SV_ModStart> NULL ) { error = errno ; pcap_snprintf ( errbuf , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed" ) ; if ( error == 0 ) { rpcapd_log ( LOGPRIO_ERROR , "crypt()<S2SV_blank>failed" ) ; } else { rpcapd_log ( LOGPRIO_ERROR , "crypt()<S2SV_blank>failed:<S2SV_blank>%s" , strerror ( error ) ) ; } <S2SV_ModEnd> return - 1 <S2SV_ModStart> , PCAP_ERRBUF_SIZE , "Authentication<S2SV_blank>failed" <S2SV_ModEnd> ) ; return <S2SV_ModStart> ) ) { error = errno ; <S2SV_ModStart> , PCAP_ERRBUF_SIZE , error <S2SV_ModEnd> , "setuid" ) <S2SV_ModStart> "setuid" ) ; rpcapd_log ( LOGPRIO_ERROR , "setuid()<S2SV_blank>failed:<S2SV_blank>%s" , strerror ( error ) ) ;
| the-tcpdump-group@libpcap/484d60cbf7ca4ec758c3cbb8a82d68b244a78d58 | CVE-2019-15162 | https://github.com/the-tcpdump-group/libpcap/commit/484d60cbf7ca4ec758c3cbb8a82d68b244a78d58 | 2019-10-03T19:15Z |
74 | CWE-190 | CWE-190 static PyObject * <S2SV_StartBug> _Unpickler_MemoGet ( UnpicklerObject * self , Py_ssize_t idx ) <S2SV_EndBug> { <S2SV_StartBug> if ( idx < 0 || idx >= self -> memo_size ) <S2SV_EndBug> return NULL ; return self -> memo [ idx ] ; }
| <S2SV_ModStart> * self , size_t <S2SV_ModEnd> idx ) { <S2SV_ModStart> { if ( <S2SV_ModEnd> idx >= self
| python@cpython/a4ae828ee416a66d8c7bf5ee71d653c2cc6a26dd | CVE-2018-20406 | https://github.com/python/cpython/commit/a4ae828ee416a66d8c7bf5ee71d653c2cc6a26dd | 2018-12-23T23:29Z |
75 | CWE-000 | CWE-000 void sas_deform_port ( struct asd_sas_phy * phy , int gone ) { struct sas_ha_struct * sas_ha = phy -> ha ; struct asd_sas_port * port = phy -> port ; struct sas_internal * si = to_sas_internal ( sas_ha -> core . shost -> transportt ) ; struct domain_device * dev ; unsigned long flags ; if ( ! port ) return ; dev = port -> port_dev ; if ( dev ) dev -> pathways -- ; if ( port -> num_phys == 1 ) { sas_unregister_domain_devices ( port , gone ) ; <S2SV_StartBug> sas_port_delete ( port -> port ) ; <S2SV_EndBug> port -> port = NULL ; } else { sas_port_delete_phy ( port -> port , phy -> phy ) ; sas_device_set_phy ( dev , port -> port ) ; } if ( si -> dft -> lldd_port_deformed ) si -> dft -> lldd_port_deformed ( phy ) ; spin_lock_irqsave ( & sas_ha -> phy_port_lock , flags ) ; spin_lock ( & port -> phy_list_lock ) ; list_del_init ( & phy -> port_phy_el ) ; sas_phy_set_target ( phy , NULL ) ; phy -> port = NULL ; port -> num_phys -- ; port -> phy_mask &= ~ ( 1U << phy -> id ) ; if ( port -> num_phys == 0 ) { INIT_LIST_HEAD ( & port -> phy_list ) ; memset ( port -> sas_addr , 0 , SAS_ADDR_SIZE ) ; memset ( port -> attached_sas_addr , 0 , SAS_ADDR_SIZE ) ; port -> class = 0 ; port -> iproto = 0 ; port -> tproto = 0 ; port -> oob_mode = 0 ; port -> phy_mask = 0 ; } spin_unlock ( & port -> phy_list_lock ) ; spin_unlock_irqrestore ( & sas_ha -> phy_port_lock , flags ) ; return ; }
| <S2SV_ModStart> gone ) ; sas_destruct_devices ( port ) ;
| torvalds@linux/0558f33c06bb910e2879e355192227a8e8f0219d | CVE-2017-18232 | https://github.com/torvalds/linux/commit/0558f33c06bb910e2879e355192227a8e8f0219d | 2018-03-15T04:29Z |
76 | CWE-125 | CWE-125 static stmt_ty <S2SV_StartBug> ast_for_with_stmt ( struct compiling * c , const node * n , int is_async ) <S2SV_EndBug> <S2SV_StartBug> { <S2SV_EndBug> int i , n_items , nch_minus_type , has_type_comment ; asdl_seq * items , * body ; string type_comment ; if ( is_async && c -> c_feature_version < 5 ) { ast_error ( c , n , "Async<S2SV_blank>with<S2SV_blank>statements<S2SV_blank>are<S2SV_blank>only<S2SV_blank>supported<S2SV_blank>in<S2SV_blank>Python<S2SV_blank>3.5<S2SV_blank>and<S2SV_blank>greater" ) ; return NULL ; } REQ ( n , with_stmt ) ; has_type_comment = TYPE ( CHILD ( n , NCH ( n ) - 2 ) ) == TYPE_COMMENT ; nch_minus_type = NCH ( n ) - has_type_comment ; n_items = ( nch_minus_type - 2 ) / 2 ; items = _Ta3_asdl_seq_new ( n_items , c -> c_arena ) ; if ( ! items ) return NULL ; for ( i = 1 ; i < nch_minus_type - 2 ; i += 2 ) { withitem_ty item = ast_for_with_item ( c , CHILD ( n , i ) ) ; if ( ! item ) return NULL ; asdl_seq_SET ( items , ( i - 1 ) / 2 , item ) ; } body = ast_for_suite ( c , CHILD ( n , NCH ( n ) - 1 ) ) ; if ( ! body ) return NULL ; if ( has_type_comment ) type_comment = NEW_TYPE_COMMENT ( CHILD ( n , NCH ( n ) - 2 ) ) ; else type_comment = NULL ; if ( is_async ) <S2SV_StartBug> return AsyncWith ( items , body , type_comment , LINENO ( n ) , n -> n_col_offset , c -> c_arena ) ; <S2SV_EndBug> else return With ( items , body , type_comment , LINENO ( n ) , n -> n_col_offset , c -> c_arena ) ; }
| <S2SV_ModStart> const node * n0 , bool <S2SV_ModEnd> is_async ) { <S2SV_ModStart> is_async ) { const node * const n = is_async ? CHILD ( n0 , 1 ) : n0 ; <S2SV_ModStart> , LINENO ( n0 ) , n0 <S2SV_ModEnd> -> n_col_offset ,
| python@typed_ast/156afcb26c198e162504a57caddfe0acd9ed7dce | CVE-2019-19275 | https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce | 2019-11-26T15:15Z |
77 | CWE-362 | CWE-362 struct request * blk_mq_tag_to_rq ( struct blk_mq_tags * tags , unsigned int tag ) { <S2SV_StartBug> struct request * rq = tags -> rqs [ tag ] ; <S2SV_EndBug> <S2SV_StartBug> struct blk_flush_queue * fq = blk_get_flush_queue ( rq -> q , rq -> mq_ctx ) ; <S2SV_EndBug> if ( ! is_flush_request ( rq , fq , tag ) ) return rq ; return fq -> flush_rq ; }
| <S2SV_ModStart> tag ) { return <S2SV_ModEnd> tags -> rqs <S2SV_ModStart> tag ] ; <S2SV_ModEnd> } <S2SV_null> <S2SV_null>
| torvalds@linux/0048b4837affd153897ed1222283492070027aa9 | CVE-2015-9016 | https://github.com/torvalds/linux/commit/0048b4837affd153897ed1222283492070027aa9 | 2018-04-05T18:29Z |
78 | CWE-119 | CWE-119 static bool ldm_frag_add ( const u8 * data , int size , struct list_head * frags ) { struct frag * f ; struct list_head * item ; int rec , num , group ; BUG_ON ( ! data || ! frags ) ; if ( size < 2 * VBLK_SIZE_HEAD ) { ldm_error ( "Value<S2SV_blank>of<S2SV_blank>size<S2SV_blank>is<S2SV_blank>to<S2SV_blank>small." ) ; return false ; } group = get_unaligned_be32 ( data + 0x08 ) ; rec = get_unaligned_be16 ( data + 0x0C ) ; num = get_unaligned_be16 ( data + 0x0E ) ; if ( ( num < 1 ) || ( num > 4 ) ) { ldm_error ( "A<S2SV_blank>VBLK<S2SV_blank>claims<S2SV_blank>to<S2SV_blank>have<S2SV_blank>%d<S2SV_blank>parts." , num ) ; return false ; } if ( rec >= num ) { ldm_error ( "REC<S2SV_blank>value<S2SV_blank>(%d)<S2SV_blank>exceeds<S2SV_blank>NUM<S2SV_blank>value<S2SV_blank>(%d)" , rec , num ) ; return false ; } list_for_each ( item , frags ) { f = list_entry ( item , struct frag , list ) ; if ( f -> group == group ) goto found ; } f = kmalloc ( sizeof ( * f ) + size * num , GFP_KERNEL ) ; if ( ! f ) { ldm_crit ( "Out<S2SV_blank>of<S2SV_blank>memory." ) ; return false ; } f -> group = group ; f -> num = num ; f -> rec = rec ; f -> map = 0xFF << num ; list_add_tail ( & f -> list , frags ) ; found : <S2SV_StartBug> if ( f -> map & ( 1 << rec ) ) { <S2SV_EndBug> ldm_error ( "Duplicate<S2SV_blank>VBLK,<S2SV_blank>part<S2SV_blank>%d." , rec ) ; f -> map &= 0x7F ; return false ; } f -> map |= ( 1 << rec ) ; data += VBLK_SIZE_HEAD ; size -= VBLK_SIZE_HEAD ; memcpy ( f -> data + rec * ( size - VBLK_SIZE_HEAD ) + VBLK_SIZE_HEAD , data , size ) ; return true ; }
| <S2SV_ModStart> : if ( rec >= f -> num ) { ldm_error ( "REC<S2SV_blank>value<S2SV_blank>(%d)<S2SV_blank>exceeds<S2SV_blank>NUM<S2SV_blank>value<S2SV_blank>(%d)" , rec , f -> num ) ; return false ; } if (
| torvalds@linux/cae13fe4cc3f24820ffb990c09110626837e85d4 | CVE-2011-2182 | https://github.com/torvalds/linux/commit/cae13fe4cc3f24820ffb990c09110626837e85d4 | 2012-06-13T10:24Z |
79 | CWE-399 | CWE-399 static void nlmclnt_unlock_callback ( struct rpc_task * task , void * data ) { struct nlm_rqst * req = data ; u32 status = ntohl ( req -> a_res . status ) ; if ( RPC_ASSASSINATED ( task ) ) goto die ; if ( task -> tk_status < 0 ) { dprintk ( "lockd:<S2SV_blank>unlock<S2SV_blank>failed<S2SV_blank>(err<S2SV_blank>=<S2SV_blank>%d)\\n" , - task -> tk_status ) ; <S2SV_StartBug> goto retry_rebind ; <S2SV_EndBug> } if ( status == NLM_LCK_DENIED_GRACE_PERIOD ) { rpc_delay ( task , NLMCLNT_GRACE_WAIT ) ; goto retry_unlock ; } if ( status != NLM_LCK_GRANTED ) printk ( KERN_WARNING "lockd:<S2SV_blank>unexpected<S2SV_blank>unlock<S2SV_blank>status:<S2SV_blank>%d\\n" , status ) ; die : return ; retry_rebind : nlm_rebind_host ( req -> a_host ) ; retry_unlock : rpc_restart_call ( task ) ; }
| <S2SV_ModStart> tk_status ) ; switch ( task -> tk_status ) { case - EACCES : case - EIO : goto die ; default : <S2SV_ModStart> goto retry_rebind ; }
| torvalds@linux/0b760113a3a155269a3fba93a409c640031dd68f | CVE-2011-2491 | https://github.com/torvalds/linux/commit/0b760113a3a155269a3fba93a409c640031dd68f | 2013-03-01T12:37Z |
80 | CWE-284 | CWE-284 int socket_create ( uint16_t port ) { int sfd = - 1 ; int yes = 1 ; # ifdef WIN32 WSADATA wsa_data ; if ( ! wsa_init ) { if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsa_data ) != ERROR_SUCCESS ) { fprintf ( stderr , "WSAStartup<S2SV_blank>failed!\\n" ) ; ExitProcess ( - 1 ) ; } wsa_init = 1 ; } # endif struct sockaddr_in saddr ; if ( 0 > ( sfd = socket ( PF_INET , SOCK_STREAM , IPPROTO_TCP ) ) ) { perror ( "socket()" ) ; return - 1 ; } if ( setsockopt ( sfd , SOL_SOCKET , SO_REUSEADDR , ( void * ) & yes , sizeof ( int ) ) == - 1 ) { perror ( "setsockopt()" ) ; socket_close ( sfd ) ; return - 1 ; } # ifdef SO_NOSIGPIPE if ( setsockopt ( sfd , SOL_SOCKET , SO_NOSIGPIPE , ( void * ) & yes , sizeof ( int ) ) == - 1 ) { perror ( "setsockopt()" ) ; socket_close ( sfd ) ; return - 1 ; } # endif memset ( ( void * ) & saddr , 0 , sizeof ( saddr ) ) ; saddr . sin_family = AF_INET ; <S2SV_StartBug> saddr . sin_addr . s_addr = htonl ( INADDR_ANY ) ; <S2SV_EndBug> saddr . sin_port = htons ( port ) ; if ( 0 > bind ( sfd , ( struct sockaddr * ) & saddr , sizeof ( saddr ) ) ) { perror ( "bind()" ) ; socket_close ( sfd ) ; return - 1 ; } if ( listen ( sfd , 1 ) == - 1 ) { perror ( "listen()" ) ; socket_close ( sfd ) ; return - 1 ; } return sfd ; }
| <S2SV_ModStart> = htonl ( INADDR_LOOPBACK <S2SV_ModEnd> ) ; saddr
| libimobiledevice@libusbmuxd/4397b3376dc4e4cb1c991d0aed61ce6482614196 | CVE-2016-5104 | https://github.com/libimobiledevice/libusbmuxd/commit/4397b3376dc4e4cb1c991d0aed61ce6482614196 | 2016-06-13T14:59Z |
81 | CWE-119 | CWE-119 static int nl80211_start_sched_scan ( struct sk_buff * skb , struct genl_info * info ) { struct cfg80211_sched_scan_request * request ; struct cfg80211_registered_device * rdev = info -> user_ptr [ 0 ] ; struct net_device * dev = info -> user_ptr [ 1 ] ; struct nlattr * attr ; struct wiphy * wiphy ; int err , tmp , n_ssids = 0 , n_channels , i ; u32 interval ; enum ieee80211_band band ; size_t ie_len ; if ( ! ( rdev -> wiphy . flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN ) || ! rdev -> ops -> sched_scan_start ) return - EOPNOTSUPP ; if ( ! is_valid_ie_attr ( info -> attrs [ NL80211_ATTR_IE ] ) ) return - EINVAL ; if ( rdev -> sched_scan_req ) return - EINPROGRESS ; if ( ! info -> attrs [ NL80211_ATTR_SCHED_SCAN_INTERVAL ] ) return - EINVAL ; interval = nla_get_u32 ( info -> attrs [ NL80211_ATTR_SCHED_SCAN_INTERVAL ] ) ; if ( interval == 0 ) return - EINVAL ; wiphy = & rdev -> wiphy ; if ( info -> attrs [ NL80211_ATTR_SCAN_FREQUENCIES ] ) { n_channels = validate_scan_freqs ( info -> attrs [ NL80211_ATTR_SCAN_FREQUENCIES ] ) ; if ( ! n_channels ) return - EINVAL ; } else { n_channels = 0 ; for ( band = 0 ; band < IEEE80211_NUM_BANDS ; band ++ ) if ( wiphy -> bands [ band ] ) n_channels += wiphy -> bands [ band ] -> n_channels ; } if ( info -> attrs [ NL80211_ATTR_SCAN_SSIDS ] ) nla_for_each_nested ( attr , info -> attrs [ NL80211_ATTR_SCAN_SSIDS ] , tmp ) n_ssids ++ ; if ( n_ssids > wiphy -> max_scan_ssids ) return - EINVAL ; if ( info -> attrs [ NL80211_ATTR_IE ] ) ie_len = nla_len ( info -> attrs [ NL80211_ATTR_IE ] ) ; else ie_len = 0 ; if ( ie_len > wiphy -> max_scan_ie_len ) return - EINVAL ; request = kzalloc ( sizeof ( * request ) + sizeof ( * request -> ssids ) * n_ssids + sizeof ( * request -> channels ) * n_channels + ie_len , GFP_KERNEL ) ; if ( ! request ) return - ENOMEM ; if ( n_ssids ) request -> ssids = ( void * ) & request -> channels [ n_channels ] ; request -> n_ssids = n_ssids ; if ( ie_len ) { if ( request -> ssids ) request -> ie = ( void * ) ( request -> ssids + n_ssids ) ; else request -> ie = ( void * ) ( request -> channels + n_channels ) ; } i = 0 ; if ( info -> attrs [ NL80211_ATTR_SCAN_FREQUENCIES ] ) { nla_for_each_nested ( attr , info -> attrs [ NL80211_ATTR_SCAN_FREQUENCIES ] , tmp ) { struct ieee80211_channel * chan ; chan = ieee80211_get_channel ( wiphy , nla_get_u32 ( attr ) ) ; if ( ! chan ) { err = - EINVAL ; goto out_free ; } if ( chan -> flags & IEEE80211_CHAN_DISABLED ) continue ; request -> channels [ i ] = chan ; i ++ ; } } else { for ( band = 0 ; band < IEEE80211_NUM_BANDS ; band ++ ) { int j ; if ( ! wiphy -> bands [ band ] ) continue ; for ( j = 0 ; j < wiphy -> bands [ band ] -> n_channels ; j ++ ) { struct ieee80211_channel * chan ; chan = & wiphy -> bands [ band ] -> channels [ j ] ; if ( chan -> flags & IEEE80211_CHAN_DISABLED ) continue ; request -> channels [ i ] = chan ; i ++ ; } } } if ( ! i ) { err = - EINVAL ; goto out_free ; } request -> n_channels = i ; i = 0 ; if ( info -> attrs [ NL80211_ATTR_SCAN_SSIDS ] ) { nla_for_each_nested ( attr , info -> attrs [ NL80211_ATTR_SCAN_SSIDS ] , tmp ) { <S2SV_StartBug> if ( request -> ssids [ i ] . ssid_len > <S2SV_EndBug> IEEE80211_MAX_SSID_LEN ) { err = - EINVAL ; goto out_free ; } memcpy ( request -> ssids [ i ] . ssid , nla_data ( attr ) , nla_len ( attr ) ) ; <S2SV_StartBug> request -> ssids [ i ] . ssid_len = nla_len ( attr ) ; <S2SV_EndBug> i ++ ; } } if ( info -> attrs [ NL80211_ATTR_IE ] ) { request -> ie_len = nla_len ( info -> attrs [ NL80211_ATTR_IE ] ) ; memcpy ( ( void * ) request -> ie , nla_data ( info -> attrs [ NL80211_ATTR_IE ] ) , request -> ie_len ) ; } request -> dev = dev ; request -> wiphy = & rdev -> wiphy ; request -> interval = interval ; err = rdev -> ops -> sched_scan_start ( & rdev -> wiphy , dev , request ) ; if ( ! err ) { rdev -> sched_scan_req = request ; nl80211_send_sched_scan ( rdev , dev , NL80211_CMD_START_SCHED_SCAN ) ; goto out ; } out_free : kfree ( request ) ; out : return err ; }
| <S2SV_ModStart> tmp ) { request -> ssids [ i ] . ssid_len = nla_len ( attr ) ; <S2SV_ModStart> ) ) ; <S2SV_ModEnd> i ++ ;
| torvalds@linux/208c72f4fe44fe09577e7975ba0e7fa0278f3d03 | CVE-2011-2517 | https://github.com/torvalds/linux/commit/208c72f4fe44fe09577e7975ba0e7fa0278f3d03 | 2012-05-24T23:55Z |
82 | CWE-119 | CWE-119 static int netlbl_cipsov4_add_common ( struct genl_info * info , struct cipso_v4_doi * doi_def ) { struct nlattr * nla ; int nla_rem ; u32 iter = 0 ; doi_def -> doi = nla_get_u32 ( info -> attrs [ NLBL_CIPSOV4_A_DOI ] ) ; if ( nla_validate_nested ( info -> attrs [ NLBL_CIPSOV4_A_TAGLST ] , NLBL_CIPSOV4_A_MAX , netlbl_cipsov4_genl_policy ) != 0 ) return - EINVAL ; nla_for_each_nested ( nla , info -> attrs [ NLBL_CIPSOV4_A_TAGLST ] , nla_rem ) if ( nla -> nla_type == NLBL_CIPSOV4_A_TAG ) { <S2SV_StartBug> if ( iter > CIPSO_V4_TAG_MAXCNT ) <S2SV_EndBug> return - EINVAL ; doi_def -> tags [ iter ++ ] = nla_get_u8 ( nla ) ; } <S2SV_StartBug> if ( iter < CIPSO_V4_TAG_MAXCNT ) <S2SV_EndBug> <S2SV_StartBug> doi_def -> tags [ iter ] = CIPSO_V4_TAG_INVALID ; <S2SV_EndBug> return 0 ; }
| <S2SV_ModStart> if ( iter >= <S2SV_ModEnd> CIPSO_V4_TAG_MAXCNT ) return <S2SV_ModStart> ) ; } while <S2SV_ModEnd> ( iter < <S2SV_ModStart> tags [ iter ++
| torvalds@linux/2a2f11c227bdf292b3a2900ad04139d301b56ac4 | CVE-2007-6762 | https://github.com/torvalds/linux/commit/2a2f11c227bdf292b3a2900ad04139d301b56ac4 | 2019-07-27T22:15Z |
83 | CWE-125 | CWE-125 static int count_comp_fors ( struct compiling * c , const node * n ) { int n_fors = 0 ; <S2SV_StartBug> int is_async ; <S2SV_EndBug> count_comp_for : is_async = 0 ; n_fors ++ ; REQ ( n , comp_for ) ; <S2SV_StartBug> if ( TYPE ( CHILD ( n , 0 ) ) == ASYNC ) { <S2SV_EndBug> is_async = 1 ; } <S2SV_StartBug> if ( NCH ( n ) == ( 5 + is_async ) ) { <S2SV_EndBug> <S2SV_StartBug> n = CHILD ( n , 4 + is_async ) ; <S2SV_EndBug> } else { return n_fors ; } count_comp_iter : REQ ( n , comp_iter ) ; n = CHILD ( n , 0 ) ; if ( TYPE ( n ) == comp_for ) goto count_comp_for ; else if ( TYPE ( n ) == comp_if ) { if ( NCH ( n ) == 3 ) { n = CHILD ( n , 2 ) ; goto count_comp_iter ; } else return n_fors ; <S2SV_StartBug> } <S2SV_EndBug> PyErr_SetString ( PyExc_SystemError , "logic<S2SV_blank>error<S2SV_blank>in<S2SV_blank>count_comp_fors" ) ; return - 1 ; }
| <S2SV_ModStart> = 0 ; count_comp_for : <S2SV_ModEnd> n_fors ++ ; <S2SV_ModStart> ; if ( NCH ( n ) == 2 ) { REQ ( CHILD ( n , 0 ) , NAME ) ; assert ( strcmp ( STR ( CHILD ( n , 0 ) ) , "async" ) == 0 ) ; n = CHILD ( n , 1 ) ; } else if ( NCH ( n ) == 1 ) { n = CHILD ( n , 0 ) ; } else { goto error <S2SV_ModEnd> ; } if <S2SV_ModStart> == ( 5 <S2SV_ModEnd> ) ) { <S2SV_ModStart> n , 4 <S2SV_ModEnd> ) ; } <S2SV_ModStart> n_fors ; } error :
| python@typed_ast/156afcb26c198e162504a57caddfe0acd9ed7dce | CVE-2019-19275 | https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce | 2019-11-26T15:15Z |
84 | CWE-835 | CWE-835 static const u_char * ikev1_nonce_print ( netdissect_options * ndo , u_char tpay _U_ , const struct isakmp_gen * ext , u_int item_len _U_ , const u_char * ep , uint32_t phase _U_ , uint32_t doi _U_ , uint32_t proto _U_ , int depth _U_ ) { struct isakmp_gen e ; ND_PRINT ( ( ndo , "%s:" , NPSTR ( ISAKMP_NPTYPE_NONCE ) ) ) ; ND_TCHECK ( * ext ) ; UNALIGNED_MEMCPY ( & e , ext , sizeof ( e ) ) ; <S2SV_StartBug> ND_PRINT ( ( ndo , "<S2SV_blank>n<S2SV_blank>len=%d" , ntohs ( e . len ) - 4 ) ) ; <S2SV_EndBug> <S2SV_StartBug> if ( 2 < ndo -> ndo_vflag && 4 < ntohs ( e . len ) ) { <S2SV_EndBug> ND_PRINT ( ( ndo , "<S2SV_blank>" ) ) ; if ( ! rawprint ( ndo , ( const uint8_t * ) ( ext + 1 ) , ntohs ( e . len ) - 4 ) ) goto trunc ; <S2SV_StartBug> } else if ( 1 < ndo -> ndo_vflag && 4 < ntohs ( e . len ) ) { <S2SV_EndBug> ND_PRINT ( ( ndo , "<S2SV_blank>" ) ) ; <S2SV_StartBug> if ( ! ike_show_somedata ( ndo , ( const u_char * ) ( const uint8_t * ) ( ext + 1 ) , ep ) ) <S2SV_EndBug> goto trunc ; } <S2SV_StartBug> return ( const u_char * ) ext + ntohs ( e . len ) ; <S2SV_EndBug> trunc : ND_PRINT ( ( ndo , "<S2SV_blank>[|%s]" , NPSTR ( ISAKMP_NPTYPE_NONCE ) ) ) ; return NULL ; }
| <S2SV_ModStart> ( ndo , "<S2SV_blank>n<S2SV_blank>len=%u" <S2SV_ModEnd> , ntohs ( <S2SV_ModStart> ; if ( ntohs ( e . len ) > 4 ) { if ( <S2SV_ModEnd> ndo -> ndo_vflag <S2SV_ModStart> ndo -> ndo_vflag > 2 <S2SV_ModEnd> ) { ND_PRINT <S2SV_ModStart> else if ( <S2SV_ModEnd> ndo -> ndo_vflag <S2SV_ModStart> ndo -> ndo_vflag > 1 <S2SV_ModEnd> ) { ND_PRINT <S2SV_ModStart> * ) ( <S2SV_ModEnd> ext + 1 <S2SV_ModStart> trunc ; } }
| the-tcpdump-group@tcpdump/c2ef693866beae071a24b45c49f9674af1df4028 | CVE-2017-12990 | https://github.com/the-tcpdump-group/tcpdump/commit/c2ef693866beae071a24b45c49f9674af1df4028 | 2017-09-14T06:29Z |
85 | CWE-264 | CWE-264 static int futex_wait_requeue_pi ( u32 __user * uaddr , unsigned int flags , u32 val , ktime_t * abs_time , u32 bitset , u32 __user * uaddr2 ) { struct hrtimer_sleeper timeout , * to = NULL ; struct rt_mutex_waiter rt_waiter ; struct rt_mutex * pi_mutex = NULL ; struct futex_hash_bucket * hb ; union futex_key key2 = FUTEX_KEY_INIT ; struct futex_q q = futex_q_init ; int res , ret ; if ( uaddr == uaddr2 ) return - EINVAL ; if ( ! bitset ) return - EINVAL ; if ( abs_time ) { to = & timeout ; hrtimer_init_on_stack ( & to -> timer , ( flags & FLAGS_CLOCKRT ) ? CLOCK_REALTIME : CLOCK_MONOTONIC , HRTIMER_MODE_ABS ) ; hrtimer_init_sleeper ( to , current ) ; hrtimer_set_expires_range_ns ( & to -> timer , * abs_time , current -> timer_slack_ns ) ; } debug_rt_mutex_init_waiter ( & rt_waiter ) ; RB_CLEAR_NODE ( & rt_waiter . pi_tree_entry ) ; RB_CLEAR_NODE ( & rt_waiter . tree_entry ) ; rt_waiter . task = NULL ; ret = get_futex_key ( uaddr2 , flags & FLAGS_SHARED , & key2 , VERIFY_WRITE ) ; if ( unlikely ( ret != 0 ) ) goto out ; q . bitset = bitset ; q . rt_waiter = & rt_waiter ; q . requeue_pi_key = & key2 ; ret = futex_wait_setup ( uaddr , val , flags , & q , & hb ) ; if ( ret ) goto out_key2 ; <S2SV_StartBug> futex_wait_queue_me ( hb , & q , to ) ; <S2SV_EndBug> spin_lock ( & hb -> lock ) ; ret = handle_early_requeue_pi_wakeup ( hb , & q , & key2 , to ) ; spin_unlock ( & hb -> lock ) ; if ( ret ) goto out_put_keys ; if ( ! q . rt_waiter ) { if ( q . pi_state && ( q . pi_state -> owner != current ) ) { spin_lock ( q . lock_ptr ) ; ret = fixup_pi_state_owner ( uaddr2 , & q , current ) ; spin_unlock ( q . lock_ptr ) ; } } else { WARN_ON ( ! q . pi_state ) ; pi_mutex = & q . pi_state -> pi_mutex ; ret = rt_mutex_finish_proxy_lock ( pi_mutex , to , & rt_waiter , 1 ) ; debug_rt_mutex_free_waiter ( & rt_waiter ) ; spin_lock ( q . lock_ptr ) ; res = fixup_owner ( uaddr2 , & q , ! ret ) ; if ( res ) ret = ( res < 0 ) ? res : 0 ; unqueue_me_pi ( & q ) ; } if ( ret == - EFAULT ) { if ( pi_mutex && rt_mutex_owner ( pi_mutex ) == current ) rt_mutex_unlock ( pi_mutex ) ; } else if ( ret == - EINTR ) { ret = - EWOULDBLOCK ; } out_put_keys : put_futex_key ( & q . key ) ; out_key2 : put_futex_key ( & key2 ) ; out : if ( to ) { hrtimer_cancel ( & to -> timer ) ; destroy_hrtimer_on_stack ( & to -> timer ) ; } return ret ; }
| <S2SV_ModStart> goto out_key2 ; if ( match_futex ( & q . key , & key2 ) ) { ret = - EINVAL ; goto out_put_keys ; }
| torvalds@linux/e9c243a5a6de0be8e584c604d353412584b592f8 | CVE-2014-3153 | https://github.com/torvalds/linux/commit/e9c243a5a6de0be8e584c604d353412584b592f8 | 2014-06-07T14:55Z |
86 | CWE-000 | CWE-000 int propagate_mnt ( struct mount * dest_mnt , struct mountpoint * dest_mp , struct mount * source_mnt , struct hlist_head * tree_list ) { struct mount * m , * n ; int ret = 0 ; user_ns = current -> nsproxy -> mnt_ns -> user_ns ; last_dest = dest_mnt ; <S2SV_StartBug> last_source = source_mnt ; <S2SV_EndBug> mp = dest_mp ; list = tree_list ; dest_master = dest_mnt -> mnt_master ; for ( n = next_peer ( dest_mnt ) ; n != dest_mnt ; n = next_peer ( n ) ) { ret = propagate_one ( n ) ; if ( ret ) goto out ; } for ( m = next_group ( dest_mnt , dest_mnt ) ; m ; m = next_group ( m , dest_mnt ) ) { n = m ; do { ret = propagate_one ( n ) ; if ( ret ) goto out ; n = next_peer ( n ) ; } while ( n != m ) ; } out : read_seqlock_excl ( & mount_lock ) ; hlist_for_each_entry ( n , tree_list , mnt_hash ) { m = n -> mnt_parent ; if ( m -> mnt_master != dest_mnt -> mnt_master ) CLEAR_MNT_MARK ( m -> mnt_master ) ; } read_sequnlock_excl ( & mount_lock ) ; return ret ; }
| <S2SV_ModStart> = dest_mnt ; first_source = source_mnt ;
| torvalds@linux/5ec0811d30378ae104f250bfc9b3640242d81e3f | CVE-2016-4581 | https://github.com/torvalds/linux/commit/5ec0811d30378ae104f250bfc9b3640242d81e3f | 2016-05-23T10:59Z |
87 | CWE-119 | CWE-119 static int tt_s2_4600_frontend_attach ( struct dvb_usb_adapter * adap ) { struct dvb_usb_device * d = adap -> dev ; <S2SV_StartBug> struct dw2102_state * state = d -> priv ; <S2SV_EndBug> u8 obuf [ 3 ] = { 0xe , 0x80 , 0 } ; u8 ibuf [ ] = { 0 } ; struct i2c_adapter * i2c_adapter ; struct i2c_client * client ; struct i2c_board_info board_info ; struct m88ds3103_platform_data m88ds3103_pdata = { } ; struct ts2020_config ts2020_config = { } ; <S2SV_StartBug> if ( dvb_usb_generic_rw ( d , obuf , 3 , ibuf , 1 , 0 ) < 0 ) <S2SV_EndBug> err ( "command<S2SV_blank>0x0e<S2SV_blank>transfer<S2SV_blank>failed." ) ; <S2SV_StartBug> obuf [ 0 ] = 0xe ; <S2SV_EndBug> <S2SV_StartBug> obuf [ 1 ] = 0x02 ; <S2SV_EndBug> <S2SV_StartBug> obuf [ 2 ] = 1 ; <S2SV_EndBug> <S2SV_StartBug> if ( dvb_usb_generic_rw ( d , obuf , 3 , ibuf , 1 , 0 ) < 0 ) <S2SV_EndBug> err ( "command<S2SV_blank>0x0e<S2SV_blank>transfer<S2SV_blank>failed." ) ; msleep ( 300 ) ; <S2SV_StartBug> obuf [ 0 ] = 0xe ; <S2SV_EndBug> <S2SV_StartBug> obuf [ 1 ] = 0x83 ; <S2SV_EndBug> <S2SV_StartBug> obuf [ 2 ] = 0 ; <S2SV_EndBug> <S2SV_StartBug> if ( dvb_usb_generic_rw ( d , obuf , 3 , ibuf , 1 , 0 ) < 0 ) <S2SV_EndBug> err ( "command<S2SV_blank>0x0e<S2SV_blank>transfer<S2SV_blank>failed." ) ; <S2SV_StartBug> obuf [ 0 ] = 0xe ; <S2SV_EndBug> <S2SV_StartBug> obuf [ 1 ] = 0x83 ; <S2SV_EndBug> <S2SV_StartBug> obuf [ 2 ] = 1 ; <S2SV_EndBug> <S2SV_StartBug> if ( dvb_usb_generic_rw ( d , obuf , 3 , ibuf , 1 , 0 ) < 0 ) <S2SV_EndBug> err ( "command<S2SV_blank>0x0e<S2SV_blank>transfer<S2SV_blank>failed." ) ; <S2SV_StartBug> obuf [ 0 ] = 0x51 ; <S2SV_EndBug> <S2SV_StartBug> if ( dvb_usb_generic_rw ( d , obuf , 1 , ibuf , 1 , 0 ) < 0 ) <S2SV_EndBug> <S2SV_StartBug> err ( "command<S2SV_blank>0x51<S2SV_blank>transfer<S2SV_blank>failed." ) ; <S2SV_EndBug> m88ds3103_pdata . clk = 27000000 ; m88ds3103_pdata . i2c_wr_max = 33 ; m88ds3103_pdata . ts_mode = M88DS3103_TS_CI ; m88ds3103_pdata . ts_clk = 16000 ; m88ds3103_pdata . ts_clk_pol = 0 ; m88ds3103_pdata . spec_inv = 0 ; m88ds3103_pdata . agc = 0x99 ; m88ds3103_pdata . agc_inv = 0 ; m88ds3103_pdata . clk_out = M88DS3103_CLOCK_OUT_ENABLED ; m88ds3103_pdata . envelope_mode = 0 ; m88ds3103_pdata . lnb_hv_pol = 1 ; m88ds3103_pdata . lnb_en_pol = 0 ; memset ( & board_info , 0 , sizeof ( board_info ) ) ; strlcpy ( board_info . type , "m88ds3103" , I2C_NAME_SIZE ) ; board_info . addr = 0x68 ; board_info . platform_data = & m88ds3103_pdata ; request_module ( "m88ds3103" ) ; client = i2c_new_device ( & d -> i2c_adap , & board_info ) ; if ( client == NULL || client -> dev . driver == NULL ) return - ENODEV ; if ( ! try_module_get ( client -> dev . driver -> owner ) ) { i2c_unregister_device ( client ) ; return - ENODEV ; } adap -> fe_adap [ 0 ] . fe = m88ds3103_pdata . get_dvb_frontend ( client ) ; i2c_adapter = m88ds3103_pdata . get_i2c_adapter ( client ) ; state -> i2c_client_demod = client ; ts2020_config . fe = adap -> fe_adap [ 0 ] . fe ; memset ( & board_info , 0 , sizeof ( board_info ) ) ; strlcpy ( board_info . type , "ts2022" , I2C_NAME_SIZE ) ; board_info . addr = 0x60 ; board_info . platform_data = & ts2020_config ; request_module ( "ts2020" ) ; client = i2c_new_device ( i2c_adapter , & board_info ) ; if ( client == NULL || client -> dev . driver == NULL ) { dvb_frontend_detach ( adap -> fe_adap [ 0 ] . fe ) ; return - ENODEV ; } if ( ! try_module_get ( client -> dev . driver -> owner ) ) { i2c_unregister_device ( client ) ; dvb_frontend_detach ( adap -> fe_adap [ 0 ] . fe ) ; return - ENODEV ; } adap -> fe_adap [ 0 ] . fe -> ops . read_signal_strength = adap -> fe_adap [ 0 ] . fe -> ops . tuner_ops . get_rf_strength ; state -> i2c_client_tuner = client ; state -> fe_read_status = adap -> fe_adap [ 0 ] . fe -> ops . read_status ; adap -> fe_adap [ 0 ] . fe -> ops . read_status = tt_s2_4600_read_status ; state -> last_lock = 0 ; return 0 ; }
| <S2SV_ModStart> d -> priv <S2SV_ModEnd> ; struct i2c_adapter <S2SV_ModStart> { } ; mutex_lock ( & d -> data_mutex ) ; state -> data [ 0 ] = 0xe ; state -> data [ 1 ] = 0x80 ; state -> data [ 2 ] = 0x0 ; <S2SV_ModStart> ( d , state -> data <S2SV_ModEnd> , 3 , <S2SV_ModStart> , 3 , state -> data <S2SV_ModEnd> , 1 , <S2SV_ModStart> "command<S2SV_blank>0x0e<S2SV_blank>transfer<S2SV_blank>failed." ) ; state -> data <S2SV_ModEnd> [ 0 ] <S2SV_ModStart> = 0xe ; state -> data <S2SV_ModEnd> [ 1 ] <S2SV_ModStart> = 0x02 ; state -> data <S2SV_ModEnd> [ 2 ] <S2SV_ModStart> ( d , state -> data <S2SV_ModEnd> , 3 , <S2SV_ModStart> , 3 , state -> data <S2SV_ModEnd> , 1 , <S2SV_ModStart> 300 ) ; state -> data <S2SV_ModEnd> [ 0 ] <S2SV_ModStart> = 0xe ; state -> data <S2SV_ModEnd> [ 1 ] <S2SV_ModStart> = 0x83 ; state -> data <S2SV_ModEnd> [ 2 ] <S2SV_ModStart> ( d , state -> data <S2SV_ModEnd> , 3 , <S2SV_ModStart> , 3 , state -> data <S2SV_ModEnd> , 1 , <S2SV_ModStart> "command<S2SV_blank>0x0e<S2SV_blank>transfer<S2SV_blank>failed." ) ; state -> data <S2SV_ModEnd> [ 0 ] <S2SV_ModStart> = 0xe ; state -> data <S2SV_ModEnd> [ 1 ] <S2SV_ModStart> = 0x83 ; state -> data <S2SV_ModEnd> [ 2 ] <S2SV_ModStart> ( d , state -> data <S2SV_ModEnd> , 3 , <S2SV_ModStart> , 3 , state -> data <S2SV_ModEnd> , 1 , <S2SV_ModStart> "command<S2SV_blank>0x0e<S2SV_blank>transfer<S2SV_blank>failed." ) ; state -> data <S2SV_ModEnd> [ 0 ] <S2SV_ModStart> ( d , state -> data , 1 , state -> data <S2SV_ModEnd> , 1 , <S2SV_ModStart> err ( "command<S2SV_blank>0x51<S2SV_blank>transfer<S2SV_blank>failed." ) ; mutex_unlock ( & d -> data_mutex
| torvalds@linux/606142af57dad981b78707234cfbd15f9f7b7125 | CVE-2017-8062 | https://github.com/torvalds/linux/commit/606142af57dad981b78707234cfbd15f9f7b7125 | 2017-04-23T05:59Z |
88 | CWE-476 | CWE-476 static int nfc_llcp_build_gb ( struct nfc_llcp_local * local ) { <S2SV_StartBug> u8 * gb_cur , * version_tlv , version , version_length ; <S2SV_EndBug> u8 * lto_tlv , lto_length ; u8 * wks_tlv , wks_length ; u8 * miux_tlv , miux_length ; __be16 wks = cpu_to_be16 ( local -> local_wks ) ; u8 gb_len = 0 ; int ret = 0 ; version = LLCP_VERSION_11 ; version_tlv = nfc_llcp_build_tlv ( LLCP_TLV_VERSION , & version , 1 , & version_length ) ; <S2SV_StartBug> gb_len += version_length ; <S2SV_EndBug> lto_tlv = nfc_llcp_build_tlv ( LLCP_TLV_LTO , & local -> lto , 1 , & lto_length ) ; <S2SV_StartBug> gb_len += lto_length ; <S2SV_EndBug> pr_debug ( "Local<S2SV_blank>wks<S2SV_blank>0x%lx\\n" , local -> local_wks ) ; wks_tlv = nfc_llcp_build_tlv ( LLCP_TLV_WKS , ( u8 * ) & wks , 2 , & wks_length ) ; <S2SV_StartBug> gb_len += wks_length ; <S2SV_EndBug> miux_tlv = nfc_llcp_build_tlv ( LLCP_TLV_MIUX , ( u8 * ) & local -> miux , 0 , <S2SV_StartBug> & miux_length ) ; <S2SV_EndBug> gb_len += miux_length ; gb_len += ARRAY_SIZE ( llcp_magic ) ; if ( gb_len > NFC_MAX_GT_LEN ) { ret = - EINVAL ; goto out ; } gb_cur = local -> gb ; memcpy ( gb_cur , llcp_magic , ARRAY_SIZE ( llcp_magic ) ) ; gb_cur += ARRAY_SIZE ( llcp_magic ) ; memcpy ( gb_cur , version_tlv , version_length ) ; gb_cur += version_length ; memcpy ( gb_cur , lto_tlv , lto_length ) ; gb_cur += lto_length ; memcpy ( gb_cur , wks_tlv , wks_length ) ; gb_cur += wks_length ; memcpy ( gb_cur , miux_tlv , miux_length ) ; gb_cur += miux_length ; local -> gb_len = gb_len ; out : kfree ( version_tlv ) ; kfree ( lto_tlv ) ; kfree ( wks_tlv ) ; kfree ( miux_tlv ) ; return ret ; }
| <S2SV_ModStart> * gb_cur , version , version_length ; u8 lto_length , wks_length , miux_length ; u8 * version_tlv = NULL , * lto_tlv = NULL , * wks_tlv = NULL , * miux_tlv = NULL <S2SV_ModEnd> ; __be16 wks <S2SV_ModStart> version_length ) ; if ( ! version_tlv ) { ret = - ENOMEM ; goto out ; } <S2SV_ModStart> lto_length ) ; if ( ! lto_tlv ) { ret = - ENOMEM ; goto out ; } <S2SV_ModStart> wks_length ) ; if ( ! wks_tlv ) { ret = - ENOMEM ; goto out ; } <S2SV_ModStart> miux_length ) ; if ( ! miux_tlv ) { ret = - ENOMEM ; goto out ; }
| torvalds@linux/58bdd544e2933a21a51eecf17c3f5f94038261b5 | CVE-2019-12818 | https://github.com/torvalds/linux/commit/58bdd544e2933a21a51eecf17c3f5f94038261b5 | 2019-06-14T02:29Z |
89 | CWE-787 | CWE-787 static int next_state_class ( CClassNode * cc , OnigCodePoint * vs , enum CCVALTYPE * type , enum CCSTATE * state , ScanEnv * env ) { int r ; if ( * state == CCS_RANGE ) return ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE ; if ( * state == CCS_VALUE && * type != CCV_CLASS ) { if ( * type == CCV_SB ) BITSET_SET_BIT ( cc -> bs , ( int ) ( * vs ) ) ; else if ( * type == CCV_CODE_POINT ) { r = add_code_range ( & ( cc -> mbuf ) , env , * vs , * vs ) ; if ( r < 0 ) return r ; } } <S2SV_StartBug> * state = CCS_VALUE ; <S2SV_EndBug> * type = CCV_CLASS ; return 0 ; }
| <S2SV_ModStart> ; } } if ( * state != CCS_START )
| kkos@oniguruma/3b63d12038c8d8fc278e81c942fa9bec7c704c8b | CVE-2017-9228 | https://github.com/kkos/oniguruma/commit/3b63d12038c8d8fc278e81c942fa9bec7c704c8b | 2017-05-24T15:29Z |
90 | CWE-20 | CWE-20 static gboolean parse_toshiba_packet ( FILE_T fh , struct wtap_pkthdr * phdr , Buffer * buf , int * err , gchar * * err_info ) { union wtap_pseudo_header * pseudo_header = & phdr -> pseudo_header ; char line [ TOSHIBA_LINE_LENGTH ] ; int num_items_scanned ; <S2SV_StartBug> int pkt_len , pktnum , hr , min , sec , csec ; <S2SV_EndBug> char channel [ 10 ] , direction [ 10 ] ; int i , hex_lines ; guint8 * pd ; if ( file_gets ( line , TOSHIBA_LINE_LENGTH , fh ) == NULL ) { * err = file_error ( fh , err_info ) ; if ( * err == 0 ) { * err = WTAP_ERR_SHORT_READ ; } return FALSE ; } num_items_scanned = sscanf ( line , "%9d]<S2SV_blank>%2d:%2d:%2d.%9d<S2SV_blank>%9s<S2SV_blank>%9s" , & pktnum , & hr , & min , & sec , & csec , channel , direction ) ; if ( num_items_scanned != 7 ) { * err = WTAP_ERR_BAD_FILE ; * err_info = g_strdup ( "toshiba:<S2SV_blank>record<S2SV_blank>header<S2SV_blank>isn\'t<S2SV_blank>valid" ) ; return FALSE ; } do { if ( file_gets ( line , TOSHIBA_LINE_LENGTH , fh ) == NULL ) { * err = file_error ( fh , err_info ) ; if ( * err == 0 ) { * err = WTAP_ERR_SHORT_READ ; } return FALSE ; } line [ 16 ] = '\\0' ; } while ( strcmp ( line , "OFFSET<S2SV_blank>0001-0203" ) != 0 ) ; <S2SV_StartBug> num_items_scanned = sscanf ( line + 64 , "LEN=%9d" , & pkt_len ) ; <S2SV_EndBug> if ( num_items_scanned != 1 ) { * err = WTAP_ERR_BAD_FILE ; * err_info = g_strdup ( "toshiba:<S2SV_blank>OFFSET<S2SV_blank>line<S2SV_blank>doesn\'t<S2SV_blank>have<S2SV_blank>valid<S2SV_blank>LEN<S2SV_blank>item" ) ; return FALSE ; } <S2SV_StartBug> phdr -> rec_type = REC_TYPE_PACKET ; <S2SV_EndBug> phdr -> presence_flags = WTAP_HAS_TS | WTAP_HAS_CAP_LEN ; phdr -> ts . secs = hr * 3600 + min * 60 + sec ; phdr -> ts . nsecs = csec * 10000000 ; phdr -> caplen = pkt_len ; phdr -> len = pkt_len ; switch ( channel [ 0 ] ) { case 'B' : phdr -> pkt_encap = WTAP_ENCAP_ISDN ; pseudo_header -> isdn . uton = ( direction [ 0 ] == 'T' ) ; pseudo_header -> isdn . channel = ( guint8 ) strtol ( & channel [ 1 ] , NULL , 10 ) ; break ; case 'D' : phdr -> pkt_encap = WTAP_ENCAP_ISDN ; pseudo_header -> isdn . uton = ( direction [ 0 ] == 'T' ) ; pseudo_header -> isdn . channel = 0 ; break ; default : phdr -> pkt_encap = WTAP_ENCAP_ETHERNET ; pseudo_header -> eth . fcs_len = - 1 ; break ; } <S2SV_StartBug> ws_buffer_assure_space ( buf , TOSHIBA_MAX_PACKET_LEN ) ; <S2SV_EndBug> pd = ws_buffer_start_ptr ( buf ) ; hex_lines = pkt_len / 16 + ( ( pkt_len % 16 ) ? 1 : 0 ) ; for ( i = 0 ; i < hex_lines ; i ++ ) { if ( file_gets ( line , TOSHIBA_LINE_LENGTH , fh ) == NULL ) { * err = file_error ( fh , err_info ) ; if ( * err == 0 ) { * err = WTAP_ERR_SHORT_READ ; } return FALSE ; } if ( ! parse_single_hex_dump_line ( line , pd , i * 16 ) ) { * err = WTAP_ERR_BAD_FILE ; * err_info = g_strdup ( "toshiba:<S2SV_blank>hex<S2SV_blank>dump<S2SV_blank>not<S2SV_blank>valid" ) ; return FALSE ; } } return TRUE ; }
| <S2SV_ModStart> int num_items_scanned ; guint pkt_len ; int <S2SV_ModEnd> pktnum , hr <S2SV_ModStart> + 64 , "LEN=%9u" <S2SV_ModEnd> , & pkt_len <S2SV_ModStart> FALSE ; } if ( pkt_len > WTAP_MAX_PACKET_SIZE ) { * err = WTAP_ERR_BAD_FILE ; * err_info = g_strdup_printf ( "toshiba:<S2SV_blank>File<S2SV_blank>has<S2SV_blank>%u-byte<S2SV_blank>packet,<S2SV_blank>bigger<S2SV_blank>than<S2SV_blank>maximum<S2SV_blank>of<S2SV_blank>%u" , pkt_len , WTAP_MAX_PACKET_SIZE ) ; return FALSE ; } <S2SV_ModStart> ( buf , pkt_len <S2SV_ModEnd> ) ; pd
| wireshark@wireshark/5efb45231671baa2db2011d8f67f9d6e72bc455b | CVE-2016-5355 | https://github.com/wireshark/wireshark/commit/5efb45231671baa2db2011d8f67f9d6e72bc455b | 2016-08-07T16:59Z |
91 | CWE-399 | CWE-399 static int ceph_x_verify_authorizer_reply ( struct ceph_auth_client * ac , struct ceph_authorizer * a , size_t len ) { struct ceph_x_authorizer * au = ( void * ) a ; struct ceph_x_ticket_handler * th ; int ret = 0 ; struct ceph_x_authorize_reply reply ; <S2SV_StartBug> void * p = au -> reply_buf ; <S2SV_EndBug> void * end = p + sizeof ( au -> reply_buf ) ; th = get_ticket_handler ( ac , au -> service ) ; if ( IS_ERR ( th ) ) return PTR_ERR ( th ) ; <S2SV_StartBug> ret = ceph_x_decrypt ( & th -> session_key , & p , end , & reply , sizeof ( reply ) ) ; <S2SV_EndBug> if ( ret < 0 ) return ret ; if ( ret != sizeof ( reply ) ) return - EPERM ; if ( au -> nonce + 1 != le64_to_cpu ( reply . nonce_plus_one ) ) ret = - EPERM ; else ret = 0 ; dout ( "verify_authorizer_reply<S2SV_blank>nonce<S2SV_blank>%llx<S2SV_blank>got<S2SV_blank>%llx<S2SV_blank>ret<S2SV_blank>%d\\n" , au -> nonce , le64_to_cpu ( reply . nonce_plus_one ) , ret ) ; return ret ; }
| <S2SV_ModStart> ; void * preply = & reply ; void * <S2SV_ModStart> end , & preply <S2SV_ModEnd> , sizeof (
| torvalds@linux/c27a3e4d667fdcad3db7b104f75659478e0c68d8 | CVE-2014-6418 | https://github.com/torvalds/linux/commit/c27a3e4d667fdcad3db7b104f75659478e0c68d8 | 2014-09-28T10:55Z |
92 | CWE-119 | CWE-119 char * irc_ctcp_dcc_filename_without_quotes ( const char * filename ) { int length ; length = strlen ( filename ) ; <S2SV_StartBug> if ( length > 0 ) <S2SV_EndBug> { if ( ( filename [ 0 ] == \'\\"\' ) && ( filename [ length - 1 ] == \'\\"\' ) ) return weechat_strndup ( filename + 1 , length - 2 ) ; } return strdup ( filename ) ; }
| <S2SV_ModStart> ( length > 1 <S2SV_ModEnd> ) { if
| weechat@weechat/2fb346f25f79e412cf0ed314fdf791763c19b70b | CVE-2017-8073 | https://github.com/weechat/weechat/commit/2fb346f25f79e412cf0ed314fdf791763c19b70b | 2017-04-23T15:59Z |
93 | CWE-125 | CWE-125 static void handle_ppp ( netdissect_options * ndo , u_int proto , const u_char * p , int length ) { if ( ( proto & 0xff00 ) == 0x7e00 ) { ppp_hdlc ( ndo , p - 1 , length ) ; return ; } switch ( proto ) { case PPP_LCP : case PPP_IPCP : case PPP_OSICP : case PPP_MPLSCP : case PPP_IPV6CP : case PPP_CCP : case PPP_BACP : handle_ctrl_proto ( ndo , proto , p , length ) ; break ; case PPP_ML : handle_mlppp ( ndo , p , length ) ; break ; case PPP_CHAP : handle_chap ( ndo , p , length ) ; break ; case PPP_PAP : handle_pap ( ndo , p , length ) ; break ; case PPP_BAP : handle_bap ( ndo , p , length ) ; break ; case ETHERTYPE_IP : case PPP_VJNC : case PPP_IP : ip_print ( ndo , p , length ) ; break ; case ETHERTYPE_IPV6 : case PPP_IPV6 : ip6_print ( ndo , p , length ) ; break ; case ETHERTYPE_IPX : case PPP_IPX : ipx_print ( ndo , p , length ) ; break ; case PPP_OSI : <S2SV_StartBug> isoclns_print ( ndo , p , length , length ) ; <S2SV_EndBug> break ; case PPP_MPLS_UCAST : case PPP_MPLS_MCAST : mpls_print ( ndo , p , length ) ; break ; case PPP_COMP : ND_PRINT ( ( ndo , "compressed<S2SV_blank>PPP<S2SV_blank>data" ) ) ; break ; default : ND_PRINT ( ( ndo , "%s<S2SV_blank>" , tok2str ( ppptype2str , "unknown<S2SV_blank>PPP<S2SV_blank>protocol<S2SV_blank>(0x%04x)" , proto ) ) ) ; print_unknown_data ( ndo , p , "\\n\\t" , length ) ; break ; } }
| <S2SV_ModStart> p , length <S2SV_ModEnd> ) ; break
| the-tcpdump-group@tcpdump/1dcd10aceabbc03bf571ea32b892c522cbe923de | CVE-2017-12897 | https://github.com/the-tcpdump-group/tcpdump/commit/1dcd10aceabbc03bf571ea32b892c522cbe923de | 2017-09-14T06:29Z |
94 | CWE-000 | CWE-000 static void * bpf_any_get ( void * raw , enum bpf_type type ) { switch ( type ) { case BPF_TYPE_PROG : <S2SV_StartBug> atomic_inc ( & ( ( struct bpf_prog * ) raw ) -> aux -> refcnt ) ; <S2SV_EndBug> break ; case BPF_TYPE_MAP : <S2SV_StartBug> bpf_map_inc ( raw , true ) ; <S2SV_EndBug> break ; default : WARN_ON_ONCE ( 1 ) ; break ; } return raw ; }
| <S2SV_ModStart> case BPF_TYPE_PROG : raw = bpf_prog_inc ( raw <S2SV_ModEnd> ) ; break <S2SV_ModStart> case BPF_TYPE_MAP : raw =
| torvalds@linux/92117d8443bc5afacc8d5ba82e541946310f106e | CVE-2016-4558 | https://github.com/torvalds/linux/commit/92117d8443bc5afacc8d5ba82e541946310f106e | 2016-05-23T10:59Z |
95 | CWE-59 | CWE-59 static bool dump_fd_info ( const char * dest_filename , char * source_filename , int source_base_ofs , uid_t uid , gid_t gid ) { <S2SV_StartBug> FILE * fp = fopen ( dest_filename , "w" ) ; <S2SV_EndBug> if ( ! fp ) return false ; unsigned fd = 0 ; while ( fd <= 99999 ) { sprintf ( source_filename + source_base_ofs , "fd/%u" , fd ) ; char * name = malloc_readlink ( source_filename ) ; if ( ! name ) break ; fprintf ( fp , "%u:%s\\n" , fd , name ) ; free ( name ) ; sprintf ( source_filename + source_base_ofs , "fdinfo/%u" , fd ) ; fd ++ ; FILE * in = fopen ( source_filename , "r" ) ; if ( ! in ) continue ; char buf [ 128 ] ; while ( fgets ( buf , sizeof ( buf ) - 1 , in ) ) { char * eol = strchrnul ( buf , '\\n' ) ; eol [ 0 ] = '\\n' ; eol [ 1 ] = '\\0' ; fputs ( buf , fp ) ; } fclose ( in ) ; } const int dest_fd = fileno ( fp ) ; if ( fchown ( dest_fd , uid , gid ) < 0 ) { perror_msg ( "Can\'t<S2SV_blank>change<S2SV_blank>\'%s\'<S2SV_blank>ownership<S2SV_blank>to<S2SV_blank>%lu:%lu" , dest_filename , ( long ) uid , ( long ) gid ) ; fclose ( fp ) ; unlink ( dest_filename ) ; return false ; } fclose ( fp ) ; return true ; }
| <S2SV_ModStart> ( dest_filename , "wx" <S2SV_ModEnd> ) ; if
| abrt@abrt/d6e2f6f128cef4c21cb80941ae674c9842681aa7 | CVE-2015-3315 | https://github.com/abrt/abrt/commit/d6e2f6f128cef4c21cb80941ae674c9842681aa7 | 2017-06-26T15:29Z |
96 | CWE-119 | CWE-119 <S2SV_StartBug> static void predict_and_reconstruct_intra_block ( int plane , int block , <S2SV_EndBug> BLOCK_SIZE plane_bsize , <S2SV_StartBug> TX_SIZE tx_size , void * arg ) { <S2SV_EndBug> struct intra_args * const args = ( struct intra_args * ) arg ; VP9_COMMON * const cm = args -> cm ; MACROBLOCKD * const xd = args -> xd ; struct macroblockd_plane * const pd = & xd -> plane [ plane ] ; <S2SV_StartBug> MODE_INFO * const mi = xd -> mi [ 0 ] ; <S2SV_EndBug> <S2SV_StartBug> const MB_PREDICTION_MODE mode = ( plane == 0 ) ? get_y_mode ( mi , block ) <S2SV_EndBug> : mi -> mbmi . uv_mode ; int x , y ; uint8_t * dst ; <S2SV_StartBug> txfrm_block_to_raster_xy ( plane_bsize , tx_size , block , & x , & y ) ; <S2SV_EndBug> <S2SV_StartBug> dst = & pd -> dst . buf [ 4 * y * pd -> dst . stride + 4 * x ] ; <S2SV_EndBug> <S2SV_StartBug> vp9_predict_intra_block ( xd , block >> ( tx_size << 1 ) , <S2SV_EndBug> b_width_log2 ( plane_bsize ) , tx_size , mode , dst , pd -> dst . stride , dst , pd -> dst . stride , x , y , plane ) ; <S2SV_StartBug> if ( ! mi -> mbmi . skip ) { <S2SV_EndBug> <S2SV_StartBug> const int eob = vp9_decode_block_tokens ( cm , xd , plane , block , <S2SV_EndBug> plane_bsize , x , y , tx_size , args -> r ) ; inverse_transform_block ( xd , plane , block , tx_size , dst , pd -> dst . stride , eob ) ; } }
| <S2SV_ModStart> void predict_and_reconstruct_intra_block ( MACROBLOCKD * const xd , vpx_reader * r , MB_MODE_INFO * const mbmi , int plane , int row , int col <S2SV_ModEnd> , TX_SIZE tx_size <S2SV_ModStart> , TX_SIZE tx_size ) { <S2SV_ModEnd> struct macroblockd_plane * <S2SV_ModStart> plane ] ; PREDICTION_MODE <S2SV_ModEnd> mode = ( <S2SV_ModStart> 0 ) ? mbmi -> mode : mbmi -> uv_mode ; <S2SV_ModEnd> uint8_t * dst <S2SV_ModStart> * dst ; <S2SV_ModEnd> dst = & <S2SV_ModStart> [ 4 * row <S2SV_ModEnd> * pd -> <S2SV_ModStart> + 4 * col ] ; if ( mbmi -> sb_type < BLOCK_8X8 ) if ( plane == 0 ) mode = xd -> mi [ 0 ] -> bmi [ ( row <S2SV_ModEnd> << 1 ) <S2SV_ModStart> << 1 ) + col ] . as_mode ; vp9_predict_intra_block ( xd , pd -> n4_wl , tx_size , mode , dst , pd -> dst . stride , dst , pd -> dst . stride , col , row <S2SV_ModEnd> , plane ) <S2SV_ModStart> if ( ! mbmi -> <S2SV_ModEnd> skip ) { <S2SV_ModStart> ) { const TX_TYPE tx_type = ( plane || xd -> lossless ) ? DCT_DCT : intra_mode_to_tx_type_lookup [ mode ] ; const scan_order * sc = ( plane || xd -> lossless ) ? & vp9_default_scan_orders [ tx_size ] : & vp9_scan_orders [ tx_size ] [ tx_type ] ; const <S2SV_ModStart> = vp9_decode_block_tokens ( xd , plane , sc , col , row , tx_size , r , mbmi -> segment_id ) ; inverse_transform_block_intra ( xd , plane , tx_type , tx_size , dst , pd -> dst . stride , <S2SV_ModEnd> eob ) ;
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
97 | CWE-476 | CWE-476 static int forward_search_range ( regex_t * reg , const UChar * str , const UChar * end , UChar * s , UChar * range , UChar * * low , UChar * * high , UChar * * low_prev ) { UChar * p , * pprev = ( UChar * ) NULL ; # ifdef ONIG_DEBUG_SEARCH fprintf ( stderr , "forward_search_range:<S2SV_blank>str:<S2SV_blank>%d,<S2SV_blank>end:<S2SV_blank>%d,<S2SV_blank>s:<S2SV_blank>%d,<S2SV_blank>range:<S2SV_blank>%d\\n" , ( int ) str , ( int ) end , ( int ) s , ( int ) range ) ; # endif p = s ; if ( reg -> dmin > 0 ) { if ( ONIGENC_IS_SINGLEBYTE ( reg -> enc ) ) { p += reg -> dmin ; } else { UChar * q = p + reg -> dmin ; if ( q >= end ) return 0 ; while ( p < q ) p += enclen ( reg -> enc , p ) ; } } retry : switch ( reg -> optimize ) { case ONIG_OPTIMIZE_EXACT : p = slow_search ( reg -> enc , reg -> exact , reg -> exact_end , p , end , range ) ; break ; case ONIG_OPTIMIZE_EXACT_IC : p = slow_search_ic ( reg -> enc , reg -> case_fold_flag , reg -> exact , reg -> exact_end , p , end , range ) ; break ; case ONIG_OPTIMIZE_EXACT_BM : p = bm_search ( reg , reg -> exact , reg -> exact_end , p , end , range ) ; break ; case ONIG_OPTIMIZE_EXACT_BM_NOT_REV : p = bm_search_notrev ( reg , reg -> exact , reg -> exact_end , p , end , range ) ; break ; case ONIG_OPTIMIZE_MAP : p = map_search ( reg -> enc , reg -> map , p , range ) ; break ; } if ( p && p < range ) { if ( p - reg -> dmin < s ) { retry_gate : pprev = p ; p += enclen ( reg -> enc , p ) ; goto retry ; } if ( reg -> sub_anchor ) { UChar * prev ; switch ( reg -> sub_anchor ) { case ANCHOR_BEGIN_LINE : if ( ! ON_STR_BEGIN ( p ) ) { prev = onigenc_get_prev_char_head ( reg -> enc , ( pprev ? pprev : str ) , p ) ; if ( ! ONIGENC_IS_MBC_NEWLINE ( reg -> enc , prev , end ) ) goto retry_gate ; } break ; case ANCHOR_END_LINE : if ( ON_STR_END ( p ) ) { # ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE prev = ( UChar * ) onigenc_get_prev_char_head ( reg -> enc , ( pprev ? pprev : str ) , p ) ; if ( prev && ONIGENC_IS_MBC_NEWLINE ( reg -> enc , prev , end ) ) goto retry_gate ; # endif } else if ( ! ONIGENC_IS_MBC_NEWLINE ( reg -> enc , p , end ) # ifdef USE_CRNL_AS_LINE_TERMINATOR && ! ONIGENC_IS_MBC_CRNL ( reg -> enc , p , end ) # endif ) goto retry_gate ; break ; } } if ( reg -> dmax == 0 ) { * low = p ; if ( low_prev ) { if ( * low > s ) * low_prev = onigenc_get_prev_char_head ( reg -> enc , s , p ) ; else * low_prev = onigenc_get_prev_char_head ( reg -> enc , ( pprev ? pprev : str ) , p ) ; } } else { if ( reg -> dmax != ONIG_INFINITE_DISTANCE ) { <S2SV_StartBug> * low = p - reg -> dmax ; <S2SV_EndBug> if ( * low > s ) { * low = onigenc_get_right_adjust_char_head_with_prev ( reg -> enc , s , * low , ( const UChar * * ) low_prev ) ; if ( low_prev && IS_NULL ( * low_prev ) ) * low_prev = onigenc_get_prev_char_head ( reg -> enc , ( pprev ? pprev : s ) , * low ) ; } else { if ( low_prev ) * low_prev = onigenc_get_prev_char_head ( reg -> enc , <S2SV_StartBug> ( pprev ? pprev : str ) , * low ) ; <S2SV_EndBug> } } } * high = p - reg -> dmin ; # ifdef ONIG_DEBUG_SEARCH fprintf ( stderr , "forward_search_range<S2SV_blank>success:<S2SV_blank>low:<S2SV_blank>%d,<S2SV_blank>high:<S2SV_blank>%d,<S2SV_blank>dmin:<S2SV_blank>%d,<S2SV_blank>dmax:<S2SV_blank>%d\\n" , ( int ) ( * low - str ) , ( int ) ( * high - str ) , reg -> dmin , reg -> dmax ) ; # endif return 1 ; } return 0 ; }
| <S2SV_ModStart> ONIG_INFINITE_DISTANCE ) { if ( p - str < reg -> dmax ) { * low = ( UChar * ) str ; if ( low_prev ) * low_prev = onigenc_get_prev_char_head ( reg -> enc , str , * low ) ; } else { <S2SV_ModStart> low ) ; }
| kkos@oniguruma/b690371bbf97794b4a1d3f295d4fb9a8b05d402d | CVE-2017-9229 | https://github.com/kkos/oniguruma/commit/b690371bbf97794b4a1d3f295d4fb9a8b05d402d | 2017-05-24T15:29Z |
98 | CWE-119 | CWE-119 void impeg2d_dec_hdr ( void * pv_dec , impeg2d_video_decode_ip_t * ps_ip , impeg2d_video_decode_op_t * ps_op ) { UWORD32 u4_bits_read ; dec_state_t * ps_dec ; ps_dec = ( dec_state_t * ) pv_dec ; ps_op -> s_ivd_video_decode_op_t . u4_error_code = 0 ; impeg2d_bit_stream_init ( & ( ps_dec -> s_bit_stream ) , ps_ip -> s_ivd_video_decode_ip_t . pv_stream_buffer , ps_ip -> s_ivd_video_decode_ip_t . u4_num_Bytes ) ; { { IMPEG2D_ERROR_CODES_T e_error ; e_error = impeg2d_process_video_header ( ps_dec ) ; if ( ( IMPEG2D_ERROR_CODES_T ) IVD_ERROR_NONE != e_error ) { ps_op -> s_ivd_video_decode_op_t . u4_error_code = e_error ; u4_bits_read = impeg2d_bit_stream_num_bits_read ( & ps_dec -> s_bit_stream ) ; ps_op -> s_ivd_video_decode_op_t . u4_num_bytes_consumed = u4_bits_read >> 3 ; if ( ps_op -> s_ivd_video_decode_op_t . u4_num_bytes_consumed > ps_ip -> s_ivd_video_decode_ip_t . u4_num_Bytes ) { ps_op -> s_ivd_video_decode_op_t . u4_num_bytes_consumed = ps_ip -> s_ivd_video_decode_ip_t . u4_num_Bytes ; } if ( ps_op -> s_ivd_video_decode_op_t . u4_error_code == 0 ) ps_op -> s_ivd_video_decode_op_t . u4_error_code = e_error ; <S2SV_StartBug> impeg2d_next_code ( ps_dec , SEQUENCE_HEADER_CODE ) ; <S2SV_EndBug> return ; } } ps_op -> s_ivd_video_decode_op_t . u4_pic_ht = ps_dec -> u2_vertical_size ; ps_op -> s_ivd_video_decode_op_t . u4_pic_wd = ps_dec -> u2_horizontal_size ; ps_op -> s_ivd_video_decode_op_t . e_pic_type = IV_NA_FRAME ; ps_op -> s_ivd_video_decode_op_t . u4_error_code = IV_SUCCESS ; u4_bits_read = impeg2d_bit_stream_num_bits_read ( & ps_dec -> s_bit_stream ) ; ps_op -> s_ivd_video_decode_op_t . u4_num_bytes_consumed = u4_bits_read >> 3 ; if ( ps_op -> s_ivd_video_decode_op_t . u4_num_bytes_consumed > ps_ip -> s_ivd_video_decode_ip_t . u4_num_Bytes ) { ps_op -> s_ivd_video_decode_op_t . u4_num_bytes_consumed = ps_ip -> s_ivd_video_decode_ip_t . u4_num_Bytes ; } ps_op -> s_ivd_video_decode_op_t . u4_frame_decoded_flag = 0 ; ps_dec -> u2_header_done = 1 ; } }
| <S2SV_ModStart> = e_error ; if ( IMPEG2D_UNSUPPORTED_DIMENSIONS == e_error ) { ps_op -> s_ivd_video_decode_op_t . u4_num_bytes_consumed = 0 ; ps_dec -> u2_header_done = 0 ; ps_op -> s_ivd_video_decode_op_t . u4_pic_ht = ps_dec -> u2_reinit_max_height ; ps_op -> s_ivd_video_decode_op_t . u4_pic_wd = ps_dec -> u2_reinit_max_width ; }
| external@libmpeg2/a86eb798d077b9b25c8f8c77e3c02c2f287c1ce7 | CVE-2017-0587 | https://android.googlesource.com/platform/external/libmpeg2/+/a86eb798d077b9b25c8f8c77e3c02c2f287c1ce7 | 2017-05-12T15:29Z |
99 | CWE-119 | CWE-119 static int filter_frame ( AVFilterLink * inlink , AVFrame * in ) { unsigned x , y ; AVFilterContext * ctx = inlink -> dst ; VignetteContext * s = ctx -> priv ; AVFilterLink * outlink = inlink -> dst -> outputs [ 0 ] ; AVFrame * out ; out = ff_get_video_buffer ( outlink , outlink -> w , outlink -> h ) ; if ( ! out ) { av_frame_free ( & in ) ; return AVERROR ( ENOMEM ) ; } av_frame_copy_props ( out , in ) ; if ( s -> eval_mode == EVAL_MODE_FRAME ) update_context ( s , inlink , in ) ; if ( s -> desc -> flags & AV_PIX_FMT_FLAG_RGB ) { uint8_t * dst = out -> data [ 0 ] ; const uint8_t * src = in -> data [ 0 ] ; const float * fmap = s -> fmap ; const int dst_linesize = out -> linesize [ 0 ] ; const int src_linesize = in -> linesize [ 0 ] ; const int fmap_linesize = s -> fmap_linesize ; for ( y = 0 ; y < inlink -> h ; y ++ ) { uint8_t * dstp = dst ; const uint8_t * srcp = src ; for ( x = 0 ; x < inlink -> w ; x ++ , dstp += 3 , srcp += 3 ) { const float f = fmap [ x ] ; dstp [ 0 ] = av_clip_uint8 ( srcp [ 0 ] * f + get_dither_value ( s ) ) ; dstp [ 1 ] = av_clip_uint8 ( srcp [ 1 ] * f + get_dither_value ( s ) ) ; dstp [ 2 ] = av_clip_uint8 ( srcp [ 2 ] * f + get_dither_value ( s ) ) ; } dst += dst_linesize ; src += src_linesize ; fmap += fmap_linesize ; } } else { int plane ; <S2SV_StartBug> for ( plane = 0 ; plane < 4 && in -> data [ plane ] ; plane ++ ) { <S2SV_EndBug> uint8_t * dst = out -> data [ plane ] ; const uint8_t * src = in -> data [ plane ] ; const float * fmap = s -> fmap ; const int dst_linesize = out -> linesize [ plane ] ; const int src_linesize = in -> linesize [ plane ] ; const int fmap_linesize = s -> fmap_linesize ; const int chroma = plane == 1 || plane == 2 ; const int hsub = chroma ? s -> desc -> log2_chroma_w : 0 ; const int vsub = chroma ? s -> desc -> log2_chroma_h : 0 ; const int w = FF_CEIL_RSHIFT ( inlink -> w , hsub ) ; const int h = FF_CEIL_RSHIFT ( inlink -> h , vsub ) ; for ( y = 0 ; y < h ; y ++ ) { uint8_t * dstp = dst ; const uint8_t * srcp = src ; for ( x = 0 ; x < w ; x ++ ) { const double dv = get_dither_value ( s ) ; if ( chroma ) * dstp ++ = av_clip_uint8 ( fmap [ x << hsub ] * ( * srcp ++ - 127 ) + 127 + dv ) ; else * dstp ++ = av_clip_uint8 ( fmap [ x ] * * srcp ++ + dv ) ; } dst += dst_linesize ; src += src_linesize ; fmap += fmap_linesize << vsub ; } } } return ff_filter_frame ( outlink , out ) ; }
| <S2SV_ModStart> in -> data [ plane ] && in -> linesize
| FFmpeg@FFmpeg/e43a0a232dbf6d3c161823c2e07c52e76227a1bc | CVE-2013-4263 | https://github.com/FFmpeg/FFmpeg/commit/e43a0a232dbf6d3c161823c2e07c52e76227a1bc | 2013-11-23T17:55Z |