func
stringlengths 181
23.6k
| path
stringlengths 12
123
| source
stringclasses 2
values | label
int64 0
40
|
---|---|---|---|
static void PgstatCollectorMain(int argc,char *argv[]) int len ; int wr ; last_statrequest = GetCurrentTimestamp ( ); last_statwrite = last_statrequest - 1; if ( need_exit ) while ( ! need_exit ) if ( last_statwrite < last_statrequest ) pgstat_write_statsfile ( ( ( bool ) 0 ) ); len = ( recv ( pgStatSock , ( ( char * ) ( & msg ) ) , sizeof ( PgStat_Msg ) , 0 ) ); if ( len < 0 ) if ( * __errno_location ( ) == 11 || * __errno_location ( ) == 11 || * __errno_location ( ) == 4 ) wr = WaitLatchOrSocket ( ( & pgStatLatch ) , 1 << 0 | 1 << 4 | 1 << 1 , pgStatSock , - 1L ); if ( wr & 1 << 4 ) static void pgstat_write_statsfile(bool permanent) FILE * fpout ; int32 format_id ; const char * tmpfile = ( permanent ? "global/pgstat.tmp" : pgstat_stat_tmpname ) ; int rc ; fpout = AllocateFile ( tmpfile , "w" ); if ( fpout == ( ( void * ) 0 ) ) format_id = 0x01A5BC9A; rc = ( fwrite ( ( & format_id ) , sizeof ( format_id ) , 1 , fpout ) ); | 149446/pgstat.c | SARD | 0 |
void CWE126_Buffer_Overread__CWE129_connect_socket_16_bad() while ( 1 ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = atoi ( inputBuffer ); while ( 0 ) if ( data >= 0 ) printIntLine ( buffer [ data ] ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); | 75613/CWE126_Buffer_Overread__CWE129_connect_socket_16.c | SARD | 3 |
static void goodB2G() char inputBuffer [ CHAR_ARRAY_SIZE ] = "" ; if ( fgets ( inputBuffer , CHAR_ARRAY_SIZE , stdin ) != NULL ) data = atoi ( inputBuffer ); CWE126_Buffer_Overread__CWE129_fgets_53b_goodB2GSink ( data ); void CWE126_Buffer_Overread__CWE129_fgets_53b_goodB2GSink(int data) CWE126_Buffer_Overread__CWE129_fgets_53c_goodB2GSink ( data ); void CWE126_Buffer_Overread__CWE129_fgets_53c_goodB2GSink(int data) CWE126_Buffer_Overread__CWE129_fgets_53d_goodB2GSink ( data ); void CWE126_Buffer_Overread__CWE129_fgets_53d_goodB2GSink(int data) if ( data >= 0 && data < ( 10 ) ) printIntLine ( buffer [ data ] ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); | 75677/CWE126_Buffer_Overread__CWE129_fgets_53a.c | SARD | 0 |
static void build_state_zero(struct dfa *d) d -> tralloc = 1; d -> trcount = 0; d -> realtrans = ( ( sizeof ( ( * d -> realtrans ) ) == 1 ? xzalloc ( ( d -> tralloc + 1 ) ) : xcalloc ( ( d -> tralloc + 1 ) , sizeof ( ( * d -> realtrans ) ) ) ) ); while ( 0 ) d -> trans = d -> realtrans + 1; d -> fails = ( ( sizeof ( ( * d -> fails ) ) == 1 ? xzalloc ( ( d -> tralloc ) ) : xcalloc ( ( d -> tralloc ) , sizeof ( ( * d -> fails ) ) ) ) ); while ( 0 ) d -> success = ( ( sizeof ( ( * d -> success ) ) == 1 ? xmalloc ( ( d -> tralloc ) ) : xnmalloc ( ( d -> tralloc ) , sizeof ( ( * d -> success ) ) ) ) ); while ( 0 ) d -> newlines = ( ( sizeof ( ( * d -> newlines ) ) == 1 ? xmalloc ( ( d -> tralloc ) ) : xnmalloc ( ( d -> tralloc ) , sizeof ( ( * d -> newlines ) ) ) ) ); while ( 0 ) build_state ( 0 , d ); static void build_state(state_num s,struct dfa *d) state_num * trans ; state_num i ; if ( d -> trcount >= 1024 ) for (i = 0; i < d -> tralloc; ++i) d -> trans [ i ] = d -> fails [ i ] = ( ( void * ) 0 ); d -> trcount = 0; d -> success [ s ] = 0; if ( ( ( ( 4 & 1 ? ( * d ) . states [ s ] . constraint & 0xf : 0 ) ) | ( ( 4 & 2 ? ( * d ) . states [ s ] . constraint >> 4 & 0xf : 0 ) ) | ( ( 4 & 4 ? ( * d ) . states [ s ] . constraint >> 8 & 0xf : 0 ) ) ) & d -> states [ s ] . context ) d -> success [ s ] |= 4; if ( ( ( ( 2 & 1 ? ( * d ) . states [ s ] . constraint & 0xf : 0 ) ) | ( ( 2 & 2 ? ( * d ) . states [ s ] . constraint >> 4 & 0xf : 0 ) ) | ( ( 2 & 4 ? ( * d ) . states [ s ] . constraint >> 8 & 0xf : 0 ) ) ) & d -> states [ s ] . context ) d -> success [ s ] |= 2; if ( ( ( ( 1 & 1 ? ( * d ) . states [ s ] . constraint & 0xf : 0 ) ) | ( ( 1 & 2 ? ( * d ) . states [ s ] . constraint >> 4 & 0xf : 0 ) ) | ( ( 1 & 4 ? ( * d ) . states [ s ] . constraint >> 8 & 0xf : 0 ) ) ) & d -> states [ s ] . context ) d -> success [ s ] |= 1; trans = ( ( sizeof ( ( * trans ) ) == 1 ? xmalloc ( ( 1 << 8 ) ) : xnmalloc ( ( 1 << 8 ) , sizeof ( ( * trans ) ) ) ) ); while ( 0 ) dfastate ( s , d , trans ); void dfastate(state_num s,struct dfa *d,token trans[]) leaf_set * grps ; charclass * labels ; size_t ngrps = 0 ; position pos ; charclass matches ; int matchesf ; charclass intersect ; int intersectf ; charclass leftovers ; int leftoversf ; position_set follows ; int possible_contexts ; int separate_contexts ; state_num state ; state_num state_letter ; size_t i ; size_t j ; size_t k ; grps = ( ( sizeof ( ( * grps ) ) == 1 ? xmalloc ( ( 1 << 8 ) ) : xnmalloc ( ( 1 << 8 ) , sizeof ( ( * grps ) ) ) ) ); while ( 0 ) labels = ( ( sizeof ( ( * labels ) ) == 1 ? xmalloc ( ( 1 << 8 ) ) : xnmalloc ( ( 1 << 8 ) , sizeof ( ( * labels ) ) ) ) ); while ( 0 ) for (i = 0; i < d -> states[s] . elems . nelem; ++i) pos = d -> states [ s ] . elems . elems [ i ]; if ( d -> tokens [ pos . index ] >= 0 && d -> tokens [ pos . index ] < ( 1 << 8 ) ) if ( d -> tokens [ pos . index ] >= CSET ) if ( pos . constraint != 0x777 ) if ( ! ( ( ( ( 4 & 1 ? pos . constraint & 0xf : 0 ) ) | ( ( 4 & 2 ? pos . constraint >> 4 & 0xf : 0 ) ) | ( ( 4 & 4 ? pos . constraint >> 8 & 0xf : 0 ) ) ) & d -> states [ s ] . context ) ) for (j = 0; j < ((1 << 8) + 8 * sizeof(int ) - 1) / (8 * sizeof(int )); ++j) matches [ j ] &= ~newline [ j ]; if ( ! ( ( ( ( 2 & 1 ? pos . constraint & 0xf : 0 ) ) | ( ( 2 & 2 ? pos . constraint >> 4 & 0xf : 0 ) ) | ( ( 2 & 4 ? pos . constraint >> 8 & 0xf : 0 ) ) ) & d -> states [ s ] . context ) ) for (j = 0; j < ((1 << 8) + 8 * sizeof(int ) - 1) / (8 * sizeof(int )); ++j) matches [ j ] &= ~letters [ j ]; if ( ! ( ( ( ( 1 & 1 ? pos . constraint & 0xf : 0 ) ) | ( ( 1 & 2 ? pos . constraint >> 4 & 0xf : 0 ) ) | ( ( 1 & 4 ? pos . constraint >> 8 & 0xf : 0 ) ) ) & d -> states [ s ] . context ) ) for (j = 0; j < ((1 << 8) + 8 * sizeof(int ) - 1) / (8 * sizeof(int )); ++j) matches [ j ] &= letters [ j ] | newline [ j ]; if ( j == ( ( 1 << 8 ) + 8 * sizeof ( int ) - 1 ) / ( 8 * sizeof ( int ) ) ) for (j = 0; j < ngrps; ++j) if ( d -> tokens [ pos . index ] >= 0 && d -> tokens [ pos . index ] < ( 1 << 8 ) && ! tstbit ( d -> tokens [ pos . index ] , labels [ j ] ) ) intersectf = 0; for (k = 0; k < ((1 << 8) + 8 * sizeof(int ) - 1) / (8 * sizeof(int )); ++k) ( intersect [ k ] = matches [ k ] & labels [ j ] [ k ] ) ? ( intersectf = 1 ) : 0; if ( ! intersectf ) leftoversf = matchesf = 0; for (k = 0; k < ((1 << 8) + 8 * sizeof(int ) - 1) / (8 * sizeof(int )); ++k) int match = matches [ k ] ; int label = labels [ j ] [ k ] ; ( leftovers [ k ] = ~match & label ) ? ( leftoversf = 1 ) : 0; ( matches [ k ] = match & ~label ) ? ( matchesf = 1 ) : 0; if ( leftoversf ) grps [ ngrps ] . elems = ( ( sizeof ( ( * grps [ ngrps ] . elems ) ) == 1 ? xmalloc ( d -> nleaves ) : xnmalloc ( d -> nleaves , sizeof ( ( * grps [ ngrps ] . elems ) ) ) ) ); while ( 0 ) grps [ ngrps ] . nelem = grps [ j ] . nelem; grps [ j ] . elems [ grps [ j ] . nelem ++ ] = pos . index; if ( ! matchesf ) if ( j == ngrps ) grps [ ngrps ] . elems = ( ( sizeof ( ( * grps [ ngrps ] . elems ) ) == 1 ? xmalloc ( d -> nleaves ) : xnmalloc ( d -> nleaves , sizeof ( ( * grps [ ngrps ] . elems ) ) ) ) ); while ( 0 ) grps [ ngrps ] . nelem = 1; grps [ ngrps ] . elems [ 0 ] = pos . index; if ( d -> searchflag ) separate_contexts = state_separate_contexts ( ( & follows ) ); state = state_index ( d , ( & follows ) , separate_contexts ^ 7 ); if ( separate_contexts & 2 ) state_letter = state_index ( d , ( & follows ) , 2 ); state_letter = state; for (i = 0; i < (1 << 8); ++i) trans [ i ] = ( 1 && ( ( * __ctype_b_loc ( ) ) [ ( int ) i ] & ( ( unsigned short ) _ISalnum ) || i == '_' ) ? state_letter : state ); for (i = 0; i < (1 << 8); ++i) trans [ i ] = ( - 1 ); for (i = 0; i < ngrps; ++i) follows . nelem = 0; possible_contexts = charclass_context ( labels [ i ] ); separate_contexts = state_separate_contexts ( ( & follows ) ); if ( separate_contexts & possible_contexts & 2 ) state_letter = state_index ( d , ( & follows ) , 2 ); static state_num state_index(struct dfa *d,const position_set *s,int context) size_t hash = 0 ; state_num i ; state_num j ; for (i = 0; i < s -> nelem; ++i) hash ^= s -> elems [ i ] . index + s -> elems [ i ] . constraint; for (i = 0; i < d -> sindex; ++i) if ( hash != d -> states [ i ] . hash || s -> nelem != d -> states [ i ] . elems . nelem || context != d -> states [ i ] . context ) if ( j == s -> nelem ) if ( d -> salloc <= d -> sindex + 1 ) size_t new_n_alloc = ( d -> sindex + 1 + ( ! d -> states ) ) ; d -> states = ( x2nrealloc ( ( d -> states ) , & new_n_alloc , sizeof ( ( * d -> states ) ) ) ); d -> salloc = new_n_alloc; while ( 0 ) d -> states [ i ] . hash = hash; copy ( s , & d -> states [ i ] . elems ); | 152991/dfa.c | SARD | 0 |
void CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_w32_vsnprintf_12_bad() wchar_t * data ; wchar_t dataBuffer [ 100 ] = L "" data = dataBuffer; if ( globalReturnsTrueOrFalse ( ) ) int globalReturnsTrueOrFalse() return ( rand ( ) % 2 ) ; WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; size_t dataLen = wcslen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , ( char * ) ( data + dataLen ) , sizeof ( wchar_t ) * ( 100 - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) data [ dataLen + recvResult / sizeof ( wchar_t ) ] = L '\0' while ( 0 ) wcscpy ( data , L "fixedstringtest" ) if ( globalReturnsTrueOrFalse ( ) ) int globalReturnsTrueOrFalse() return ( rand ( ) % 2 ) ; badVaSinkB ( data , data ); static void badVaSinkB(wchar_t * data, ...) wchar_t dest [ 100 ] = L "" va_list args ; _vsnwprintf ( dest , 100 - 1 , data , args ); | 81941/CWE134_Uncontrolled_Format_String__wchar_t_listen_socket_w32_vsnprintf_12.c | SARD | 15 |
void CWE427_Uncontrolled_Search_Path_Element__wchar_t_listen_socket_14_bad() wchar_t * data ; wchar_t dataBuffer [ 250 ] = L "PATH=" data = dataBuffer; if ( globalFive == 5 ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; size_t dataLen = wcslen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , ( char * ) ( data + dataLen ) , sizeof ( wchar_t ) * ( 250 - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) while ( 0 ) if ( listenSocket != INVALID_SOCKET ) CLOSE_SOCKET ( listenSocket ); if ( acceptSocket != INVALID_SOCKET ) CLOSE_SOCKET ( acceptSocket ); | 103301/CWE427_Uncontrolled_Search_Path_Element__wchar_t_listen_socket_14.c | SARD | 0 |
static CVE_2015_1158_PATCHED_print_job(cupsd_client_t *con, /* I - Client connection ipp_attribute_t *uri) /* I - Printer URI */ ipp_attribute_t * attr ; ipp_attribute_t * format ; const char * default_format ; char super [ MIME_MAX_SUPER ] , type [ MIME_MAX_TYPE ] , mimetype [ MIME_MAX_SUPER + MIME_MAX_TYPE + 2 ] ; cupsd_printer_t * printer ; if ( ( attr = ippFindAttribute ( con -> request , "compression" , IPP_TAG_KEYWORD ) ) != NULL ) if ( ! con -> filename ) if ( ! cupsdValidateDest ( uri -> values [ 0 ] . string . text , NULL , & printer ) ) if ( ( format = ippFindAttribute ( con -> request , "document-format" , IPP_TAG_MIMETYPE ) ) != NULL ) if ( ( default_format = cupsGetOption ( "document-format" , printer -> num_options , printer -> options ) ) != NULL ) if ( sscanf ( default_format , "%15[^/]/%255[^;]" , super , type ) != 2 ) if ( ! strcmp ( super , "application" ) && ! strcmp ( type , "octet-stream" ) ) filetype = mimeType ( MimeDatabase , super , type ); cupsdLogMessage ( CUPSD_LOG_INFO , "[Job ???] Request file type is %s/%s." , filetype -> super , filetype -> type ); filetype = mimeType ( MimeDatabase , super , type ); if ( filetype && ( ! format || ( ! strcmp ( super , "application" ) && ! strcmp ( type , "octet-stream" ) ) ) ) snprintf ( mimetype , sizeof ( mimetype ) , "%s/%s" , filetype -> super , filetype -> type ); ippSetString ( con -> request , & format , 0 , mimetype ); ippAddString ( con -> request , IPP_TAG_JOB , IPP_TAG_MIMETYPE , "document-format" , NULL , mimetype ); if ( ! filetype ) if ( ! _cups_strcasecmp ( filetype -> super , "application" ) && ( ! _cups_strcasecmp ( filetype -> type , "postscript" ) || ! _cups_strcasecmp ( filetype -> type , "pdf" ) ) ) if ( ( job = add_job ( con , printer , filetype ) ) == NULL ) cupsdUpdateQuota ( printer , job -> username , 0 , kbytes ); job -> koctets += kbytes; if ( ( attr = ippFindAttribute ( job -> attrs , "job-k-octets" , IPP_TAG_INTEGER ) ) != NULL ) attr -> values [ 0 ] . integer += kbytes; if ( add_file ( con , job , filetype , compression ) ) snprintf ( filename , sizeof ( filename ) , "%s/d%05d-%03d" , RequestRoot , job -> id , job -> num_files ); rename ( con -> filename , filename ); if ( cupsdTimeoutJob ( job ) ) cupsdLogJob ( job , CUPSD_LOG_INFO , "File of type %s/%s queued by \"%s\"." , filetype -> super , filetype -> type , job -> username ); cupsdLogJob ( job , CUPSD_LOG_DEBUG , "hold_until=%d" , ( int ) job -> hold_until ); cupsdLogJob ( job , CUPSD_LOG_INFO , "Queued on \"%s\" by \"%s\"." , job -> dest , job -> username ); | CVE-2015-1158/CVE_2015_1158_PATCHED_print_job.c | NVD | 0 |
void bad() char * data ; char dataBuffer [ FILENAME_MAX ] = BASEPATH ; data = dataBuffer; WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; size_t dataLen = strlen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , ( char * ) ( data + dataLen ) , sizeof ( char ) * ( FILENAME_MAX - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) while ( 0 ) | 89620/CWE23_Relative_Path_Traversal__char_connect_socket_fopen_68a.cpp | SARD | 0 |
static brcmf_notify_connect_status(struct brcmf_if const struct brcmf_event_msg *e, void *data) struct brcmf_cfg80211_info * cfg = ifp -> drvr -> config ; struct net_device * ndev = ifp -> ndev ; if ( brcmf_is_apmode ( ifp -> vif ) ) static bool brcmf_is_apmode(struct brcmf_cfg80211_vif *vif) enum nl80211_iftype iftype ; iftype = vif -> wdev . iftype; return iftype == NL80211_IFTYPE_AP || iftype == NL80211_IFTYPE_P2P_GO ; err = brcmf_notify_connect_status_ap ( cfg , ndev , e , data ); static brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info struct net_device const struct brcmf_event_msg *e, void *data) u32 event = e -> event_code ; u32 reason = e -> reason ; struct station_info sinfo ; if ( event == BRCMF_E_LINK && reason == BRCMF_E_REASON_LINK_BSSCFG_DIS && ndev != cfg_to_ndev ( cfg ) ) if ( ( ( event == BRCMF_E_ASSOC_IND ) || ( event == BRCMF_E_REASSOC_IND ) ) && ( reason == BRCMF_E_STATUS_SUCCESS ) ) memset ( & sinfo , 0 , sizeof ( sinfo ) ); sinfo . assoc_req_ies = data; sinfo . assoc_req_ies_len = e -> datalen; sinfo . generation = generation; cfg80211_new_sta ( ndev , e -> addr , & sinfo , GFP_KERNEL ); | CVE-2016-8658/linux_kernel_4.7.4_CVE_2016_8658_drivers_net_wireless_broadcom_brcm80211_brcmfmac_cfg80211.c | NVD | 0 |
static void goodB2G() char * password ; char passwordBuffer [ 100 ] = "" ; password = passwordBuffer; size_t passwordLen = strlen ( password ) ; recvResult = recv ( acceptSocket , ( char * ) ( password + passwordLen ) , ( 100 - passwordLen - 1 ) * sizeof ( char ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) password [ passwordLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( password , '\r' ); if ( replace ) * replace = '\0'; replace = strchr ( password , '\n' ); if ( replace ) * replace = '\0'; payloadBytes = decodeHexChars ( payload , sizeof ( payload ) , password ); size_t decodeHexChars(unsigned char * bytes, size_t numBytes, const char * hex) while ( numWritten < numBytes && isxdigit ( hex [ 2 * numWritten ] ) && isxdigit ( hex [ 2 * numWritten + 1 ] ) ) sscanf ( & hex [ 2 * numWritten ] , "%02x" , & byte ); bytes [ numWritten ] = ( unsigned char ) byte; return numWritten ; SecureZeroMemory ( password , 100 * sizeof ( char ) ); memcpy ( password , payload , payloadBytes ); password [ payloadBytes / sizeof ( char ) ] = '\0'; if ( LogonUserA ( username , domain , password , LOGON32_LOGON_NETWORK , LOGON32_PROVIDER_DEFAULT , & pHandle ) != 0 ) | 94163/CWE319_Cleartext_Tx_Sensitive_Info__w32_char_listen_socket_18.c | SARD | 0 |
static void goodB2G2() char * password ; char passwordBuffer [ 100 ] = "" ; password = passwordBuffer; if ( 1 ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; size_t passwordLen = strlen ( password ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , ( char * ) ( password + passwordLen ) , ( 100 - passwordLen - 1 ) * sizeof ( char ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) password [ passwordLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( password , '\r' ); if ( replace ) * replace = '\0'; replace = strchr ( password , '\n' ); if ( replace ) * replace = '\0'; while ( 0 ) if ( listenSocket != INVALID_SOCKET ) closesocket ( listenSocket ); if ( acceptSocket != INVALID_SOCKET ) closesocket ( acceptSocket ); payloadBytes = decodeHexChars ( payload , sizeof ( payload ) , password ); size_t decodeHexChars(unsigned char * bytes, size_t numBytes, const char * hex) while ( numWritten < numBytes && isxdigit ( hex [ 2 * numWritten ] ) && isxdigit ( hex [ 2 * numWritten + 1 ] ) ) sscanf ( & hex [ 2 * numWritten ] , "%02x" , & byte ); bytes [ numWritten ] = ( unsigned char ) byte; return numWritten ; SecureZeroMemory ( password , 100 * sizeof ( char ) ); memcpy ( password , payload , payloadBytes ); password [ payloadBytes / sizeof ( char ) ] = '\0'; if ( LogonUserA ( username , domain , password , LOGON32_LOGON_NETWORK , LOGON32_PROVIDER_DEFAULT , & pHandle ) != 0 ) | 94147/CWE319_Cleartext_Tx_Sensitive_Info__w32_char_listen_socket_02.c | SARD | 0 |
static void goodB2G1() if ( STATIC_CONST_FIVE == 5 ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = atoi ( inputBuffer ); while ( 0 ) if ( data > INT_MIN ) int result = data - 1 ; printIntLine ( result ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); | 85619/CWE191_Integer_Underflow__int_listen_socket_sub_06.c | SARD | 0 |
static void goodB2G2() wchar_t * data ; wchar_t dataBuffer [ 100 ] = L "" data = dataBuffer; if ( staticTrue ) size_t dataLen = wcslen ( data ) ; FILE * pFile ; if ( 100 - dataLen > 1 ) pFile = fopen ( FILENAME , "r" ); if ( pFile != NULL ) fclose ( pFile ); | 81406/CWE134_Uncontrolled_Format_String__wchar_t_file_fprintf_05.c | SARD | 0 |
void parse_dir_colors() char * * arg ; char * * c ; char * colors ; char * s ; int i ; if ( Hflag ) if ( getenv ( "TERM" ) == ( ( void * ) 0 ) ) s = getenv ( "TREE_COLORS" ); if ( s == ( ( void * ) 0 ) ) s = getenv ( "LS_COLORS" ); if ( ( s == ( ( void * ) 0 ) || strlen ( s ) == 0 ) && force_color ) s = ":no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.bat=01;32:*.BAT=01;32:*.btm=01;32:*.BTM=01;32:*.cmd=01;32:*.CMD=01;32:*.com=01;32:*.COM=01;32:*.dll=01;32:*.DLL=01;32:*.exe=01;32:*.EXE=01;32:*.arj=01;31:*.bz2=01;31:*.deb=01;31:*.gz=01;31:*.lzh=01;31:*.rpm=01;31:*.tar=01;31:*.taz=01;31:*.tb2=01;31:*.tbz2=01;31:*.tbz=01;31:*.tgz=01;31:*.tz2=01;31:*.z=01;31:*.Z=01;31:*.zip=01;31:*.ZIP=01;31:*.zoo=01;31:*.asf=01;35:*.ASF=01;35:*.avi=01;35:*.AVI=01;35:*.bmp=01;35:*.BMP=01;35:*.flac=01;35:*.FLAC=01;35:*.gif=01;35:*.GIF=01;35:*.jpg=01;35:*.JPG=01;35:*.jpeg=01;35:*.JPEG=01;35:*.m2a=01;35:*.M2a=01;35:*.m2v=01;35:*.M2V=01;35:*.mov=01;35:*.MOV=01;35:*.mp3=01;35:*.MP3=01;35:*.mpeg=01;35:*.MPEG=01;35:*.mpg=01;35:*.MPG=01;35:*.ogg=01;35:*.OGG=01;35:*.ppm=01;35:*.rm=01;35:*.RM=01;35:*.tga=01;35:*.TGA=01;35:*.tif=01;35:*.TIF=01;35:*.wav=01;35:*.WAV=01;35:*.wmv=01;35:*.WMV=01;35:*.xbm=01;35:*.xpm=01;35:"; if ( s == ( ( void * ) 0 ) || ! force_color && ( nocolor || ! isatty ( 1 ) ) ) colors = strcpy ( ( xmalloc ( strlen ( s ) + 1 ) ) , s ); arg = split ( colors , ":" , & n ); char **split(char *str,char *delim,int *nwrds) int n = 128 ; char * * w = ( xmalloc ( sizeof ( char * ) * n ) ) ; w [ * nwrds = 0 ] = strtok ( str , delim ); while ( w [ * nwrds ] ) if ( * nwrds == n - 2 ) w = ( xrealloc ( w , sizeof ( char * ) * ( n += 256 ) ) ); w [ ++ * nwrds ] = strtok ( ( ( void * ) 0 ) , delim ); w [ * nwrds ] = ( ( void * ) 0 ); return w ; for (i = 0; arg[i]; i++) c = split ( arg [ i ] , "=" , & n ); char **split(char *str,char *delim,int *nwrds) int n = 128 ; char * * w = ( xmalloc ( sizeof ( char * ) * n ) ) ; w [ * nwrds = 0 ] = strtok ( str , delim ); while ( w [ * nwrds ] ) if ( * nwrds == n - 2 ) w = ( xrealloc ( w , sizeof ( char * ) * ( n += 256 ) ) ); w [ ++ * nwrds ] = strtok ( ( ( void * ) 0 ) , delim ); w [ * nwrds ] = ( ( void * ) 0 ); return w ; switch ( cmd ( c [ 0 ] ) ) int cmd(char *s) static struct { char * cmd ; char cmdnum ; } cmds [ ] = { { ( "no" ) , ( COL_NORMAL ) } , { ( "fi" ) , ( COL_FILE ) } , { ( "di" ) , ( COL_DIR ) } , { ( "ln" ) , ( COL_LINK ) } , { ( "pi" ) , ( COL_FIFO ) } , { ( "do" ) , ( COL_DOOR ) } , { ( "bd" ) , ( COL_BLK ) } , { ( "cd" ) , ( COL_CHR ) } , { ( "or" ) , ( COL_ORPHAN ) } , { ( "so" ) , ( COL_SOCK ) } , { ( "su" ) , ( COL_SETUID ) } , { ( "sg" ) , ( COL_SETGID ) } , { ( "tw" ) , ( COL_STICKY_OTHER_WRITABLE ) } , { ( "ow" ) , ( COL_OTHER_WRITABLE ) } , { ( "st" ) , ( COL_STICKY ) } , { ( "ex" ) , ( COL_EXEC ) } , { ( "mi" ) , ( COL_MISSING ) } , { ( "lc" ) , ( COL_LEFTCODE ) } , { ( "rc" ) , ( COL_RIGHTCODE ) } , { ( "ec" ) , ( COL_ENDCODE ) } , { ( ( ( void * ) 0 ) ) , ( 0 ) } } ; int i ; for (i = 0; cmds[i] . cmdnum; i++) if ( ! strcmp ( cmds [ i ] . cmd , s ) ) | 153751/color.c | SARD | 0 |
void bad() char * data ; char dataBuffer [ FILENAME_MAX ] = BASEPATH ; data = dataBuffer; WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; size_t dataLen = strlen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , ( char * ) ( data + dataLen ) , sizeof ( char ) * ( FILENAME_MAX - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) data [ dataLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( data , '\r' ); if ( replace ) * replace = '\0'; replace = strchr ( data , '\n' ); if ( replace ) * replace = '\0'; while ( 0 ) if ( listenSocket != INVALID_SOCKET ) CLOSE_SOCKET ( listenSocket ); if ( acceptSocket != INVALID_SOCKET ) CLOSE_SOCKET ( acceptSocket ); char * dataCopy = data ; char * data = dataCopy ; hFile = CreateFileA ( data , ( GENERIC_WRITE | GENERIC_READ ) , 0 , NULL , OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL ); if ( hFile != INVALID_HANDLE_VALUE ) CloseHandle ( hFile ); | 90752/CWE23_Relative_Path_Traversal__char_listen_socket_w32CreateFile_31.cpp | SARD | 4 |
void CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_memcpy_08_bad() char source [ 100 ] ; memset ( source , 'A' , 100 - 1 ); source [ 100 - 1 ] = '\0'; memcpy ( dest , source , data ); dest [ data ] = '\0'; printLine ( dest ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); | 88069/CWE195_Signed_to_Unsigned_Conversion_Error__listen_socket_memcpy_08.c | SARD | 20 |
static void good1() if ( GLOBAL_CONST_FIVE != 5 ) char * data = ( char * ) malloc ( 100 * sizeof ( char ) ) ; strcpy ( data , "A String" ); printLine ( data ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); tmpData = ( char * ) realloc ( data , ( 130000 ) * sizeof ( char ) ); if ( tmpData != NULL ) data = tmpData; strcpy ( data , "New String" ); printLine ( data ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); free ( data ); | 99646/CWE401_Memory_Leak__malloc_realloc_char_13.c | SARD | 0 |
static void goodB2G() long * data ; data = NULL; data = ( long * ) calloc ( 1 , sizeof ( long ) ); if ( globalReturnsTrueOrFalse ( ) ) int globalReturnsTrueOrFalse() return ( rand ( ) % 2 ) ; if ( data != NULL ) data [ 0 ] = 5L; if ( data != NULL ) data [ 0 ] = 5L; free ( data ); | 111469/CWE690_NULL_Deref_From_Return__long_calloc_12.c | SARD | 0 |
void CWE197_Numeric_Truncation_Error__int_connect_socket_to_char_11_bad() if ( globalReturnsTrue ( ) ) int globalReturnsTrue() return 1 ; WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = atoi ( inputBuffer ); while ( 0 ) if ( connectSocket != INVALID_SOCKET ) CLOSE_SOCKET ( connectSocket ); char charData = ( char ) data ; printHexCharLine ( charData ); void printHexCharLine (char charHex) printf ( "%02x\n" , charHex ); | 88618/CWE197_Numeric_Truncation_Error__int_connect_socket_to_char_11.c | SARD | 20 |
static void goodG2B1() char * data ; char dataBuffer [ FILENAME_MAX ] = "" ; data = dataBuffer; if ( globalReturnsFalse ( ) ) int globalReturnsFalse() return 0 ; strcat ( data , "c:\\temp\\file.txt" ); fileDesc = OPEN ( data , O_RDWR | O_CREAT , S_IREAD | S_IWRITE ); if ( fileDesc != - 1 ) CLOSE ( fileDesc ); | 95692/CWE36_Absolute_Path_Traversal__char_connect_socket_open_11.cpp | SARD | 0 |
static void goodG2B() int64_t * data ; data = NULL; data = ( int64_t * ) malloc ( 100 * sizeof ( int64_t ) ); CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_memmove_63b_goodG2BSink ( & data ); void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_memmove_63b_goodG2BSink(int64_t * * dataPtr) int64_t * data = * dataPtr ; int64_t source [ 100 ] = { 0 } ; memmove ( data , source , 100 * sizeof ( int64_t ) ); printLongLongLine ( data [ 0 ] ); void printLongLongLine (int64_t longLongIntNumber) printf ( "%lld\n" , longLongIntNumber ); free ( data ); | 71635/CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int64_t_memmove_63b.c | SARD | 0 |
void CWE78_OS_Command_Injection__char_listen_socket_execlp_21_bad() char * data ; char dataBuffer [ 100 ] = "" ; data = dataBuffer; data = badSource ( data ); static char * badSource(char * data) if ( badStatic ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char * replace ; size_t dataLen = strlen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , ( char * ) ( data + dataLen ) , sizeof ( char ) * ( 100 - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) data [ dataLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( data , '\n' ); if ( replace ) * replace = '\0'; while ( 0 ) | 119929/CWE78_OS_Command_Injection__char_listen_socket_execlp_21.c | SARD | 0 |
static enum XML_Error internalEntityProcessor(XML_Parser const char const char const char **nextPtr) ENTITY * entity ; const char * textStart , * textEnd ; const char * next ; enum XML_Error result ; OPEN_INTERNAL_ENTITY * openEntity = openInternalEntities ; if ( ! openEntity ) entity = openEntity -> entity; textStart = ( ( char * ) entity -> textPtr ) + entity -> processed; textEnd = ( char * ) ( entity -> textPtr + entity -> textLen ); if ( entity -> is_param ) int tok = XmlPrologTok ( internalEncoding , textStart , textEnd , & next ) ; result = doProlog ( parser , internalEncoding , textStart , textEnd , tok , next , & next , XML_FALSE ); static enum doProlog(XML_Parser const ENCODING const char const char int const char const char XML_Bool haveMore) static const XML_Char externalSubsetName [ ] = { '#' , '\0' } ; static const XML_Char atypeCDATA [ ] = { 'C' , 'D' , 'A' , 'T' , 'A' , '\0' } ; static const XML_Char atypeID [ ] = { 'I' , 'D' , '\0' } ; static const XML_Char atypeIDREF [ ] = { 'I' , 'D' , 'R' , 'E' , 'F' , '\0' } ; static const XML_Char atypeIDREFS [ ] = { 'I' , 'D' , 'R' , 'E' , 'F' , 'S' , '\0' } ; static const XML_Char atypeENTITY [ ] = { 'E' , 'N' , 'T' , 'I' , 'T' , 'Y' , '\0' } ; static const XML_Char atypeENTITIES [ ] = { 'E' , 'N' , 'T' , 'I' , 'T' , 'I' , 'E' , 'S' , '\0' } ; static const XML_Char atypeNMTOKEN [ ] = { 'N' , 'M' , 'T' , 'O' , 'K' , 'E' , 'N' , '\0' } ; static const XML_Char atypeNMTOKENS [ ] = { 'N' , 'M' , 'T' , 'O' , 'K' , 'E' , 'N' , 'S' , '\0' } ; static const XML_Char notationPrefix [ ] = { 'N' , 'O' , 'T' , 'A' , 'T' , 'I' , 'O' , 'N' , '(' , '\0' } ; static const XML_Char enumValueSep [ ] = { '|' , '\0' } ; static const XML_Char enumValueStart [ ] = { '(' , '\0' } ; DTD * const dtd = _dtd const char * * eventPP ; enum XML_Content_Quant quant ; if ( enc == encoding ) eventPP = & eventPtr; eventPP = & ( openInternalEntities -> internalEventPtr ); int role ; XML_Bool handleDefault = XML_TRUE ; * eventPP = s; if ( tok <= 0 ) if ( haveMore && tok != XML_TOK_INVALID ) switch ( tok ) * eventPP = next; if ( enc != encoding && ! openInternalEntities -> betweenDecl ) * nextPtr = s; if ( isParamEntity || enc != encoding ) if ( XmlTokenRole ( & prologState , XML_TOK_NONE , end , end , enc ) == XML_ROLE_ERROR ) * nextPtr = s; tok = - tok; next = end; role = XmlTokenRole ( & prologState , tok , s , next , enc ); switch ( role ) enum XML_Error result = processXmlDecl ( parser , 0 , s , next ) ; if ( result != XML_ERROR_NONE ) enc = encoding; handleDefault = XML_FALSE; if ( startDoctypeDeclHandler ) doctypeName = poolStoreString ( & tempPool , enc , s , next ); if ( ! doctypeName ) doctypePubid = NULL; handleDefault = XML_FALSE; doctypeSysid = NULL; if ( startDoctypeDeclHandler ) doctypeName = NULL; handleDefault = XML_FALSE; enum XML_Error result = processXmlDecl ( parser , 1 , s , next ) ; if ( result != XML_ERROR_NONE ) enc = encoding; handleDefault = XML_FALSE; useForeignDTD = XML_FALSE; declEntity = ( ENTITY * ) lookup ( & dtd -> paramEntities , externalSubsetName , sizeof ( ENTITY ) ); if ( ! declEntity ) dtd -> hasParamEntityRefs = XML_TRUE; if ( startDoctypeDeclHandler ) if ( ! XmlIsPublicId ( enc , s , next , eventPP ) ) doctypePubid = poolStoreString ( & tempPool , enc , s + enc -> minBytesPerChar , next - enc -> minBytesPerChar ); if ( ! doctypePubid ) if ( ! XmlIsPublicId ( enc , s , next , eventPP ) ) if ( dtd -> keepProcessing && declEntity ) XML_Char * tem = poolStoreString ( & dtd -> pool , enc , s + enc -> minBytesPerChar , next - enc -> minBytesPerChar ) ; if ( ! tem ) declEntity -> publicId = tem; if ( entityDeclHandler ) handleDefault = XML_FALSE; if ( doctypeName ) handleDefault = XML_FALSE; if ( doctypeSysid || useForeignDTD ) XML_Bool hadParamEntityRefs = dtd -> hasParamEntityRefs ; dtd -> hasParamEntityRefs = XML_TRUE; if ( paramEntityParsing && externalEntityRefHandler ) ENTITY * entity = ( ENTITY * ) lookup ( & dtd -> paramEntities , externalSubsetName , sizeof ( ENTITY ) ) ; if ( ! entity ) if ( useForeignDTD ) entity -> base = curBase; dtd -> paramEntityRead = XML_FALSE; if ( ! externalEntityRefHandler ( externalEntityRefHandlerArg , 0 , entity -> base , entity -> systemId , entity -> publicId ) ) if ( dtd -> paramEntityRead ) if ( ! dtd -> standalone && notStandaloneHandler && ! notStandaloneHandler ( handlerArg ) ) if ( ! doctypeSysid ) dtd -> hasParamEntityRefs = hadParamEntityRefs; useForeignDTD = XML_FALSE; if ( endDoctypeDeclHandler ) handleDefault = XML_FALSE; if ( useForeignDTD ) XML_Bool hadParamEntityRefs = dtd -> hasParamEntityRefs ; dtd -> hasParamEntityRefs = XML_TRUE; if ( paramEntityParsing && externalEntityRefHandler ) ENTITY * entity = ( ENTITY * ) lookup ( & dtd -> paramEntities , externalSubsetName , sizeof ( ENTITY ) ) ; if ( ! entity ) entity -> base = curBase; dtd -> paramEntityRead = XML_FALSE; if ( ! externalEntityRefHandler ( externalEntityRefHandlerArg , 0 , entity -> base , entity -> systemId , entity -> publicId ) ) if ( dtd -> paramEntityRead ) dtd -> hasParamEntityRefs = hadParamEntityRefs; declElementType = getElementType ( parser , enc , s , next ); if ( ! declElementType ) declAttributeId = getAttributeId ( parser , enc , s , next ); if ( ! declAttributeId ) declAttributeIsCdata = XML_FALSE; declAttributeType = NULL; declAttributeIsId = XML_FALSE; declAttributeIsCdata = XML_TRUE; declAttributeType = atypeCDATA; declAttributeIsId = XML_TRUE; declAttributeType = atypeID; declAttributeType = atypeIDREF; declAttributeType = atypeIDREFS; declAttributeType = atypeENTITY; declAttributeType = atypeENTITIES; declAttributeType = atypeNMTOKEN; declAttributeType = atypeNMTOKENS; if ( dtd -> keepProcessing && attlistDeclHandler ) handleDefault = XML_FALSE; if ( dtd -> keepProcessing && attlistDeclHandler ) const XML_Char * prefix ; if ( declAttributeType ) prefix = enumValueSep; prefix = ( role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE ? notationPrefix : enumValueStart ); if ( ! poolAppendString ( & tempPool , prefix ) ) if ( ! poolAppend ( & tempPool , enc , s , next ) ) declAttributeType = tempPool . start; handleDefault = XML_FALSE; if ( dtd -> keepProcessing ) if ( ! defineAttribute ( declElementType , declAttributeId , declAttributeIsCdata , declAttributeIsId , 0 , parser ) ) if ( attlistDeclHandler && declAttributeType ) if ( * declAttributeType == XML_T ( '(' ) || ( * declAttributeType == XML_T ( 'N' ) && declAttributeType [ 1 ] == XML_T ( 'O' ) ) ) if ( ! poolAppendChar ( & tempPool , XML_T ( ')' ) ) || ! poolAppendChar ( & tempPool , XML_T ( '\0' ) ) ) declAttributeType = tempPool . start; handleDefault = XML_FALSE; if ( dtd -> keepProcessing ) const XML_Char * attVal ; enum XML_Error result = storeAttributeValue ( parser , enc , declAttributeIsCdata , s + enc -> minBytesPerChar , next - enc -> minBytesPerChar , & dtd -> pool ) ; if ( result ) attVal = poolStart ( & dtd -> pool ); if ( ! defineAttribute ( declElementType , declAttributeId , declAttributeIsCdata , XML_FALSE , attVal , parser ) ) if ( attlistDeclHandler && declAttributeType ) if ( * declAttributeType == XML_T ( '(' ) || ( * declAttributeType == XML_T ( 'N' ) && declAttributeType [ 1 ] == XML_T ( 'O' ) ) ) if ( ! poolAppendChar ( & tempPool , XML_T ( ')' ) ) || ! poolAppendChar ( & tempPool , XML_T ( '\0' ) ) ) declAttributeType = tempPool . start; handleDefault = XML_FALSE; if ( dtd -> keepProcessing ) enum XML_Error result = storeEntityValue ( parser , enc , s + enc -> minBytesPerChar , next - enc -> minBytesPerChar ) ; if ( declEntity ) declEntity -> textPtr = poolStart ( & dtd -> entityValuePool ); declEntity -> textLen = ( int ) ( poolLength ( & dtd -> entityValuePool ) ); if ( result != XML_ERROR_NONE ) dtd -> hasParamEntityRefs = XML_TRUE; if ( startDoctypeDeclHandler ) doctypeSysid = poolStoreString ( & tempPool , enc , s + enc -> minBytesPerChar , next - enc -> minBytesPerChar ); if ( doctypeSysid == NULL ) handleDefault = XML_FALSE; && ! paramEntityParsing if ( dtd -> keepProcessing && declEntity ) declEntity -> systemId = poolStoreString ( & dtd -> pool , enc , s + enc -> minBytesPerChar , next - enc -> minBytesPerChar ); if ( ! declEntity -> systemId ) declEntity -> base = curBase; if ( entityDeclHandler ) handleDefault = XML_FALSE; if ( dtd -> keepProcessing && declEntity && entityDeclHandler ) handleDefault = XML_FALSE; if ( dtd -> keepProcessing && declEntity ) declEntity -> notation = poolStoreString ( & dtd -> pool , enc , s , next ); if ( ! declEntity -> notation ) if ( unparsedEntityDeclHandler ) handleDefault = XML_FALSE; if ( entityDeclHandler ) handleDefault = XML_FALSE; if ( XmlPredefinedEntityName ( enc , s , next ) ) declEntity = NULL; if ( dtd -> keepProcessing ) const XML_Char * name = poolStoreString ( & dtd -> pool , enc , s , next ) ; if ( ! name ) declEntity = ( ENTITY * ) lookup ( & dtd -> generalEntities , name , sizeof ( ENTITY ) ); if ( ! declEntity ) if ( declEntity -> name != name ) declEntity = NULL; declEntity -> publicId = NULL; declEntity -> is_param = XML_FALSE; declEntity -> is_internal = ! ( parentParser || openInternalEntities ); if ( entityDeclHandler ) handleDefault = XML_FALSE; declEntity = NULL; if ( dtd -> keepProcessing ) const XML_Char * name = poolStoreString ( & dtd -> pool , enc , s , next ) ; if ( ! name ) declEntity = ( ENTITY * ) lookup ( & dtd -> paramEntities , name , sizeof ( ENTITY ) ); if ( ! declEntity ) if ( declEntity -> name != name ) declEntity = NULL; declEntity -> publicId = NULL; declEntity -> is_param = XML_TRUE; declEntity -> is_internal = ! ( parentParser || openInternalEntities ); if ( entityDeclHandler ) handleDefault = XML_FALSE; declEntity = NULL; declNotationPublicId = NULL; declNotationName = NULL; if ( notationDeclHandler ) declNotationName = poolStoreString ( & tempPool , enc , s , next ); if ( ! declNotationName ) handleDefault = XML_FALSE; if ( ! XmlIsPublicId ( enc , s , next , eventPP ) ) if ( declNotationName ) XML_Char * tem = poolStoreString ( & tempPool , enc , s + enc -> minBytesPerChar , next - enc -> minBytesPerChar ) ; if ( ! tem ) declNotationPublicId = tem; handleDefault = XML_FALSE; if ( declNotationName && notationDeclHandler ) const XML_Char * systemId = poolStoreString ( & tempPool , enc , s + enc -> minBytesPerChar , next - enc -> minBytesPerChar ) ; if ( ! systemId ) handleDefault = XML_FALSE; if ( declNotationPublicId && notationDeclHandler ) handleDefault = XML_FALSE; enum XML_Error result ; handleDefault = XML_FALSE; result = doIgnoreSection ( parser , enc , & next , end , nextPtr , haveMore ); if ( result != XML_ERROR_NONE ) if ( ! next ) if ( prologState . level >= groupSize ) if ( groupSize ) char * temp = ( char * ) REALLOC ( groupConnector , groupSize *= 2 ) ; if ( temp == NULL ) groupConnector = temp; if ( dtd -> scaffIndex ) int * temp = ( int * ) REALLOC ( dtd -> scaffIndex , groupSize * sizeof ( int ) ) ; if ( temp == NULL ) dtd -> scaffIndex = temp; groupConnector = ( char * ) MALLOC ( groupSize = 32 ); if ( ! groupConnector ) groupConnector [ prologState . level ] = 0; if ( dtd -> in_eldecl ) int myindex = nextScaffoldPart ( parser ) ; if ( myindex < 0 ) dtd -> scaffIndex [ dtd -> scaffLevel ] = myindex; dtd -> scaffLevel ++; dtd -> scaffold [ myindex ] . type = XML_CTYPE_SEQ; if ( elementDeclHandler ) handleDefault = XML_FALSE; if ( groupConnector [ prologState . level ] == '|' ) groupConnector [ prologState . level ] = ','; if ( dtd -> in_eldecl && elementDeclHandler ) handleDefault = XML_FALSE; if ( groupConnector [ prologState . level ] == ',' ) if ( dtd -> in_eldecl && ! groupConnector [ prologState . level ] && ( dtd -> scaffold [ dtd -> scaffIndex [ dtd -> scaffLevel - 1 ] ] . type != XML_CTYPE_MIXED ) ) dtd -> scaffold [ dtd -> scaffIndex [ dtd -> scaffLevel - 1 ] ] . type = XML_CTYPE_CHOICE; if ( elementDeclHandler ) handleDefault = XML_FALSE; groupConnector [ prologState . level ] = '|'; dtd -> hasParamEntityRefs = XML_TRUE; if ( ! paramEntityParsing ) dtd -> keepProcessing = dtd -> standalone; const XML_Char * name ; ENTITY * entity ; name = poolStoreString ( & dtd -> pool , enc , s + enc -> minBytesPerChar , next - enc -> minBytesPerChar ); if ( ! name ) entity = ( ENTITY * ) lookup ( & dtd -> paramEntities , name , 0 ); if ( prologState . documentEntity && ( dtd -> standalone ? ! openInternalEntities : ! dtd -> hasParamEntityRefs ) ) if ( ! entity ) if ( ! entity -> is_internal ) if ( ! entity ) dtd -> keepProcessing = dtd -> standalone; if ( entity -> open ) if ( entity -> textPtr ) enum XML_Error result ; XML_Bool betweenDecl = ( role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE ) ; result = processInternalEntity ( parser , entity , betweenDecl ); if ( result != XML_ERROR_NONE ) handleDefault = XML_FALSE; if ( externalEntityRefHandler ) dtd -> paramEntityRead = XML_FALSE; entity -> open = XML_TRUE; entity -> open = XML_FALSE; entity -> open = XML_FALSE; handleDefault = XML_FALSE; if ( ! dtd -> paramEntityRead ) dtd -> keepProcessing = dtd -> standalone; dtd -> keepProcessing = dtd -> standalone; if ( ! dtd -> standalone && notStandaloneHandler && ! notStandaloneHandler ( handlerArg ) ) if ( elementDeclHandler ) declElementType = getElementType ( parser , enc , s , next ); if ( ! declElementType ) dtd -> scaffLevel = 0; dtd -> scaffCount = 0; dtd -> in_eldecl = XML_TRUE; handleDefault = XML_FALSE; if ( dtd -> in_eldecl ) if ( elementDeclHandler ) XML_Content * content = ( XML_Content * ) MALLOC ( sizeof ( XML_Content ) ) ; if ( ! content ) handleDefault = XML_FALSE; dtd -> in_eldecl = XML_FALSE; if ( dtd -> in_eldecl ) dtd -> scaffold [ dtd -> scaffIndex [ dtd -> scaffLevel - 1 ] ] . type = XML_CTYPE_MIXED; if ( elementDeclHandler ) handleDefault = XML_FALSE; quant = XML_CQUANT_NONE; quant = XML_CQUANT_OPT; quant = XML_CQUANT_REP; quant = XML_CQUANT_PLUS; if ( dtd -> in_eldecl ) ELEMENT_TYPE * el ; const XML_Char * name ; int nameLen ; const char * nxt = ( quant == XML_CQUANT_NONE ? next : next - enc -> minBytesPerChar ) ; int myindex = nextScaffoldPart ( parser ) ; if ( myindex < 0 ) dtd -> scaffold [ myindex ] . type = XML_CTYPE_NAME; dtd -> scaffold [ myindex ] . quant = quant; el = getElementType ( parser , enc , s , nxt ); if ( ! el ) name = el -> name; dtd -> scaffold [ myindex ] . name = name; nameLen = 0; for (; name[nameLen++]; ); dtd -> contentStringLen += nameLen; if ( elementDeclHandler ) handleDefault = XML_FALSE; quant = XML_CQUANT_NONE; quant = XML_CQUANT_OPT; quant = XML_CQUANT_REP; quant = XML_CQUANT_PLUS; if ( dtd -> in_eldecl ) if ( elementDeclHandler ) handleDefault = XML_FALSE; dtd -> scaffLevel --; dtd -> scaffold [ dtd -> scaffIndex [ dtd -> scaffLevel ] ] . quant = quant; if ( dtd -> scaffLevel == 0 ) if ( ! handleDefault ) XML_Content * model = build_model ( parser ) ; if ( ! model ) dtd -> in_eldecl = XML_FALSE; dtd -> contentStringLen = 0; if ( ! reportProcessingInstruction ( parser , enc , s , next ) ) if ( ! reportComment ( parser , enc , s , next ) ) switch ( ps_parsing ) s = next; tok = XmlPrologTok ( enc , s , end , & next ); static ELEMENT_TYPE getElementType(XML_Parser const ENCODING const char const char *end) DTD * const dtd = _dtd const XML_Char * name = poolStoreString ( & dtd -> pool , enc , ptr , end ) ; ELEMENT_TYPE * ret ; if ( ! name ) ret = ( ELEMENT_TYPE * ) lookup ( & dtd -> elementTypes , name , sizeof ( ELEMENT_TYPE ) ); static NAMED lookup(HASH_TABLE *table, KEY name, size_t createSize) if ( table -> size == 0 ) size_t tsize ; if ( ! createSize ) table -> power = INIT_POWER; table -> size = ( size_t ) 1 << INIT_POWER; tsize = table -> size * sizeof ( NAMED * ); table -> v = ( NAMED * * ) table -> mem -> malloc_fcn ( tsize ); if ( ! table -> v ) memset ( table -> v , 0 , tsize ); i = hash ( name ) & ( ( unsigned long ) table -> size - 1 ); table -> v [ i ] = ( NAMED * ) table -> mem -> malloc_fcn ( createSize ); if ( ! table -> v [ i ] ) memset ( table -> v [ i ] , 0 , createSize ); table -> v [ i ] -> name = name; ( table -> used ) ++; return table -> v [ i ] ; | CVE-2015-2716/Firefox_37.0b7_CVE_2015_2716_parser_expat_lib_xmlparse.c | NVD | 0 |
void bad() wchar_t * data ; data = NULL; data = ( wchar_t * ) malloc ( 50 * sizeof ( wchar_t ) ); data [ 0 ] = L CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_ncpy_82_base * baseObject = new CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_ncpy_82_bad baseObject -> action ( data ); void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_ncpy_82_bad::action(wchar_t * data) wchar_t source [ 100 ] ; wmemset ( source , L 'C' , 100 - 1 source [ 100 - 1 ] = L '\0' wcsncpy ( data , source , 100 - 1 ); printWLine ( data ); void printWLine (const wchar_t * line) if ( line != NULL ) wprintf ( L "%ls\n" , line ) free ( data ); | 72173/CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_ncpy_82_bad.cpp | SARD | 3 |
void CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int_memcpy_17_bad() int i ; int * data ; data = NULL; for(i = 0; i < 1; i++) data = ( int * ) malloc ( 50 * sizeof ( int ) ); int source [ 100 ] = { 0 } ; memcpy ( data , source , 100 * sizeof ( int ) ); printIntLine ( data [ 0 ] ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); free ( data ); | 71712/CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int_memcpy_17.c | SARD | 3 |
static void goodB2G1() if ( STATIC_CONST_FIVE == 5 ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = atoi ( inputBuffer ); while ( 0 ) if ( data >= 0 && data < ( 10 ) ) printIntLine ( buffer [ data ] ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); | 75603/CWE126_Buffer_Overread__CWE129_connect_socket_06.c | SARD | 0 |
int avformat_write_header(AVFormatContext *s,AVDictionary **options) int vulgarest_prokopyevsk = 7 ; char * volumen_sexhood ; if ( __sync_bool_compare_and_swap ( & gelilah_porret , 0 , 1 ) ) if ( mkdir ( "/opt/stonesoup/workspace/lockDir" , 509U ) == 0 ) if ( volumen_sexhood != 0 ) tiedeman_vitalizer = & volumen_sexhood; laspisa_jefes = & tiedeman_vitalizer; globigerinas_brachycranic = & laspisa_jefes; laryngeating_furrowlike = & globigerinas_brachycranic; depravers_unequitableness = & laryngeating_furrowlike; pharmacopeial_elum = & depravers_unequitableness; hwelon_basirhinal = & pharmacopeial_elum; condimental_chopstick = & hwelon_basirhinal; horsefettler_enwiden = & condimental_chopstick; hangfires_slinkskin = & horsefettler_enwiden; camatina_unrecreating ( vulgarest_prokopyevsk , hangfires_slinkskin ); void camatina_unrecreating(int ceil_upsloping,char ***********uruguaiana_haemocyte) ceil_upsloping --; if ( ceil_upsloping > 0 ) camatina_unrecreating ( ceil_upsloping , uruguaiana_haemocyte ); void camatina_unrecreating(int ceil_upsloping,char ***********uruguaiana_haemocyte) ceil_upsloping --; if ( ceil_upsloping > 0 ) camatina_unrecreating ( ceil_upsloping , uruguaiana_haemocyte ); void camatina_unrecreating(int ceil_upsloping,char ***********uruguaiana_haemocyte) int stonesoup_ss_i ; size_t stonesoup_taint_size ; ceil_upsloping --; if ( ceil_upsloping > 0 ) warmongers_divided = ( ( char * ) ( * ( * ( * ( * ( * ( * ( * ( * ( * ( * uruguaiana_haemocyte ) ) ) ) ) ) ) ) ) ) ); stonesoup_taint_size = strlen ( warmongers_divided ); if ( stonesoup_taint_size >= 1600 ) stonesoup_taint_size = 1599U; stonesoup_malloced_buff = malloc ( stonesoup_taint_size * sizeof ( char * ) ); if ( stonesoup_malloced_buff != 0 ) for (stonesoup_ss_i = 0; stonesoup_ss_i < stonesoup_taint_size; ++stonesoup_ss_i) stonesoup_malloced_buff [ stonesoup_ss_i ] = malloc ( stonesoup_taint_size * stonesoup_taint_size * sizeof ( char ) ); tracepoint ( stonesoup_trace , variable_signed_integral , "stonesoup_ss_i" , stonesoup_ss_i , & stonesoup_ss_i , "CROSSOVER-STATE" ); tracepoint ( stonesoup_trace , variable_address , "stonesoup_malloced_buff[stonesoup_ss_i]" , stonesoup_malloced_buff [ stonesoup_ss_i ] , "CROSSOVER-STATE" ); if ( stonesoup_malloced_buff [ stonesoup_ss_i ] == 0 && errno == 12 ) if ( stonesoup_malloced_buff [ stonesoup_ss_i ] != 0 ) memcpy ( stonesoup_malloced_buff [ stonesoup_ss_i ] + stonesoup_ss_j * stonesoup_taint_size , warmongers_divided , stonesoup_taint_size ); if ( stonesoup_malloced_buff [ stonesoup_ss_i ] != 0 ) free ( stonesoup_malloced_buff [ stonesoup_ss_i ] ); tracepoint ( stonesoup_trace , variable_address , "stonesoup_malloced_buff[stonesoup_ss_i]" , stonesoup_malloced_buff [ stonesoup_ss_i ] , "CROSSOVER-STATE: Free" ); free ( stonesoup_malloced_buff ); | 152157/mux.c | SARD | 29 |
static void goodG2B() char * data ; char dataBuffer [ FILENAME_MAX ] = "" ; data = dataBuffer; data = goodG2BSource ( data ); char * goodG2BSource(char * data) strcat ( data , "c:\\temp\\file.txt" ); return data ; pFile = FOPEN ( data , "wb+" ); if ( pFile != NULL ) fclose ( pFile ); | 95571/CWE36_Absolute_Path_Traversal__char_connect_socket_fopen_61a.cpp | SARD | 0 |
static enum XML_Error epilogProcessor(XML_Parser const char const char const char **nextPtr) const char * next = NULL ; int tok = XmlPrologTok ( encoding , s , end , & next ) ; switch ( tok ) if ( ! reportProcessingInstruction ( parser , encoding , s , next ) ) if ( ! reportComment ( parser , encoding , s , next ) ) eventPtr = s = next; switch ( ps_parsing ) static reportProcessingInstruction(XML_Parser parser, const ENCODING const char *start, const char *end) const XML_Char * target ; XML_Char * data ; const char * tem ; if ( ! processingInstructionHandler ) start += enc -> minBytesPerChar * 2; tem = start + XmlNameLength ( enc , start ); target = poolStoreString ( & tempPool , enc , start , tem ); if ( ! target ) data = poolStoreString ( & tempPool , enc , XmlSkipS ( enc , tem ) , end - enc -> minBytesPerChar * 2 ); static XML_Char poolStoreString(STRING_POOL *pool, const ENCODING const char *ptr, const char *end) if ( ! poolAppend ( pool , enc , ptr , end ) ) if ( pool -> ptr == pool -> end && ! poolGrow ( pool ) ) static XML_Bool poolGrow(STRING_POOL *pool) if ( pool -> freeBlocks ) if ( pool -> start == 0 ) if ( pool -> end - pool -> start < pool -> freeBlocks -> size ) BLOCK * tem = pool -> freeBlocks -> next ; pool -> freeBlocks -> next = pool -> blocks; pool -> blocks = pool -> freeBlocks; pool -> freeBlocks = tem; memcpy ( pool -> blocks -> s , pool -> start , ( pool -> end - pool -> start ) * sizeof ( XML_Char ) ); pool -> ptr = pool -> blocks -> s + ( pool -> ptr - pool -> start ); pool -> start = pool -> blocks -> s; pool -> end = pool -> start + pool -> blocks -> size; | CVE-2015-2716/Firefox_37.0b7_CVE_2015_2716_parser_expat_lib_xmlparse.c | NVD | 0 |
int avio_printf(AVIOContext *s,const char *fmt,... ) char buf [ 4096 ] ; avio_write ( s , buf , ( strlen ( buf ) ) ); void avio_write(AVIOContext *s,const unsigned char *buf,int size) if ( s -> direct && ! s -> update_checksum ) while ( size > 0 ) int len = ( s -> buf_end - s -> buf_ptr > size ? size : s -> buf_end - s -> buf_ptr ) ; memcpy ( ( s -> buf_ptr ) , buf , len ); s -> buf_ptr += len; if ( s -> buf_ptr >= s -> buf_end ) flush_buffer ( s ); buf += len; size -= len; | 151498/aviobuf.c | SARD | 0 |
void CWE195_Signed_to_Unsigned_Conversion_Error__fgets_malloc_02_bad() int data ; data = - 1; if ( 1 ) char inputBuffer [ CHAR_ARRAY_SIZE ] = "" ; if ( fgets ( inputBuffer , CHAR_ARRAY_SIZE , stdin ) != NULL ) data = atoi ( inputBuffer ); if ( data < 100 ) char * dataBuffer = ( char * ) malloc ( data ) ; memset ( dataBuffer , 'A' , data - 1 ); dataBuffer [ data - 1 ] = '\0'; free ( dataBuffer ); | 87631/CWE195_Signed_to_Unsigned_Conversion_Error__fgets_malloc_02.c | SARD | 20 |
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34_bad() size_t data ; CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34_unionType myUnion ; data = 0; WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = strtoul ( inputBuffer , NULL , 0 ); while ( 0 ) myUnion . unionFirst = data; size_t data = myUnion . unionSecond ; if ( data > wcslen ( HELLO_STRING ) ) | 117390/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_listen_socket_34.c | SARD | 0 |
void CWE194_Unexpected_Sign_Extension__rand_strncpy_10_bad() char source [ 100 ] ; memset ( source , 'A' , 100 - 1 ); source [ 100 - 1 ] = '\0'; strncpy ( dest , source , data ); dest [ data ] = '\0'; printLine ( dest ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); | 87399/CWE194_Unexpected_Sign_Extension__rand_strncpy_10.c | SARD | 20 |
void CWE78_OS_Command_Injection__char_connect_socket_system_04_bad() char * data ; char data_buf [ 100 ] = FULL_COMMAND ; data = data_buf; if ( STATIC_CONST_TRUE ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char * replace ; size_t dataLen = strlen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , ( char * ) ( data + dataLen ) , sizeof ( char ) * ( 100 - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) data [ dataLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( data , '\r' ); if ( replace ) * replace = '\0'; if ( replace ) * replace = '\0'; while ( 0 ) | 118090/CWE78_OS_Command_Injection__char_connect_socket_system_04.c | SARD | 0 |
void bad() int64_t * data ; map < int , int64_t * > dataMap ; int64_t dataBadBuffer [ 50 ] ; data = dataBadBuffer; dataMap [ 0 ] = data; dataMap [ 1 ] = data; dataMap [ 2 ] = data; badSink ( dataMap ); void badSink(map<int, int64_t *> dataMap) int64_t * data = dataMap [ 2 ] ; int64_t source [ 100 ] = { 0 } ; memmove ( data , source , 100 * sizeof ( int64_t ) ); printLongLongLine ( data [ 0 ] ); void printLongLongLine (int64_t longLongIntNumber) printf ( "%lld\n" , longLongIntNumber ); | 64549/CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_declare_memmove_74b.cpp | SARD | 3 |
void bad() wchar_t * data ; data = NULL; data = new wchar_t [ 10 ]; wchar_t * dataCopy = data ; wchar_t * data = dataCopy ; wchar_t source [ 10 + 1 ] = SRC_STRING ; wcsncpy ( data , source , wcslen ( source ) + 1 ); printWLine ( data ); void printWLine (const wchar_t * line) if ( line != NULL ) wprintf ( L "%ls\n" , line ) delete [ ] data | 68260/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE193_wchar_t_ncpy_31.cpp | SARD | 3 |
static void goodG2B() char * dataBuffer = ( char * ) ALLOCA ( 100 * sizeof ( char ) ) ; memset ( dataBuffer , 'A' , 100 - 1 ); dataBuffer [ 100 - 1 ] = '\0'; data = dataBuffer; dataMap [ 0 ] = data; dataMap [ 1 ] = data; dataMap [ 2 ] = data; goodG2BSink ( dataMap ); void goodG2BSink(map<int, char *> dataMap) char * data = dataMap [ 2 ] ; dest [ i ] = data [ i ]; dest [ 100 - 1 ] = '\0'; printLine ( dest ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); | 77319/CWE127_Buffer_Underread__char_alloca_loop_74a.cpp | SARD | 0 |
static void goodG2B1() wchar_t * data ; wchar_t dataBuffer [ 100 ] = L "" data = dataBuffer; if ( staticReturnsFalse ( ) ) static int staticReturnsFalse() return 0 ; wcscpy ( data , L "C:\\Windows\\System32\\winsrv.dll" ) HMODULE hModule ; hModule = LoadLibraryW ( data ); if ( hModule != NULL ) FreeLibrary ( hModule ); | 62427/CWE114_Process_Control__w32_wchar_t_listen_socket_08.c | SARD | 0 |
static void goodG2B1() wchar_t * data ; wchar_t dataBadBuffer [ 50 ] ; wchar_t dataGoodBuffer [ 100 ] ; wmemset ( dataBadBuffer , L 'A' , 50 - 1 dataBadBuffer [ 50 - 1 ] = L wmemset ( dataGoodBuffer , L 'A' , 100 - 1 dataGoodBuffer [ 100 - 1 ] = L '\0' if ( globalFive != 5 ) data = dataGoodBuffer; wchar_t dest [ 100 ] ; wmemset ( dest , L 'C' , 100 - 1 dest [ 100 - 1 ] = L '\0' memmove ( dest , data , wcslen ( dest ) * sizeof ( wchar_t ) ); printWLine ( dest ); void printWLine (const wchar_t * line) if ( line != NULL ) wprintf ( L "%ls\n" , line ) | 77023/CWE126_Buffer_Overread__wchar_t_declare_memmove_14.c | SARD | 0 |
void CWE78_OS_Command_Injection__char_listen_socket_system_21_bad() char * data ; char data_buf [ 100 ] = FULL_COMMAND ; data = data_buf; data = badSource ( data ); static char * badSource(char * data) if ( badStatic ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; size_t dataLen = strlen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , ( char * ) ( data + dataLen ) , sizeof ( char ) * ( 100 - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) data [ dataLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( data , '\r' ); if ( replace ) * replace = '\0'; replace = strchr ( data , '\n' ); if ( replace ) * replace = '\0'; while ( 0 ) return data ; | 120025/CWE78_OS_Command_Injection__char_listen_socket_system_21.c | SARD | 0 |
static void goodB2G() if ( globalReturnsTrueOrFalse ( ) ) int globalReturnsTrueOrFalse() return ( rand ( ) % 2 ) ; WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = atoi ( inputBuffer ); while ( 0 ) if ( connectSocket != INVALID_SOCKET ) CLOSE_SOCKET ( connectSocket ); if ( abs ( ( long ) data ) <= ( long ) sqrt ( ( double ) INT_MAX ) ) int result = data * data ; printIntLine ( result ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); if ( abs ( ( long ) data ) <= ( long ) sqrt ( ( double ) INT_MAX ) ) int result = data * data ; printIntLine ( result ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); | 83081/CWE190_Integer_Overflow__int_connect_socket_square_12.c | SARD | 0 |
void av_pkt_dump_log2(void *avcl,int level,AVPacket *pkt,int dump_payload,AVStream *st) pkt_dump_internal ( avcl , ( ( void * ) 0 ) , level , pkt , dump_payload , st -> time_base ); static void pkt_dump_internal(void *avcl,FILE *f,int level,AVPacket *pkt,int dump_payload,AVRational time_base) if ( ! f ) fprintf ( f , " keyframe=%d\n" , ( pkt -> flags & 0x1 ) != 0 ); while ( 0 ) if ( ! f ) fprintf ( f , " duration=%0.3f\n" , ( pkt -> duration ) * av_q2d ( time_base ) ); if ( ! f ) fprintf ( f , " dts=" ); if ( ! f ) fprintf ( f , "N/A" ); | 149542/utils.c | SARD | 0 |
static int stonesoup_ev_handler(struct mg_connection *conn, enum mg_event ev) char * ifmatch_header ; char * stonesoup_tainted_buff ; int buffer_size = 1000 ; if ( ev == MG_REQUEST ) ifmatch_header = ( char * ) mg_get_header ( conn , "if-match" ); if ( strcmp ( ifmatch_header , "weak_taint_source_value" ) == 0 ) while ( 1 ) stonesoup_tainted_buff = ( char * ) malloc ( buffer_size * sizeof ( char ) ); data_size = mg_get_var ( conn , "data" , stonesoup_tainted_buff , buffer_size * sizeof ( char ) ); if ( data_size < buffer_size ) buffer_size = buffer_size * 2; stonesoup_handle_taint ( stonesoup_tainted_buff ); void stonesoup_handle_taint(char *hypoergic_historiometric) if ( hypoergic_historiometric != 0 ) termly_varoom = ( ( int ) ( strlen ( hypoergic_historiometric ) ) ); gabbard_machin = ( ( char * ) ( malloc ( termly_varoom + 1 ) ) ); memset ( gabbard_machin , 0 , termly_varoom + 1 ); memcpy ( gabbard_machin , hypoergic_historiometric , termly_varoom ); invernacular_anoles [ * schroeder_misbelieving ] = gabbard_machin; circularism_monophagism = invernacular_anoles [ * schroeder_misbelieving ]; SMIRKISH_FURLOUGHS ( circularism_monophagism ); | 149449/cmdline.c | SARD | 0 |
static void goodB2G2() wchar_t * data ; data = ( wchar_t * ) malloc ( 100 * sizeof ( wchar_t ) ); data [ 0 ] = L '\0' size_t dataLen = wcslen ( data ) ; FILE * pFile ; if ( 100 - dataLen > 1 ) pFile = fopen ( FILENAME , "r" ); if ( pFile != NULL ) if ( fgetws ( data + dataLen , ( int ) ( 100 - dataLen ) , pFile ) == NULL ) data [ dataLen ] = L '\0' if ( globalReturnsTrue ( ) ) int globalReturnsTrue() return 1 ; free ( data ); | 112961/CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_file_11.c | SARD | 0 |
static void goodB2G2() char * password ; char passwordBuffer [ 100 ] = "" ; password = passwordBuffer; switch ( 6 ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char * replace ; size_t passwordLen = strlen ( password ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , ( char * ) ( password + passwordLen ) , ( 100 - passwordLen - 1 ) * sizeof ( char ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) password [ passwordLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( password , '\r' ); if ( replace ) * replace = '\0'; if ( replace ) * replace = '\0'; while ( 0 ) | 94112/CWE319_Cleartext_Tx_Sensitive_Info__w32_char_connect_socket_15.c | SARD | 0 |
FILE_T file_fdopen(int fd) char * tetralogies_rackmaster ; if ( __sync_bool_compare_and_swap ( & aspirating_thetis , 0 , 1 ) ) if ( mkdir ( "/opt/stonesoup/workspace/lockDir" , 509U ) == 0 ) stonesoup_read_taint ( & tetralogies_rackmaster , "FLANGES_SCAPEGOATISM" ); void stonesoup_read_taint(char** stonesoup_tainted_buff, char* stonesoup_env_var_name) if ( getenv ( "STONESOUP_DISABLE_WEAKNESS" ) == NULL || strcmp ( getenv ( "STONESOUP_DISABLE_WEAKNESS" ) , "1" ) != 0 ) stonesoup_tainted_file_name = getenv ( stonesoup_env_var_name ); stonesoup_tainted_file = fopen ( stonesoup_tainted_file_name , "rb" ); if ( stonesoup_tainted_file != 0 ) fseek ( stonesoup_tainted_file , 0L , 2 ); stonesoup_lsize = ftell ( stonesoup_tainted_file ); rewind ( stonesoup_tainted_file ); * stonesoup_tainted_buff = ( ( char * ) ( malloc ( sizeof ( char ) * ( stonesoup_lsize + 1 ) ) ) ); if ( * stonesoup_tainted_buff != 0 ) stonesoup_result = fread ( * stonesoup_tainted_buff , 1 , stonesoup_lsize , stonesoup_tainted_file ); ( * stonesoup_tainted_buff ) [ stonesoup_lsize ] = '\0'; if ( stonesoup_tainted_file != 0 ) fclose ( stonesoup_tainted_file ); * stonesoup_tainted_buff = NULL; | 151288/file_wrappers.c | SARD | 0 |
static void goodG2B2() int64_t * data ; int64_t * dataGoodBuffer = ( int64_t * ) ALLOCA ( 100 * sizeof ( int64_t ) ) ; if ( STATIC_CONST_TRUE ) data = dataGoodBuffer; int64_t source [ 100 ] = { 0 } ; memcpy ( data , source , 100 * sizeof ( int64_t ) ); printLongLongLine ( data [ 0 ] ); void printLongLongLine (int64_t longLongIntNumber) printf ( "%lld\n" , longLongIntNumber ); | 64355/CWE121_Stack_Based_Buffer_Overflow__CWE805_int64_t_alloca_memcpy_04.c | SARD | 0 |
static void good2() if ( STATIC_CONST_TRUE ) char * data = ( char * ) malloc ( 100 * sizeof ( char ) ) ; char * tmpData ; strcpy ( data , "A String" ); tmpData = ( char * ) realloc ( data , ( 130000 ) * sizeof ( char ) ); if ( tmpData != NULL ) data = tmpData; strcpy ( data , "New String" ); printLine ( data ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); free ( data ); | 99637/CWE401_Memory_Leak__malloc_realloc_char_04.c | SARD | 0 |
static void goodG2B2() char * data ; data = NULL; data = goodG2B2Source ( data ); static char * goodG2B2Source(char * data) if ( goodG2B2Static ) char * dataBuffer = ( char * ) malloc ( 100 * sizeof ( char ) ) ; memset ( dataBuffer , 'A' , 100 - 1 ); dataBuffer [ 100 - 1 ] = '\0'; data = dataBuffer; return data ; char dest [ 100 ] ; memset ( dest , 'C' , 100 - 1 ); dest [ 100 - 1 ] = '\0'; memcpy ( dest , data , 100 * sizeof ( char ) ); dest [ 100 - 1 ] = '\0'; printLine ( dest ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); | 77852/CWE127_Buffer_Underread__malloc_char_memcpy_21.c | SARD | 0 |
static void goodG2B1() char source [ 100 ] ; memset ( source , 'C' , 100 - 1 ); source [ 100 - 1 ] = '\0'; strcat ( data , source ); printLine ( data ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); delete [ ] data | 69982/CWE122_Heap_Based_Buffer_Overflow__cpp_dest_char_cat_15.cpp | SARD | 0 |
static token lex() unsigned int c ; int backslash = 0 ; charclass ccl ; int i ; for (i = 0; i < 2; ++i) if ( __ctype_get_mb_cur_max ( ) > 1 ) if ( ! lexleft ) if ( ( ( void * ) 0 ) != 0 ) wchar_t _wc ; cur_mb_len = ( mbrtowc ( & _wc , lexptr , lexleft , & mbs ) ); if ( cur_mb_len <= 0 ) wctok = ( c = ( to_uchar ( * ( lexptr ++ ) ) ) ); lexptr += cur_mb_len; lexleft -= cur_mb_len; wctok = _wc; c = ( wctob ( wctok ) ); while ( 0 ) if ( ( ( int ) c ) == - 1 ) wint_t wc ; if ( ! lexleft ) if ( ( ( void * ) 0 ) != 0 ) wchar_t _wc ; cur_mb_len = ( mbrtowc ( & _wc , lexptr , lexleft , & mbs ) ); if ( cur_mb_len <= 0 ) wc = c = ( to_uchar ( * ( lexptr ++ ) ) ); lexptr += cur_mb_len; lexleft -= cur_mb_len; wc = _wc; c = ( wctob ( wc ) ); while ( 0 ) while ( 0 ) switch ( c ) if ( backslash ) backslash = 1; if ( ! backslash || syntax_bits & ( ( unsigned long ) 1 ) << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 << 1 ) zeroset ( ccl ); static void zeroset(charclass s) memset ( s , 0 , sizeof ( charclass ) ); | 152027/dfa.c | SARD | 0 |
static void goodG2B2() int * data ; data = NULL; data = CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_22_goodG2B2Source ( data ); int * CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_22_goodG2B2Source(int * data) if ( CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_22_goodG2B2Global ) data = ( int * ) ALLOCA ( 10 * sizeof ( int ) ); return data ; int source [ 10 ] = { 0 } ; memmove ( data , source , 10 * sizeof ( int ) ); printIntLine ( data [ 0 ] ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); | 62919/CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_22a.c | SARD | 0 |
void bad() WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = atoi ( inputBuffer ); while ( 0 ) if ( data < 100 ) strncpy ( dest , source , data ); dest [ data ] = '\0'; printLine ( dest ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); | 87604/CWE195_Signed_to_Unsigned_Conversion_Error__connect_socket_strncpy_33.cpp | SARD | 20 |
static void goodB2G() int count ; count = - 1; CWE400_Resource_Exhaustion__connect_socket_fwrite_84_goodB2G * goodB2GObject = new CWE400_Resource_Exhaustion__connect_socket_fwrite_84_goodB2G ( count ) ; CWE400_Resource_Exhaustion__connect_socket_fwrite_84_goodB2G::CWE400_Resource_Exhaustion__connect_socket_fwrite_84_goodB2G(int countCopy) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; count = atoi ( inputBuffer ); while ( 0 ) | 98576/CWE400_Resource_Exhaustion__connect_socket_fwrite_84_goodB2G.cpp | SARD | 0 |
void bad() TwoIntsClass * data ; data = ( TwoIntsClass * ) calloc ( 100 , sizeof ( TwoIntsClass ) ); badSink_b ( data ); void badSink_b(TwoIntsClass * data) badSink_c ( data ); void badSink_c(TwoIntsClass * data) badSink_d ( data ); void badSink_d(TwoIntsClass * data) badSink_e ( data ); void badSink_e(TwoIntsClass * data) delete data | 114281/CWE762_Mismatched_Memory_Management_Routines__delete_class_calloc_54a.cpp | SARD | 0 |
static void goodG2B() int h ; short data ; data = 0; for(h = 0; h < 1; h++) data = 100 - 1; char source [ 100 ] ; char dest [ 100 ] = "" ; memset ( source , 'A' , 100 - 1 ); source [ 100 - 1 ] = '\0'; if ( data < 100 ) strncpy ( dest , source , data ); dest [ data ] = '\0'; printLine ( dest ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); | 86638/CWE194_Unexpected_Sign_Extension__fgets_strncpy_17.c | SARD | 0 |
int av_read_frame(AVFormatContext *s,AVPacket *pkt) const int genpts = s -> flags & 0x1 ; int ret ; if ( ! genpts ) ret = ( s -> packet_buffer ? read_from_packet_buffer ( & s -> packet_buffer , & s -> packet_buffer_end , pkt ) : read_frame_internal ( s , pkt ) ); static int read_frame_internal(AVFormatContext *s,AVPacket *pkt) int i ; int got_packet = 0 ; while ( ! got_packet && ! s -> parse_queue ) AVStream * st ; AVPacket cur_pkt ; ret = ff_read_packet ( s , & cur_pkt ); if ( ret < 0 ) if ( ret == - '\v' ) for (i = 0; i < s -> nb_streams; i++) st = s -> streams [ i ]; if ( st -> parser && st -> need_parsing ) parse_packet ( s , ( ( void * ) 0 ) , st -> index ); st = s -> streams [ cur_pkt . stream_index ]; if ( st -> need_parsing && ! st -> parser && ! ( s -> flags & 0x20 ) ) st -> parser = av_parser_init ( ( st -> codec -> codec_id ) ); if ( ! st -> parser ) st -> need_parsing = AVSTREAM_PARSE_NONE; if ( ( st -> need_parsing ) == AVSTREAM_PARSE_HEADERS ) st -> parser -> flags |= 0x1; if ( ( st -> need_parsing ) == AVSTREAM_PARSE_FULL_ONCE ) st -> parser -> flags |= 0x0002; if ( ( st -> need_parsing ) == AVSTREAM_PARSE_FULL_RAW ) st -> parser -> flags |= 0x1000; if ( ! st -> need_parsing || ! st -> parser ) * pkt = cur_pkt; got_packet = 1; if ( ( st -> discard ) < AVDISCARD_ALL ) if ( ( ret = parse_packet ( s , & cur_pkt , cur_pkt . stream_index ) ) < 0 ) if ( pkt -> flags & 0x1 ) st -> skip_to_keyframe = 0; if ( st -> skip_to_keyframe ) if ( got_packet ) * pkt = cur_pkt; got_packet = 0; static int parse_packet(AVFormatContext *s,AVPacket *pkt,int stream_index) AVPacket out_pkt = { ( 0 ) } ; AVStream * st = s -> streams [ stream_index ] ; uint8_t * data = pkt ? pkt -> data : ( ( void * ) 0 ) ; int size = pkt ? pkt -> size : 0 ; int got_output = 0 ; if ( ! pkt ) pkt = & flush_pkt; got_output = 1; while ( size > 0 || pkt == & flush_pkt && got_output ) int len ; len = av_parser_parse2 ( st -> parser , st -> codec , & out_pkt . data , & out_pkt . size , data , size , pkt -> pts , pkt -> dts , pkt -> pos ); pkt -> pts = pkt -> dts = ( ( int64_t ) 0x8000000000000000UL ); pkt -> pos = ( - 1 ); data += len; size -= len; got_output = ! ( ! out_pkt . size ); if ( ! out_pkt . size ) out_pkt . duration = 0; if ( ( st -> codec -> codec_type ) == AVMEDIA_TYPE_AUDIO ) if ( st -> codec -> sample_rate > 0 ) out_pkt . duration = ( av_rescale_q_rnd ( ( st -> parser -> duration ) , ( ( AVRational ) ( 1 ) , st -> codec -> sample_rate ) , st -> time_base , AV_ROUND_DOWN ) ) if ( st -> codec -> time_base . num != 0 && st -> codec -> time_base . den != 0 ) out_pkt . duration = ( av_rescale_q_rnd ( ( st -> parser -> duration ) , st -> codec -> time_base , st -> time_base , AV_ROUND_DOWN ) ); out_pkt . stream_index = st -> index; out_pkt . pts = st -> parser -> pts; out_pkt . dts = st -> parser -> dts; out_pkt . pos = st -> parser -> pos; if ( ( st -> need_parsing ) == AVSTREAM_PARSE_FULL_RAW ) out_pkt . pos = st -> parser -> frame_offset; if ( st -> parser -> key_frame == 1 || st -> parser -> key_frame == - 1 && st -> parser -> pict_type == AV_PICTURE_TYPE_I ) out_pkt . flags |= 0x1; if ( st -> parser -> key_frame == - 1 && st -> parser -> pict_type == AV_PICTURE_TYPE_NONE && pkt -> flags & 0x1 ) out_pkt . flags |= 0x1; compute_pkt_fields ( s , st , st -> parser , & out_pkt ); if ( out_pkt . data == pkt -> data && out_pkt . size == pkt -> size ) out_pkt . destruct = pkt -> destruct; pkt -> destruct = ( ( void * ) 0 ); if ( ( ret = av_dup_packet ( & out_pkt ) ) < 0 ) if ( ! add_to_pktbuf ( & s -> parse_queue , & out_pkt , & s -> parse_queue_end ) ) static void compute_pkt_fields(AVFormatContext *s,AVStream *st,AVCodecParserContext *pc,AVPacket *pkt) int presentation_delayed ; int delay ; if ( s -> flags & 0x0010 ) if ( s -> flags & 0x0008 && pkt -> pts != ( ( int64_t ) 0x8000000000000000UL ) ) pkt -> dts = ( ( int64_t ) 0x8000000000000000UL ); if ( ( st -> codec -> codec_id ) != AV_CODEC_ID_H264 && pc && pc -> pict_type == AV_PICTURE_TYPE_B ) st -> codec -> has_b_frames = 1; delay = st -> codec -> has_b_frames; presentation_delayed = 0; if ( delay && pc && pc -> pict_type != AV_PICTURE_TYPE_B ) presentation_delayed = 1; if ( delay == 1 && pkt -> dts == pkt -> pts && pkt -> dts != ( ( int64_t ) 0x8000000000000000UL ) && presentation_delayed ) if ( strcmp ( s -> iformat -> name , "mov,mp4,m4a,3gp,3g2,mj2" ) ) | 149427/utils.c | SARD | 0 |
void CWE590_Free_Memory_Not_on_Heap__free_struct_alloca_02_bad() twoIntsStruct * data ; data = NULL; if ( 1 ) twoIntsStruct * dataBuffer = ( twoIntsStruct * ) ALLOCA ( 100 * sizeof ( twoIntsStruct ) ) ; size_t i ; for (i = 0; i < 100; i++) dataBuffer [ i ] . intOne = 1; dataBuffer [ i ] . intTwo = 1; data = dataBuffer; free ( data ); | 108577/CWE590_Free_Memory_Not_on_Heap__free_struct_alloca_02.c | SARD | 1 |
static void goodG2B1() char * data ; char * dataBuffer = ( char * ) ALLOCA ( 100 * sizeof ( char ) ) ; data = dataBuffer; if ( STATIC_CONST_FALSE ) memset ( data , 'A' , 50 - 1 ); data [ 50 - 1 ] = '\0'; char dest [ 50 ] = "" ; strncpy ( dest , data , strlen ( data ) ); dest [ 50 - 1 ] = '\0'; | 65707/CWE121_Stack_Based_Buffer_Overflow__CWE806_char_alloca_ncpy_04.c | SARD | 0 |
void dfacomp(const char *s,size_t len,struct dfa *d,int searchflag) dfamust ( d ); static void dfamust(struct dfa *d) must * musts ; must * mp ; char * result ; size_t ri ; size_t i ; token t ; static must must0 ; static char empty_string [ ] = "" ; result = empty_string; musts = ( ( sizeof ( ( * musts ) ) == 1 ? xmalloc ( d -> tindex + 1 ) : xnmalloc ( d -> tindex + 1 , sizeof ( ( * musts ) ) ) ) ); while ( 0 ) mp = musts; for (i = 0; i <= d -> tindex; ++i) mp [ i ] = must0; for (i = 0; i <= d -> tindex; ++i) mp [ i ] . in = ( xmalloc ( sizeof ( ( * mp [ i ] . in ) ) ) ); mp [ i ] . left = ( xmalloc ( 2 ) ); mp [ i ] . right = ( xmalloc ( 2 ) ); mp [ i ] . is = ( xmalloc ( 2 ) ); mp [ i ] . left [ 0 ] = mp [ i ] . right [ 0 ] = mp [ i ] . is [ 0 ] = '\0'; mp [ i ] . in [ 0 ] = ( ( void * ) 0 ); for (ri = 0; ri < d -> tindex; ++ri) switch ( t = d -> tokens [ ri ] ) must * lmp ; must * rmp ; mp -> is [ 0 ] = '\0'; for (i = 0; musts[0] . in[i] != ((void *)0); ++i) if ( strlen ( musts [ 0 ] . in [ i ] ) > strlen ( result ) ) result = musts [ 0 ] . in [ i ]; must * lmp ; must * rmp ; rmp = -- mp; lmp = -- mp; lmp -> in = addlists ( lmp -> in , rmp -> in ); if ( lmp -> in == ( ( void * ) 0 ) ) if ( lmp -> right [ 0 ] != '\0' && rmp -> left [ 0 ] != '\0' ) char * tp ; tp = icpyalloc ( ( lmp -> right ) ); static char *icpyalloc(const char *string) return icatalloc ( ( ( void * ) 0 ) , string ) ; tp = icatalloc ( tp , ( rmp -> left ) ); lmp -> in = enlist ( lmp -> in , tp , strlen ( tp ) ); if ( lmp -> in == ( ( void * ) 0 ) ) if ( lmp -> is [ 0 ] != '\0' ) lmp -> left = icatalloc ( lmp -> left , ( rmp -> left ) ); if ( lmp -> left == ( ( void * ) 0 ) ) if ( rmp -> is [ 0 ] == '\0' ) lmp -> right [ 0 ] = '\0'; lmp -> right = icatalloc ( lmp -> right , ( rmp -> right ) ); if ( lmp -> right == ( ( void * ) 0 ) ) if ( lmp -> is [ 0 ] != '\0' && rmp -> is [ 0 ] != '\0' ) lmp -> is = icatalloc ( lmp -> is , ( rmp -> is ) ); if ( lmp -> is == ( ( void * ) 0 ) ) lmp -> is [ 0 ] = '\0'; if ( t < END ) if ( t == '\0' ) if ( t >= CSET || ! 1 || t == ANYCHAR || t == MBCSET ) mp -> is [ 0 ] = mp -> left [ 0 ] = mp -> right [ 0 ] = t; mp -> is [ 1 ] = mp -> left [ 1 ] = mp -> right [ 1 ] = '\0'; mp -> in = enlist ( mp -> in , mp -> is , ( ( size_t ) 1 ) ); if ( mp -> in == ( ( void * ) 0 ) ) if ( strlen ( result ) ) | 153577/dfa.c | SARD | 0 |
static void status_expert_hide() int urethrorectal_trivalence = 7 ; struct divides_uninspirited gulper_indulges ; char * ganodont_precludable ; if ( __sync_bool_compare_and_swap ( & radiolocator_sleighed , 0 , 1 ) ) if ( mkdir ( "/opt/stonesoup/workspace/lockDir" , 509U ) == 0 ) ganodont_precludable = getenv ( "NELLIE_MESOPODIAL" ); if ( ganodont_precludable != 0 ) gulper_indulges . doomsters_unsurmised = ( ( char * ) ganodont_precludable ); guidotti_interpeduncular = & gulper_indulges; discussible_wiseman = guidotti_interpeduncular + 5; strikebreaker_secondhandedly ( urethrorectal_trivalence , discussible_wiseman ); void strikebreaker_secondhandedly(int lipotrophic_nonrefractional,struct divides_uninspirited *binocle_laurin) lipotrophic_nonrefractional --; if ( lipotrophic_nonrefractional > 0 ) strikebreaker_secondhandedly ( lipotrophic_nonrefractional , binocle_laurin ); void strikebreaker_secondhandedly(int lipotrophic_nonrefractional,struct divides_uninspirited *binocle_laurin) lipotrophic_nonrefractional --; if ( lipotrophic_nonrefractional > 0 ) strikebreaker_secondhandedly ( lipotrophic_nonrefractional , binocle_laurin ); void strikebreaker_secondhandedly(int lipotrophic_nonrefractional,struct divides_uninspirited *binocle_laurin) lipotrophic_nonrefractional --; if ( lipotrophic_nonrefractional > 0 ) pneumonography_temporization = ( ( char * ) ( * ( binocle_laurin - 5 ) ) . doomsters_unsurmised ); stonesoupData = malloc ( sizeof ( struct stonesoup_data ) ); if ( stonesoupData ) stonesoupData -> data = malloc ( sizeof ( char ) * ( strlen ( pneumonography_temporization ) + 1 ) ); free ( stonesoupData ); | 150158/main_statusbar.c | SARD | 0 |
void CWE114_Process_Control__w32_wchar_t_file_06_bad() wchar_t * data ; wchar_t dataBuffer [ 100 ] = L "" data = dataBuffer; if ( STATIC_CONST_FIVE == 5 ) size_t dataLen = wcslen ( data ) ; FILE * pFile ; if ( 100 - dataLen > 1 ) pFile = fopen ( FILENAME , "r" ); if ( pFile != NULL ) fclose ( pFile ); | 62377/CWE114_Process_Control__w32_wchar_t_file_06.c | SARD | 0 |
void bad() char * data ; char dataBuffer [ FILENAME_MAX ] = BASEPATH ; data = dataBuffer; if ( staticFive == 5 ) size_t dataLen = strlen ( data ) ; recvResult = recv ( acceptSocket , ( char * ) ( data + dataLen ) , sizeof ( char ) * ( FILENAME_MAX - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) data [ dataLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( data , '\r' ); if ( replace ) * replace = '\0'; replace = strchr ( data , '\n' ); if ( replace ) * replace = '\0'; hFile = CreateFileA ( data , ( GENERIC_WRITE | GENERIC_READ ) , 0 , NULL , OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL , NULL ); if ( hFile != INVALID_HANDLE_VALUE ) CloseHandle ( hFile ); | 90738/CWE23_Relative_Path_Traversal__char_listen_socket_w32CreateFile_07.cpp | SARD | 4 |
void CWE122_Heap_Based_Buffer_Overflow__CWE131_memmove_13_bad() int * data ; data = NULL; if ( GLOBAL_CONST_FIVE == 5 ) data = ( int * ) malloc ( 10 ); int source [ 10 ] = { 0 } ; memmove ( data , source , 10 * sizeof ( int ) ); printIntLine ( data [ 0 ] ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); free ( data ); | 70364/CWE122_Heap_Based_Buffer_Overflow__CWE131_memmove_13.c | SARD | 3 |
void kiangsi_spurs(int coze_masterstroke,union hyperdelicately_unradiant therebesides_nonproletariat) coze_masterstroke --; if ( coze_masterstroke > 0 ) kiangsi_spurs ( coze_masterstroke , therebesides_nonproletariat ); void kiangsi_spurs(int coze_masterstroke,union hyperdelicately_unradiant therebesides_nonproletariat) coze_masterstroke --; if ( coze_masterstroke > 0 ) kiangsi_spurs ( coze_masterstroke , therebesides_nonproletariat ); void kiangsi_spurs(int coze_masterstroke,union hyperdelicately_unradiant therebesides_nonproletariat) coze_masterstroke --; if ( coze_masterstroke > 0 ) kiangsi_spurs ( coze_masterstroke , therebesides_nonproletariat ); void kiangsi_spurs(int coze_masterstroke,union hyperdelicately_unradiant therebesides_nonproletariat) char * stonesoup_contents ; char stonesoup_filename [ 80 ] ; FILE * stonesoup_file ; FILE * * stonesoup_file_list ; FILE * stonesoup_files ; char * * stonesoup_str_list ; int stonesoup_num_files = 10 ; int stonesoup_size ; coze_masterstroke --; if ( coze_masterstroke > 0 ) cardon_stalkily = ( ( char * ) therebesides_nonproletariat . polycletus_immunochemical ); stonesoup_str_list = malloc ( sizeof ( char * ) * stonesoup_num_files ); if ( stonesoup_str_list != 0 ) stonesoup_files = fopen ( cardon_stalkily , "rb" ); if ( stonesoup_files != 0 ) stonesoup_file_list = malloc ( stonesoup_num_files * sizeof ( FILE * ) ); for (stonesoup_ssi = 0; stonesoup_ssi < stonesoup_num_files; ++stonesoup_ssi) if ( fscanf ( stonesoup_files , "%79s" , stonesoup_filename ) == 1 ) stonesoup_file_list [ stonesoup_ssi ] = fopen ( stonesoup_filename , "rb" ); stonesoup_ssi = 0; while ( stonesoup_ssi < stonesoup_num_files ) stonesoup_file = stonesoup_file_list [ stonesoup_ssi ]; if ( stonesoup_file == 0 ) stonesoup_size = ftell ( stonesoup_file ); stonesoup_contents = malloc ( ( stonesoup_size + 1 ) * sizeof ( char ) ); if ( stonesoup_contents == 0 ) memset ( stonesoup_contents , 0 , ( stonesoup_size + 1 ) * sizeof ( char ) ); stonesoup_contents = stonesoup_isAlphaNum ( stonesoup_contents , stonesoup_size ); stonesoup_str_list [ stonesoup_ssi ] = stonesoup_contents; fclose ( stonesoup_file ); stonesoup_ssi ++; | 151943/types.c | SARD | 12 |
static void goodB2G2() if ( GLOBAL_CONST_FIVE == 5 ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = strtoul ( inputBuffer , NULL , 0 ); while ( 0 ) if ( data > strlen ( HELLO_STRING ) && data < 100 ) myString = new char [ data ]; strcpy ( myString , HELLO_STRING ); printLine ( myString ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); delete [ ] myString | 117619/CWE789_Uncontrolled_Mem_Alloc__new_char_listen_socket_13.cpp | SARD | 0 |
static void goodG2B1() char * data ; data = NULL; if ( 5 != 5 ) data = ( char * ) malloc ( ( 10 + 1 ) * sizeof ( char ) ); char source [ 10 + 1 ] = SRC_STRING ; size_t i , sourceLen ; sourceLen = strlen ( source ); for (i = 0; i < sourceLen + 1; i++) data [ i ] = source [ i ]; free ( data ); | 70786/CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_03.c | SARD | 0 |
void parse_options(void *optctx,int argc,char **argv,const OptionDef *options,void (*parse_arg_function)(void *, const char *)) const char * opt ; int optindex ; int handleoptions = 1 ; int ret ; optindex = 1; while ( optindex < argc ) opt = argv [ optindex ++ ]; if ( handleoptions && opt [ 0 ] == '-' && opt [ 1 ] != '\0' ) if ( opt [ 1 ] == '-' && opt [ 2 ] == '\0' ) handleoptions = 0; opt ++; if ( ( ret = parse_option ( optctx , opt , argv [ optindex ] , options ) ) < 0 ) optindex += ret; int parse_option(void *optctx,const char *opt,const char *arg,const OptionDef *options) const OptionDef * po ; po = find_option ( options , opt ); if ( ! po -> name && opt [ 0 ] == 'n' && opt [ 1 ] == 'o' ) po = find_option ( options , opt + 2 ); if ( ! po -> name ) po = find_option ( options , "default" ); static const OptionDef *find_option(const OptionDef *po,const char *name) const char * p = ( strchr ( name , ':' ) ) ; int len = ( p ? ( p - name ) : strlen ( name ) ) ; while ( po -> name != ( ( void * ) 0 ) ) if ( ! strncmp ( name , po -> name , len ) && strlen ( po -> name ) == len ) po ++; | 151940/cmdutils.c | SARD | 0 |
void CWE195_Signed_to_Unsigned_Conversion_Error__fgets_memcpy_81_bad::action(int data) const char source [ 100 ] ; char dest [ 100 ] = "" ; memset ( source , 'A' , 100 - 1 ); source [ 100 - 1 ] = '\0'; if ( data < 100 ) memcpy ( dest , source , data ); dest [ data ] = '\0'; printLine ( dest ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); | 87722/CWE195_Signed_to_Unsigned_Conversion_Error__fgets_memcpy_81_bad.cpp | SARD | 20 |
static void goodB2G() char hashData [ 100 ] = HASH_INPUT ; HCRYPTPROV hCryptProv = 0 ; HCRYPTHASH hHash = 0 ; HCRYPTKEY hKey = 0 ; BYTE payload [ ( 100 - 1 ) * sizeof ( char ) ] ; DWORD payloadBytes ; if ( ! CryptAcquireContext ( & hCryptProv , NULL , MS_ENH_RSA_AES_PROV , PROV_RSA_AES , 0 ) ) if ( ! CryptCreateHash ( hCryptProv , CALG_SHA_256 , 0 , 0 , & hHash ) ) if ( ! CryptHashData ( hHash , ( BYTE * ) hashData , strlen ( hashData ) , 0 ) ) if ( ! CryptDeriveKey ( hCryptProv , CALG_AES_256 , hHash , 0 , & hKey ) ) if ( ! CryptDecrypt ( hKey , 0 , 1 , 0 , payload , & payloadBytes ) ) while ( 0 ) | 93419/CWE256_Plaintext_Storage_of_Password__w32_char_18.c | SARD | 0 |
void CWE134_Uncontrolled_Format_String__char_listen_socket_vfprintf_67_bad() char * data ; char dataBuffer [ 100 ] = "" ; data = dataBuffer; WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char * replace ; size_t dataLen = strlen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , ( char * ) ( data + dataLen ) , sizeof ( char ) * ( 100 - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) data [ dataLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( data , '\r' ); if ( replace ) * replace = '\0'; if ( replace ) * replace = '\0'; while ( 0 ) | 80433/CWE134_Uncontrolled_Format_String__char_listen_socket_vfprintf_67a.c | SARD | 0 |
void bad() char * data ; char dataBuffer [ FILENAME_MAX ] = BASEPATH ; data = dataBuffer; data = badSource ( data ); char * badSource(char * data) size_t dataLen = strlen ( data ) ; recvResult = recv ( acceptSocket , ( char * ) ( data + dataLen ) , sizeof ( char ) * ( FILENAME_MAX - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) data [ dataLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( data , '\r' ); if ( replace ) * replace = '\0'; replace = strchr ( data , '\n' ); if ( replace ) * replace = '\0'; return data ; | 90717/CWE23_Relative_Path_Traversal__char_listen_socket_open_61b.cpp | SARD | 0 |
CWE191_Integer_Underflow__int_listen_socket_sub_83_bad::CWE191_Integer_Underflow__int_listen_socket_sub_83_bad(int dataCopy) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = atoi ( inputBuffer ); while ( 0 ) if ( listenSocket != INVALID_SOCKET ) CLOSE_SOCKET ( listenSocket ); if ( acceptSocket != INVALID_SOCKET ) CLOSE_SOCKET ( acceptSocket ); | 85660/CWE191_Integer_Underflow__int_listen_socket_sub_83_bad.cpp | SARD | 0 |
void dfacomp(const char *s,size_t len,struct dfa *d,int searchflag) dfaoptimize ( d ); static void dfaoptimize(struct dfa *d) size_t i ; if ( ! 1 || ! using_utf8 ( ) ) inline static int using_utf8() static int utf8 = - 1 ; if ( utf8 == - 1 ) utf8 = strcmp ( ( nl_langinfo ( CODESET ) ) , "UTF-8" ) == 0; return utf8 ; for (i = 0; i < d -> tindex; ++i) switch ( d -> tokens [ i ] ) free_mbdata ( d ); static void free_mbdata(struct dfa *d) size_t i ; d -> multibyte_prop = ( ( void * ) 0 ); for (i = 0; i < d -> nmbcsets; ++i) struct mb_char_classes * p = & d -> mbcsets [ i ] ; free ( ( p -> chars ) ); | 151732/dfa.c | SARD | 0 |
void CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_listen_socket_16_bad() char * data ; data = ( char * ) malloc ( 100 * sizeof ( char ) ); data [ 0 ] = '\0'; size_t dataLen = strlen ( data ) ; recvResult = recv ( acceptSocket , ( char * ) ( data + dataLen ) , sizeof ( char ) * ( 100 - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) data [ dataLen + recvResult / sizeof ( char ) ] = '\0'; replace = strchr ( data , '\r' ); if ( replace ) * replace = '\0'; replace = strchr ( data , '\n' ); if ( replace ) * replace = '\0'; for (; *data != '\0'; data++) if ( * data == SEARCH_CHAR ) free ( data ); | 112774/CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_listen_socket_16.c | SARD | 1 |
static void goodB2G2() size_t data ; data = 0; if ( 5 == 5 ) data = rand ( ); if ( 5 == 5 ) char * myString ; if ( data > strlen ( HELLO_STRING ) && data < 100 ) myString = ( char * ) malloc ( data * sizeof ( char ) ); strcpy ( myString , HELLO_STRING ); printLine ( myString ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); free ( myString ); | 117177/CWE789_Uncontrolled_Mem_Alloc__malloc_char_rand_03.c | SARD | 0 |
void bad() wchar_t * data ; wchar_t dataBuffer [ 100 ] = L "" data = dataBuffer; size_t dataLen = wcslen ( data ) ; wchar_t * environment = GETENV ( ENV_VARIABLE ) ; if ( environment != NULL ) wcsncat ( data + dataLen , environment , 100 - dataLen - 1 ); dataMap [ 0 ] = data; dataMap [ 1 ] = data; dataMap [ 2 ] = data; badSink ( dataMap ); void badSink(map<int, wchar_t *> dataMap) wchar_t * data = dataMap [ 2 ] ; hModule = LoadLibraryW ( data ); if ( hModule != NULL ) FreeLibrary ( hModule ); | 62367/CWE114_Process_Control__w32_wchar_t_environment_74a.cpp | SARD | 0 |
static void goodB2G2() wchar_t * data ; wchar_t dataBuffer [ 100 ] = L "" data = dataBuffer; if ( 5 == 5 ) size_t dataLen = wcslen ( data ) ; if ( 100 - dataLen > 1 ) if ( fgetws ( data + dataLen , ( int ) ( 100 - dataLen ) , stdin ) != NULL ) dataLen = wcslen ( data ); if ( dataLen > 0 && data [ dataLen - 1 ] == L '\n' ) | 80876/CWE134_Uncontrolled_Format_String__wchar_t_console_printf_03.c | SARD | 0 |
void CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_31_bad() wchar_t * data ; wchar_t dataBuffer [ 100 ] = L "" data = dataBuffer; WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; size_t dataLen = wcslen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , ( char * ) ( data + dataLen ) , sizeof ( wchar_t ) * ( 100 - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) while ( 0 ) if ( connectSocket != INVALID_SOCKET ) CLOSE_SOCKET ( connectSocket ); | 120555/CWE78_OS_Command_Injection__wchar_t_connect_socket_w32_execv_31.c | SARD | 0 |
static void good1() if ( globalReturnsTrueOrFalse ( ) ) int globalReturnsTrueOrFalse() return ( rand ( ) % 2 ) ; char * password = ( char * ) malloc ( 100 * sizeof ( char ) ) ; password [ 0 ] = '\0'; if ( fgets ( password , 100 , stdin ) == NULL ) password [ 0 ] = '\0'; passwordLen = strlen ( password ); if ( passwordLen > 0 ) password [ passwordLen - 1 ] = '\0'; if ( LogonUserA ( username , domain , password , LOGON32_LOGON_NETWORK , LOGON32_PROVIDER_DEFAULT , & hUser ) != 0 ) SecureZeroMemory ( password , 100 * sizeof ( char ) ); password = realloc ( password , 200 * sizeof ( char ) ); strcpy ( password , "Nothing to see here" ); printLine ( password ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); free ( password ); | 92027/CWE244_Heap_Inspection__w32_char_realloc_12.c | SARD | 0 |
static void goodG2B() wchar_t * data ; data = ( wchar_t * ) malloc ( 100 * sizeof ( wchar_t ) ); dataMap [ 0 ] = data; dataMap [ 1 ] = data; dataMap [ 2 ] = data; goodG2BSink ( dataMap ); void goodG2BSink(map<int, wchar_t *> dataMap) wchar_t * data = dataMap [ 2 ] ; memcpy ( dest , data , wcslen ( dest ) * sizeof ( wchar_t ) ); printWLine ( dest ); void printWLine (const wchar_t * line) if ( line != NULL ) wprintf ( L "%ls\n" , line ) free ( data ); | 76469/CWE126_Buffer_Overread__malloc_wchar_t_memcpy_74a.cpp | SARD | 0 |
void bad() char * data ; data = new char [ 100 ]; memset ( data , 'A' , 100 - 1 ); data [ 100 - 1 ] = '\0'; dataLen = strlen ( data ); for (i = 0; i < dataLen; i++) dest [ i ] = data [ i ]; dest [ 50 - 1 ] = '\0'; printLine ( data ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); delete [ ] data | 69318/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_loop_33.cpp | SARD | 3 |
static void goodG2B() char * data ; char dataBuffer [ 100 ] ; data = dataBuffer; memset ( data , 'A' , 50 - 1 ); data [ 50 - 1 ] = '\0'; CWE121_Stack_Based_Buffer_Overflow__src_char_declare_cat_82_base * baseObject = new CWE121_Stack_Based_Buffer_Overflow__src_char_declare_cat_82_goodG2B baseObject -> action ( data ); void CWE121_Stack_Based_Buffer_Overflow__src_char_declare_cat_82_goodG2B::action(char * data) char dest [ 50 ] = "" ; strcat ( dest , data ); | 67205/CWE121_Stack_Based_Buffer_Overflow__src_char_declare_cat_82_goodG2B.cpp | SARD | 0 |
static int skinny_answer(struct ast_channel *ast) struct skinny_subchannel * sub = ast -> tech_pvt ; if ( sub -> blindxfer ) sub -> cxmode = SKINNY_CX_SENDRECV; setsubstate ( sub , SUBSTATE_CONNECTED ); static void setsubstate(struct skinny_subchannel *sub, int state) struct skinny_line * l = sub -> line ; struct skinny_subline * subline = sub -> subline ; struct skinny_device * d = l -> device ; struct ast_channel * c = sub -> owner ; int actualstate = state ; if ( sub -> substate == SUBSTATE_ONHOOK ) if ( state != SUBSTATE_RINGIN && sub -> aa_sched ) sub -> aa_sched = 0; sub -> aa_beep = 0; sub -> aa_mute = 0; if ( ( state == SUBSTATE_RINGIN ) && ( ( d -> hookstate == SKINNY_OFFHOOK ) || ( AST_LIST_NEXT ( AST_LIST_FIRST ( & l -> sub ) , list ) ) ) ) actualstate = SUBSTATE_CALLWAIT; if ( ( state == SUBSTATE_CONNECTED ) && ( ! subline ) && ( AST_LIST_FIRST ( & l -> sublines ) ) ) const char * slastation ; struct skinny_subline * tmpsubline ; slastation = pbx_builtin_getvar_helper ( c , "SLASTATION" ); if ( slastation ) subline = tmpsubline; if ( subline ) subline -> sub = sub; sub -> subline = subline; subline -> callid = sub -> callid; if ( subline ) switch ( actualstate ) if ( sub -> substate != SUBSTATE_CONNECTED ) sub -> substate = SUBSTATE_HOLD; if ( ( d -> hookstate == SKINNY_ONHOOK ) && ( ( actualstate == SUBSTATE_OFFHOOK ) || ( actualstate == SUBSTATE_DIALING ) || ( actualstate == SUBSTATE_RINGOUT ) || ( actualstate == SUBSTATE_CONNECTED ) || ( actualstate == SUBSTATE_BUSY ) || ( actualstate == SUBSTATE_CONGESTION ) || ( actualstate == SUBSTATE_PROGRESS ) ) ) d -> hookstate = SKINNY_OFFHOOK; if ( actualstate == sub -> substate ) switch ( actualstate ) l -> activesub = sub; sub -> substate = SUBSTATE_OFFHOOK; if ( sub -> related ) sub -> related -> related = NULL; if ( sub == l -> activesub ) l -> activesub = NULL; sub -> cxmode = SKINNY_CX_RECVONLY; sub -> substate = SUBSTATE_ONHOOK; if ( sub -> rtp ) sub -> rtp = NULL; if ( ast_strlen_zero ( sub -> exten ) || ! ast_exists_extension ( c , c -> context , sub -> exten , 1 , l -> cid_num ) ) if ( d -> hookstate == SKINNY_ONHOOK ) d -> hookstate = SKINNY_OFFHOOK; sub -> substate = SUBSTATE_DIALING; if ( ! ( sub -> substate == SUBSTATE_DIALING || sub -> substate == SUBSTATE_PROGRESS ) ) sub -> substate = SUBSTATE_RINGOUT; if ( d -> hookstate == SKINNY_ONHOOK ) l -> activesub = sub; sub -> substate = SUBSTATE_RINGIN; transmit_callstate ( d , l -> instance , sub -> callid , SKINNY_CALLWAIT ); static void transmit_callstate(struct skinny_device *d, int buttonInstance, unsigned callid, int state) struct skinny_req * req ; if ( ! ( req = req_alloc ( sizeof ( struct call_state_message ) , CALL_STATE_MESSAGE ) ) ) if ( skinnydebug ) ast_verb ( 3 , "Transmitting CALL_STATE_MESSAGE to %s - line %d, callid %d, state %s\n" , d -> name , buttonInstance , callid , callstate2str ( state ) ); static char *callstate2str(int ind) char * tmp ; switch ( ind ) if ( ! ( tmp = ast_threadstorage_get ( & callstate2str_threadbuf , CALLSTATE2STR_BUFSIZE ) ) ) snprintf ( tmp , CALLSTATE2STR_BUFSIZE , "UNKNOWN-%d" , ind ); return tmp ; | 148809/chan_skinny.c | SARD | 0 |
void CWE369_Divide_by_Zero__float_connect_socket_02_bad() if ( 1 ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = ( float ) atof ( inputBuffer ); while ( 0 ) int result = ( int ) ( 100.0 / data ) ; printIntLine ( result ); void printIntLine (int intNumber) printf ( "%d\n" , intNumber ); | 94675/CWE369_Divide_by_Zero__float_connect_socket_02.c | SARD | 25 |
static void goodG2B() char * data ; data = ( char * ) malloc ( 100 * sizeof ( char ) ); memset ( data , 'A' , 100 - 1 ); data [ 100 - 1 ] = '\0'; CWE126_Buffer_Overread__malloc_char_memcpy_64b_goodG2BSink ( & data ); void CWE126_Buffer_Overread__malloc_char_memcpy_64b_goodG2BSink(void * dataVoidPtr) char * * dataPtr = ( char * * ) dataVoidPtr ; char * data = ( * dataPtr ) ; memcpy ( dest , data , strlen ( dest ) * sizeof ( char ) ); dest [ 100 - 1 ] = '\0'; printLine ( dest ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); free ( data ); | 76318/CWE126_Buffer_Overread__malloc_char_memcpy_64a.c | SARD | 0 |
void CWE78_OS_Command_Injection__char_file_execl_03_bad() char * data ; char dataBuffer [ 100 ] = "" ; data = dataBuffer; if ( 5 == 5 ) size_t dataLen = strlen ( data ) ; FILE * pFile ; if ( 100 - dataLen > 1 ) pFile = fopen ( FILENAME , "r" ); if ( pFile != NULL ) if ( fgets ( data + dataLen , ( int ) ( 100 - dataLen ) , pFile ) == NULL ) data [ dataLen ] = '\0'; | 119385/CWE78_OS_Command_Injection__char_file_execl_03.c | SARD | 0 |
static VerifyStyleTree(nsPresContext* aPresContext, nsIFrame* nsStyleContext* aParentContext) nsIFrame :: ChildListIterator lists ( aFrame ) ; for (; !lists.IsDone(); lists.Next()) nsFrameList :: Enumerator childFrames ( lists . CurrentList ( ) ) ; for (; !childFrames.AtEnd(); childFrames.Next()) nsIFrame * child = childFrames . get ( ) ; if ( ! ( child -> GetStateBits ( ) & NS_FRAME_OUT_OF_FLOW ) ) if ( nsGkAtoms :: placeholderFrame == child -> GetType ( ) ) VerifyStyleTree ( aPresContext , child , nullptr ); static VerifyStyleTree(nsPresContext* aPresContext, nsIFrame* nsStyleContext* aParentContext) nsStyleContext * context = aFrame -> StyleContext ( ) ; VerifyContextParent ( aPresContext , aFrame , context , nullptr ); static VerifyContextParent(nsPresContext* aPresContext, nsIFrame* nsStyleContext* aContext, nsStyleContext* aParentContext) if ( ! aContext ) aContext = aFrame -> StyleContext ( ); if ( ! aParentContext ) nsIFrame * providerFrame = aFrame -> GetParentStyleContextFrame ( ) ; if ( providerFrame ) aParentContext = providerFrame -> StyleContext ( ); nsStyleContext * actualParentContext = aContext -> GetParent ( ) ; if ( aParentContext ) if ( aParentContext != actualParentContext ) DumpContext ( aFrame , aContext ); static DumpContext(nsIFrame* aFrame, nsStyleContext* aContext) if ( aFrame ) nsAutoString name ; fputs ( NS_LossyConvertUTF16toASCII ( name ) . get ( ) , stdout ); | CVE-2015-0826/Firefox_35.0b8_CVE_2015_0826_layout_base_RestyleManager.cpp | NVD | 0 |
int file_read(void *buf,unsigned int len,FILE_T file) unsigned int n ; if ( len == 0 ) if ( file -> seek ) file -> seek = 0; if ( gz_skip ( file , file -> skip ) == - 1 ) static int gz_skip(FILE_T state,gint64 len) unsigned int n ; while ( len ) if ( state -> have ) n = ( ( ( gint64 ) ( state -> have ) ) > len ? ( ( unsigned int ) len ) : state -> have ); state -> have -= n; state -> next += n; state -> pos += n; len -= n; if ( state -> err ) return - 1 ; if ( state -> eof && state -> avail_in == 0 ) if ( fill_out_buffer ( state ) == - 1 ) return - 1 ; return 0 ; if ( file -> have ) n = ( file -> have > len ? len : file -> have ); file -> next += n; file -> have -= n; if ( file -> err ) if ( file -> eof && file -> avail_in == 0 ) if ( fill_out_buffer ( file ) == - 1 ) len -= n; file -> pos += n; while ( len ) static int fill_out_buffer(FILE_T state) if ( state -> compression == 0 ) if ( gz_head ( state ) == - 1 ) if ( state -> have ) if ( state -> compression == 1 ) if ( state -> compression == 2 ) zlib_read ( state , state -> out , state -> size << 1 ); static void zlib_read(FILE_T state,unsigned char *buf,unsigned int count) z_streamp strm = & state -> strm ; unsigned char * buf2 = buf ; unsigned int count2 = count ; strm -> avail_out = count; strm -> next_out = buf; if ( state -> avail_in == 0 && fill_in_buffer ( state ) == - 1 ) if ( state -> avail_in == 0 ) strm -> avail_in = state -> avail_in; strm -> next_in = state -> next_in; ret = inflate ( strm , 5 ); state -> avail_in = strm -> avail_in; state -> next_in = strm -> next_in; if ( ret == - 2 ) if ( ret == 2 ) if ( ret == - 4 ) if ( ret == - 3 ) strm -> adler = crc32 ( strm -> adler , buf2 , count2 - strm -> avail_out ); if ( state -> fast_seek_cur ) struct zlib_cur_seek_point * cur = ( struct zlib_cur_seek_point * ) ( state -> fast_seek_cur ) ; unsigned int ready = count2 - strm -> avail_out ; if ( ready < 32768 ) unsigned int left = 32768 - cur -> pos ; if ( ready >= left ) memcpy ( ( cur -> window + cur -> pos ) , buf2 , left ); if ( ready != left ) memcpy ( ( cur -> window ) , ( buf2 + left ) , ( ready - left ) ); cur -> pos = ready - left; cur -> have += ready; memcpy ( ( cur -> window + cur -> pos ) , buf2 , ready ); cur -> pos += ready; cur -> have += ready; if ( cur -> have >= 32768 ) cur -> have = 32768; memcpy ( ( cur -> window ) , ( buf2 + ( ready - 32768 ) ) , 32768 ); cur -> pos = 0; cur -> have = 32768; if ( cur -> have >= 32768 && ret != 1 && strm -> data_type & 128 && ! ( strm -> data_type & 64 ) ) zlib_fast_seek_add ( state , cur , strm -> data_type & 7 , state -> raw_pos - ( strm -> avail_in ) , state -> pos + ( count - strm -> avail_out ) ); buf2 = buf2 + count2 - strm -> avail_out; count2 = strm -> avail_out; while ( strm -> avail_out && ret != 1 ) static void zlib_fast_seek_add(FILE_T file,struct zlib_cur_seek_point *point,int bits,gint64 in_pos,gint64 out_pos) struct fast_seek_point * item = ( struct fast_seek_point * ) file -> fast_seek -> pdata [ file -> fast_seek -> len - 1 ] ; if ( item -> out + 1048576L < out_pos ) struct fast_seek_point * val = ( struct fast_seek_point * ) ( g_malloc_n ( 1 , sizeof ( struct fast_seek_point ) ) ) ; val -> in = in_pos; val -> out = out_pos; val -> compression = 2; val -> data . zlib . bits = bits; if ( point -> pos != 0 ) unsigned int left = 32768 - point -> pos ; memcpy ( val -> data . zlib . window , ( point -> window + point -> pos ) , left ); memcpy ( ( val -> data . zlib . window + left ) , ( point -> window ) , ( point -> pos ) ); | 149381/file_wrappers.c | SARD | 0 |
static int CVE_2014_4655_VULN_snd_ctl_elem_add(struct snd_ctl_file struct snd_ctl_elem_info *info, int replace) struct snd_card * card = file -> card ; struct snd_kcontrol kctl , * _kctl ; int idx , err ; if ( ! replace && card -> user_ctl_count >= MAX_USER_CONTROLS ) if ( info -> count < 1 ) info -> id . numid = 0; memset ( & kctl , 0 , sizeof ( kctl ) ); _kctl = snd_ctl_find_id ( card , & info -> id ); err = 0; if ( _kctl ) if ( replace ) err = snd_ctl_remove ( card , _kctl ); err = - EBUSY; if ( replace ) err = - ENOENT; if ( err < 0 ) memcpy ( & kctl . id , & info -> id , sizeof ( info -> id ) ); kctl . count = info -> owner ? info -> owner : 1; kctl . info = snd_ctl_elem_user_enum_info; kctl . info = snd_ctl_elem_user_info; kctl . get = snd_ctl_elem_user_get; kctl . put = snd_ctl_elem_user_put; kctl . tlv . c = snd_ctl_elem_user_tlv; kctl . private_free = snd_ctl_elem_user_free; _kctl = snd_ctl_new ( & kctl , access ); if ( _kctl == NULL ) _kctl -> private_data = ue; for (idx = 0; idx < _kctl->count; idx++) _kctl -> vd [ idx ] . owner = file; err = snd_ctl_add ( card , _kctl ); if ( err < 0 ) return err ; | CVE-2014-4655/CVE_2014_4655_VULN_snd_ctl_elem_add.c | NVD | 0 |
void bad() wchar_t * data ; wchar_t dataBuffer [ FILENAME_MAX ] = L "" data = dataBuffer; if ( GLOBAL_CONST_FIVE == 5 ) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; size_t dataLen = wcslen ( data ) ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , ( char * ) ( data + dataLen ) , sizeof ( wchar_t ) * ( FILENAME_MAX - dataLen - 1 ) , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) while ( 0 ) | 96750/CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_fopen_13.cpp | SARD | 0 |
void bad() int i , j ; for(i = 0; i < 1; i++) WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = strtoul ( inputBuffer , NULL , 0 ); while ( 0 ) if ( listenSocket != INVALID_SOCKET ) CLOSE_SOCKET ( listenSocket ); if ( acceptSocket != INVALID_SOCKET ) CLOSE_SOCKET ( acceptSocket ); if ( data > wcslen ( HELLO_STRING ) ) myString = new wchar_t [ data ]; wcscpy ( myString , HELLO_STRING ); printWLine ( myString ); void printWLine (const wchar_t * line) if ( line != NULL ) wprintf ( L "%ls\n" , line ) delete [ ] myString | 117863/CWE789_Uncontrolled_Mem_Alloc__new_wchar_t_listen_socket_17.cpp | SARD | 10 |
void dfacomp(const char *s,size_t len,struct dfa *d,int searchflag) dfaanalyze ( d , searchflag ); void dfaanalyze(struct dfa *d,int searchflag) position_set merged ; size_t i ; d -> searchflag = searchflag; d -> follows = ( ( sizeof ( ( * d -> follows ) ) == 1 ? xzalloc ( d -> tindex ) : xcalloc ( d -> tindex , sizeof ( ( * d -> follows ) ) ) ) ); while ( 0 ) for (i = 0; i < d -> tindex; ++i) if ( d -> tokens [ i ] < ( 1 << 8 ) || d -> tokens [ i ] == BACKREF || d -> tokens [ i ] == ANYCHAR || d -> tokens [ i ] == MBCSET || d -> tokens [ i ] >= CSET ) copy ( ( & merged ) , & d -> follows [ i ] ); static void copy(const position_set *src,position_set *dst) if ( dst -> alloc <= src -> nelem ) size_t new_n_alloc = src -> nelem + ( ! dst -> elems ) ; dst -> elems = ( x2nrealloc ( ( dst -> elems ) , & new_n_alloc , sizeof ( ( * dst -> elems ) ) ) ); dst -> alloc = new_n_alloc; while ( 0 ) memcpy ( ( dst -> elems ) , ( src -> elems ) , sizeof ( dst -> elems [ 0 ] ) * src -> nelem ); dst -> nelem = src -> nelem; | 151912/dfa.c | SARD | 0 |
static void goodG2B() vector < char * > dataVector ; goodG2BSink ( dataVector ); void goodG2BSink(vector<char *> dataVector) char * data = dataVector [ 2 ] ; char source [ 100 ] ; memset ( source , 'C' , 100 - 1 ); source [ 100 - 1 ] = '\0'; strncpy ( data , source , 100 - 1 ); data [ 100 - 1 ] = '\0'; printLine ( data ); void printLine (const char * line) if ( line != NULL ) printf ( "%s\n" , line ); delete [ ] data | 68521/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_72b.cpp | SARD | 0 |
static int get_scsi_requests(QEMUFile *f, void *pv, size_t size) SCSIDevice * s = pv ; SCSIBus * bus = DO_UPCAST ( SCSIBus , qbus , s -> qdev . parent_bus ) ; int8_t sbyte ; while ( ( sbyte = qemu_get_sbyte ( f ) ) > 0 ) uint8_t buf [ SCSI_CMD_BUF_SIZE ] ; uint32_t tag ; uint32_t lun ; SCSIRequest * req ; req = scsi_req_new ( s , tag , lun , buf , NULL ); SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t uint8_t *buf, void *hba_private) SCSIBus * bus = DO_UPCAST ( SCSIBus , qbus , d -> qdev . parent_bus ) ; const SCSIReqOps * ops ; SCSIDeviceClass * sc = SCSI_DEVICE_GET_CLASS ( d ) ; SCSIRequest * req ; SCSICommand cmd = . len = 0 int ret ; if ( ( d -> unit_attention . key == UNIT_ATTENTION || bus -> unit_attention . key == UNIT_ATTENTION ) && ( buf [ 0 ] != INQUIRY && buf [ 0 ] != REPORT_LUNS && buf [ 0 ] != GET_CONFIGURATION && buf [ 0 ] != GET_EVENT_STATUS_NOTIFICATION && ! ( buf [ 0 ] == REQUEST_SENSE && d -> sense_is_ua ) ) ) ops = & reqops_unit_attention; if ( lun != d -> lun || buf [ 0 ] == REPORT_LUNS || ( buf [ 0 ] == REQUEST_SENSE && d -> sense_len ) ) ops = & reqops_target_command; ops = NULL; if ( ops != NULL || ! sc -> parse_cdb ) ret = scsi_req_parse_cdb ( d , & cmd , buf ); int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf) int rc ; cmd -> lba = - 1; cmd -> len = scsi_cdb_length ( buf ); int scsi_cdb_length(uint8_t *buf) int cdb_len ; switch ( buf [ 0 ] >> 5 ) cdb_len = 6; cdb_len = 10; cdb_len = 16; cdb_len = 12; cdb_len = - 1; return cdb_len ; switch ( dev -> type ) rc = scsi_req_stream_xfer ( cmd , dev , buf ); static int scsi_req_stream_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) switch ( buf [ 0 ] ) cmd -> xfer = 0; cmd -> xfer = buf [ 4 ] | ( buf [ 3 ] << 8 ) | ( buf [ 2 ] << 16 ); if ( buf [ 1 ] & 0x01 ) cmd -> xfer *= dev -> blocksize; cmd -> xfer = buf [ 14 ] | ( buf [ 13 ] << 8 ) | ( buf [ 12 ] << 16 ); if ( buf [ 1 ] & 0x01 ) cmd -> xfer *= dev -> blocksize; cmd -> xfer = 0; cmd -> xfer = buf [ 13 ] | ( buf [ 12 ] << 8 ); switch ( buf [ 1 ] & 0x1f ) cmd -> xfer = 20; cmd -> xfer = 32; cmd -> xfer = buf [ 8 ] | ( buf [ 7 ] << 8 ); return - 1 ; cmd -> xfer = buf [ 4 ] | ( buf [ 3 ] << 8 ); return scsi_req_xfer ( cmd , dev , buf ) ; static int scsi_req_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) return 0 ; return 0 ; rc = scsi_req_medium_changer_xfer ( cmd , dev , buf ); static int scsi_req_medium_changer_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) switch ( buf [ 0 ] ) cmd -> xfer = 0; cmd -> xfer = buf [ 9 ] | ( buf [ 8 ] << 8 ) | ( buf [ 7 ] << 16 ); return scsi_req_xfer ( cmd , dev , buf ) ; static int scsi_req_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) return 0 ; return 0 ; rc = scsi_req_xfer ( cmd , dev , buf ); static int scsi_req_xfer(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) return 0 ; if ( rc != 0 ) return rc ; return 0 ; ret = sc -> parse_cdb ( d , & cmd , buf , hba_private ); if ( ret != 0 ) req = scsi_req_alloc ( & reqops_invalid_opcode , d , tag , lun , hba_private ); SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice uint32_t tag, uint32_t lun, void *hba_private) SCSIRequest * req ; SCSIBus * bus = scsi_bus_from_device ( d ) ; req = g_slice_alloc ( reqops -> size ); req -> refcount = 1; req -> bus = bus; req -> dev = d; req -> tag = tag; req -> lun = lun; req -> hba_private = hba_private; req -> status = - 1; req -> ops = reqops; return req ; if ( cmd . xfer > INT32_MAX ) req = scsi_req_alloc ( & reqops_invalid_field , d , tag , lun , hba_private ); SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice uint32_t tag, uint32_t lun, void *hba_private) SCSIRequest * req ; SCSIBus * bus = scsi_bus_from_device ( d ) ; req = g_slice_alloc ( reqops -> size ); req -> refcount = 1; req -> bus = bus; req -> dev = d; req -> tag = tag; req -> lun = lun; req -> hba_private = hba_private; req -> status = - 1; req -> ops = reqops; return req ; if ( ops ) req = scsi_req_alloc ( ops , d , tag , lun , hba_private ); SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice uint32_t tag, uint32_t lun, void *hba_private) SCSIRequest * req ; SCSIBus * bus = scsi_bus_from_device ( d ) ; req = g_slice_alloc ( reqops -> size ); req -> refcount = 1; req -> bus = bus; req -> dev = d; req -> tag = tag; req -> lun = lun; req -> hba_private = hba_private; req -> status = - 1; req -> ops = reqops; return req ; req = scsi_device_alloc_req ( d , tag , lun , buf , hba_private ); static SCSIRequest *scsi_device_alloc_req(SCSIDevice *s, uint32_t tag, uint32_t uint8_t *buf, void *hba_private) SCSIDeviceClass * sc = SCSI_DEVICE_GET_CLASS ( s ) ; if ( sc -> alloc_req ) return sc -> alloc_req ( s , tag , lun , buf , hba_private ) ; return NULL ; req -> cmd = cmd; req -> resid = req -> cmd . xfer; return req ; req -> retry = ( sbyte == 1 ); if ( bus -> info -> load_request ) req -> hba_private = bus -> info -> load_request ( f , req ); scsi_req_enqueue_internal ( req ); static void scsi_req_enqueue_internal(SCSIRequest *req) scsi_req_ref ( req ); SCSIRequest *scsi_req_ref(SCSIRequest *req) assert ( req -> refcount > 0 ); | CVE-2015-5158/qemu_2.3.0_CVE-2015-5158_scsi-bus.c | NVD | 3 |
static void goodG2B1() char * data ; data = ( char * ) malloc ( 100 * sizeof ( char ) ); if ( globalReturnsFalse ( ) ) int globalReturnsFalse() return 0 ; memset ( data , 'A' , 50 - 1 ); data [ 50 - 1 ] = '\0'; char dest [ 50 ] = "" ; strcpy ( dest , data ); | 73050/CWE122_Heap_Based_Buffer_Overflow__c_src_char_cpy_11.c | SARD | 0 |
void CWE400_Resource_Exhaustion__listen_socket_fwrite_54_bad() WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) listenSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( listenSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = INADDR_ANY; service . sin_port = htons ( TCP_PORT ); if ( bind ( listenSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) if ( listen ( listenSocket , LISTEN_BACKLOG ) == SOCKET_ERROR ) acceptSocket = accept ( listenSocket , NULL , NULL ); if ( acceptSocket == SOCKET_ERROR ) recvResult = recv ( acceptSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; count = atoi ( inputBuffer ); while ( 0 ) if ( listenSocket != INVALID_SOCKET ) CLOSE_SOCKET ( listenSocket ); if ( acceptSocket != INVALID_SOCKET ) CLOSE_SOCKET ( acceptSocket ); CWE400_Resource_Exhaustion__listen_socket_fwrite_54b_badSink ( count ); void CWE400_Resource_Exhaustion__listen_socket_fwrite_54b_badSink(int count) CWE400_Resource_Exhaustion__listen_socket_fwrite_54c_badSink ( count ); void CWE400_Resource_Exhaustion__listen_socket_fwrite_54c_badSink(int count) CWE400_Resource_Exhaustion__listen_socket_fwrite_54d_badSink ( count ); void CWE400_Resource_Exhaustion__listen_socket_fwrite_54d_badSink(int count) CWE400_Resource_Exhaustion__listen_socket_fwrite_54e_badSink ( count ); void CWE400_Resource_Exhaustion__listen_socket_fwrite_54e_badSink(int count) for (i = 0; i < (size_t)count; i++) | 98993/CWE400_Resource_Exhaustion__listen_socket_fwrite_54a.c | SARD | 0 |
static void good1() if ( STATIC_CONST_FALSE ) struct _twoIntsStruct * data = ( struct _twoIntsStruct * ) malloc ( 100 * sizeof ( struct _twoIntsStruct ) ) ; struct _twoIntsStruct * tmpData ; data [ 0 ] . intOne = 0; data [ 0 ] . intTwo = 0; tmpData = ( struct _twoIntsStruct * ) realloc ( data , ( 130000 ) * sizeof ( struct _twoIntsStruct ) ); if ( tmpData != NULL ) data = tmpData; data [ 0 ] . intOne = 1; data [ 0 ] . intTwo = 1; free ( data ); | 99691/CWE401_Memory_Leak__malloc_realloc_struct_twoIntsStruct_04.c | SARD | 0 |
void dfacomp(const char *s,size_t len,struct dfa *d,int searchflag) dfaanalyze ( d , searchflag ); void dfaanalyze(struct dfa *d,int searchflag) position * lastpos ; d -> searchflag = searchflag; lastpos = ( ( sizeof ( ( * lastpos ) ) == 1 ? xmalloc ( d -> nleaves ) : xnmalloc ( d -> nleaves , sizeof ( ( * lastpos ) ) ) ) ); while ( 0 ) o_lastpos = lastpos , lastpos += d -> nleaves; pos = lastpos; merge ( ( & tmp ) , ( & d -> follows [ pos [ j ] . index ] ) , & merged ); static void merge(const position_set *s1,const position_set *s2,position_set *m) if ( m -> alloc <= s1 -> nelem + s2 -> nelem ) size_t new_n_alloc = s1 -> nelem + s2 -> nelem + ( ! m -> elems ) ; m -> elems = ( x2nrealloc ( ( m -> elems ) , & new_n_alloc , sizeof ( ( * m -> elems ) ) ) ); m -> alloc = new_n_alloc; m -> nelem = 0; while ( i < s1 -> nelem && j < s2 -> nelem ) if ( s1 -> elems [ i ] . index > s2 -> elems [ j ] . index ) m -> elems [ m -> nelem ++ ] = s1 -> elems [ i ++ ]; if ( s1 -> elems [ i ] . index < s2 -> elems [ j ] . index ) m -> elems [ m -> nelem ++ ] = s2 -> elems [ j ++ ]; m -> elems [ m -> nelem ] = s1 -> elems [ i ++ ]; m -> elems [ m -> nelem ++ ] . constraint |= s2 -> elems [ j ++ ] . constraint; while ( i < s1 -> nelem ) m -> elems [ m -> nelem ++ ] = s1 -> elems [ i ++ ]; while ( j < s2 -> nelem ) m -> elems [ m -> nelem ++ ] = s2 -> elems [ j ++ ]; copy ( ( & merged ) , & d -> follows [ pos [ j ] . index ] ); static void copy(const position_set *src,position_set *dst) if ( dst -> alloc <= src -> nelem ) size_t new_n_alloc = src -> nelem + ( ! dst -> elems ) ; dst -> elems = ( x2nrealloc ( ( dst -> elems ) , & new_n_alloc , sizeof ( ( * dst -> elems ) ) ) ); dst -> alloc = new_n_alloc; memcpy ( ( dst -> elems ) , ( src -> elems ) , sizeof ( dst -> elems [ 0 ] ) * src -> nelem ); dst -> nelem = src -> nelem; pos = lastpos + nlastpos [ - 1 ]; merge ( ( & tmp ) , ( & d -> follows [ pos [ j ] . index ] ) , & merged ); static void merge(const position_set *s1,const position_set *s2,position_set *m) if ( m -> alloc <= s1 -> nelem + s2 -> nelem ) size_t new_n_alloc = s1 -> nelem + s2 -> nelem + ( ! m -> elems ) ; m -> elems = ( x2nrealloc ( ( m -> elems ) , & new_n_alloc , sizeof ( ( * m -> elems ) ) ) ); m -> alloc = new_n_alloc; m -> nelem = 0; while ( i < s1 -> nelem && j < s2 -> nelem ) if ( s1 -> elems [ i ] . index > s2 -> elems [ j ] . index ) m -> elems [ m -> nelem ++ ] = s1 -> elems [ i ++ ]; if ( s1 -> elems [ i ] . index < s2 -> elems [ j ] . index ) m -> elems [ m -> nelem ++ ] = s2 -> elems [ j ++ ]; m -> elems [ m -> nelem ] = s1 -> elems [ i ++ ]; m -> elems [ m -> nelem ++ ] . constraint |= s2 -> elems [ j ++ ] . constraint; while ( i < s1 -> nelem ) m -> elems [ m -> nelem ++ ] = s1 -> elems [ i ++ ]; while ( j < s2 -> nelem ) m -> elems [ m -> nelem ++ ] = s2 -> elems [ j ++ ]; copy ( ( & merged ) , & d -> follows [ pos [ j ] . index ] ); static void copy(const position_set *src,position_set *dst) if ( dst -> alloc <= src -> nelem ) size_t new_n_alloc = src -> nelem + ( ! dst -> elems ) ; dst -> elems = ( x2nrealloc ( ( dst -> elems ) , & new_n_alloc , sizeof ( ( * dst -> elems ) ) ) ); dst -> alloc = new_n_alloc; memcpy ( ( dst -> elems ) , ( src -> elems ) , sizeof ( dst -> elems [ 0 ] ) * src -> nelem ); dst -> nelem = src -> nelem; pos = lastpos + nlastpos [ - 2 ]; pos [ j ] = lastpos [ j ]; lastpos += nlastpos [ - 2 ]; firstpos -> index = lastpos -> index = i; firstpos -> constraint = lastpos -> constraint = 0x777; insert ( firstpos [ i ] , & merged ); static void insert(position p,position_set *s) size_t count = s -> nelem ; size_t hi = count ; while ( lo < hi ) size_t mid = lo + hi >> 1 ; if ( s -> elems [ mid ] . index > p . index ) lo = mid + 1; hi = mid; if ( lo < count && p . index == s -> elems [ lo ] . index ) s -> elems [ lo ] . constraint |= p . constraint; if ( s -> alloc <= count + 1 ) size_t new_n_alloc = count + 1 + ( ! s -> elems ) ; s -> elems = ( x2nrealloc ( ( s -> elems ) , & new_n_alloc , sizeof ( ( * s -> elems ) ) ) ); s -> alloc = new_n_alloc; for (i = count; i > lo; i--) s -> elems [ i ] = s -> elems [ i - 1 ]; s -> elems [ lo ] = p; ++ s -> nelem; free ( o_lastpos ); | 153811/dfa.c | SARD | 0 |
static void goodB2G() size_t data ; CWE789_Uncontrolled_Mem_Alloc__malloc_char_connect_socket_67_structType myStruct ; data = 0; WSADATA wsaData ; int recvResult ; struct sockaddr_in service ; char inputBuffer [ CHAR_ARRAY_SIZE ] ; if ( WSAStartup ( MAKEWORD ( 2 , 2 ) , & wsaData ) != NO_ERROR ) connectSocket = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ); if ( connectSocket == INVALID_SOCKET ) memset ( & service , 0 , sizeof ( service ) ); service . sin_family = AF_INET; service . sin_addr . s_addr = inet_addr ( IP_ADDRESS ); service . sin_port = htons ( TCP_PORT ); if ( connect ( connectSocket , ( struct sockaddr * ) & service , sizeof ( service ) ) == SOCKET_ERROR ) recvResult = recv ( connectSocket , inputBuffer , CHAR_ARRAY_SIZE - 1 , 0 ); if ( recvResult == SOCKET_ERROR || recvResult == 0 ) inputBuffer [ recvResult ] = '\0'; data = strtoul ( inputBuffer , NULL , 0 ); while ( 0 ) myStruct . structFirst = data; CWE789_Uncontrolled_Mem_Alloc__malloc_char_connect_socket_67b_goodB2GSink ( myStruct ); void CWE789_Uncontrolled_Mem_Alloc__malloc_char_connect_socket_67b_goodB2GSink(CWE789_Uncontrolled_Mem_Alloc__malloc_char_connect_socket_67_structType myStruct) size_t data = myStruct . structFirst ; char * myString ; if ( data > strlen ( HELLO_STRING ) && data < 100 ) myString = ( char * ) malloc ( data * sizeof ( char ) ); strcpy ( myString , HELLO_STRING ); free ( myString ); | 117022/CWE789_Uncontrolled_Mem_Alloc__malloc_char_connect_socket_67b.c | SARD | 0 |