Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at pvmd.c:1035

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2972.3057
Procedure: main
Trace: View
Modified: Wed Sep 2 12:55:25 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /u1/paul/SATE/2010/c/pvm/pvm3/src/pvmd.c
   Enter main
((char*)$param_2)[8] <= 4095947 main(argc, argv) 
 948         int argc;
 949         char **argv;
 950 {
 951         int i, j;
 952         char *name = "";
 953         struct passwd *pe;
 954         int testmode = 0;
 955         struct timeval tnow;
 956         char buf[128];
 957  
 958 #ifndef WIN32 
 959         /* check for extension config options */ 
 960         check_ext_input();
 961  
 962         /* make sure 0, 1, 2 are in use */ 
 963         (void)open("/dev/null", O_RDONLY, 0);
 964         (void)open("/dev/null", O_RDONLY, 0);
 965         (void)open("/dev/null", O_RDONLY, 0);
 966 #else 
 967         /* WSAStartup has to be called before any socket command */ 
 968         /* can be executed. Why ? Ask Bill   */ 
 969  
 970         if (WSAStartup(0x0101, &WSAData) != 0) {
 971               printf("\nWSAStartup() failed\n");
 972               ExitProcess(1);
 973         }
 974         setsockopt(INVALID_SOCKET,SOL_SOCKET,SO_OPENTYPE,
 975                         (char *)&nAlert,sizeof(int));
 976         osinfo=malloc(sizeof(OSVERSIONINFO));
 977         osinfo->dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 978         GetVersionEx(osinfo);
 979         os_is_NT= ( osinfo->dwPlatformId == VER_PLATFORM_WIN32_NT); 
 980 #endif 
 981  
 982         {
 983                 char *p;
 984                 if (p = getenv("PVMDDEBUG"))
 985                         pvmdebmask = pvmstrtoi(p);
 986         }
 987  
 988 #ifndef WIN32 
 989         if ((pvm_useruid = getuid()) == -1) {
 990                 pvmlogerror("main() can't getuid()\n");
 991                 pvmbailout(0);
 992         }
 993         pvmchkuid( pvm_useruid );
 994 #else 
 995         username = MyGetUserName(); 
 996 #endif 
 997  
 998         pvmsetlog(3);
 999  
 1000 #ifndef WIN32 
 1001         if (pe = getpwuid(pvm_useruid))
 1002                 username = STRALLOC(pe->pw_name);   /* Null Pointer Dereference (ID: 2694.2746) */
 1003         else 
 1004                 pvmlogerror("main() can't getpwuid\n");
 1005         endpwent();
 1006 #endif 
 1007  
 1008 #ifdef WIN32 
 1009         if ((pvmmyupid = getpid()) == -1) {
 1010                 pvmlogerror("main() can't getpid() %d \n",GetLastError());
 1011                 pvmbailout(0);
 1012         } 
 1013 #else 
 1014         if ((pvmmyupid = getpid()) == -1) {
 1015                 pvmlogerror("main() can't getpid()\n");
 1016                 pvmbailout(0);
 1017         }
 1018 #endif 
 1019  
 1020         (void)pvmgetroot();             /* fail here if we can't */ 
 1021  
 1022         sprintf(buf, "PVM_ARCH=%s", myarchname);
 1023         pvmputenv(STRALLOC(buf));   /* Null Pointer Dereference (ID: 2693.2745) */
 1024  
 1025         pvmmydsig = pvmgetdsig();
 1026  
 1027         ppi_config(argc, argv);
 1028  
 1029 #if defined(IMA_PGON) || defined(IMA_SP2MPI) || defined(IMA_AIX4SP2) \
 1030                 || defined(IMA_AIX5SP2) || defined(IMA_BEOLIN) 
 1031         mpp_init(&argc, argv); 
 1032 #endif 
 1033  
argv[1] <= 40951034         for (i = j = 1; i < argc; i++) {
 1035                 if (argv[i][0] == '-') {     /* Null Pointer Dereference */  /* Buffer Overrun (ID: 2971.3056) */
Preconditions
&$unknown_3916348 >= 2
$heap_267998 != 0
$heap_267998 != 61
myfmt = -1
rd = 0
$input_12 = 2
$input_429876 >= 0
$input_429884 >= 0
$input_429900 = &$unknown_3916348
$input_429900 >= 2
$input_429908 >= 0
$input_429924 >= 0
$input_429940 >= 0
$input_429948 != 48
$input_429964 >= 0
Postconditions
PASSWD_COUNTER' = 0
argc' = 2
argv' = &$heap_267987
atnewline' = 1
strlen(&buf[0])' > 0
codesonar_distance_tweak' = 2
environ' = &$heap_267990
errno' != 0
$heap_267987' = &$heap_267988
bytes_after(&$heap_267987)' = 12
$heap_267987' is allocated by malloc
$heap_267987' is a non-heap object
bytes_before(&$heap_267987)' = 0
((char*)&$heap_267987)[4]' = &$heap_267989
((char*)&$heap_267987)[8]' = 0
$heap_267988' = $input_60
bytes_after(&$heap_267988)' = $input_429876 + 1
$heap_267988' is allocated by malloc
$heap_267988' is a non-heap object
bytes_before(&$heap_267988)' = 0
strlen(&$heap_267988)' = $input_429876
$heap_267989' = $input_429892
bytes_after(&$heap_267989)' = $input_429884 + 1
$heap_267989' is allocated by malloc
$heap_267989' is a non-heap object
bytes_before(&$heap_267989)' = 0
strlen(&$heap_267989)' = $input_429884
$heap_267990' = &$heap_267992
bytes_after(&$heap_267990)' = 4 * $input_429900 + 4
$heap_267990' is allocated by malloc
$heap_267990' is a non-heap object
bytes_before(&$heap_267990)' = 0
((char*)&$heap_267990)[4]' = &$heap_267991
$heap_267991' = $input_429916
bytes_after(&$heap_267991)' = $input_429908 + 1
$heap_267991' is allocated by malloc
$heap_267991' is a non-heap object
bytes_before(&$heap_267991)' = 0
strlen(&$heap_267991)' = $input_429908
$heap_267992' = $input_429932
bytes_after(&$heap_267992)' = $input_429924 + 1
$heap_267992' is allocated by malloc
$heap_267992' is a non-heap object
bytes_before(&$heap_267992)' = 0
strlen(&$heap_267992)' = $input_429924
$heap_267993' is allocated by open
$heap_267993' is allocated
((char*)&$heap_267993)[-4096]' is open
$heap_267994' is allocated by open
$heap_267994' is allocated
((char*)&$heap_267994)[-4096]' is open
$heap_267995' is allocated by open
$heap_267995' is allocated
((char*)&$heap_267995)[-4096]' is open
$heap_267996' = $input_429948
bytes_after(&$heap_267996)' = $input_429940 + 1
$heap_267996' is allocated by malloc
$heap_267996' is a non-heap object
bytes_before(&$heap_267996)' = 0
strlen(&$heap_267996)' = $input_429940
$heap_267997' = $input_429972
bytes_after(&$heap_267997)' = $input_429964 + 1
$heap_267997' is allocated by malloc
$heap_267997' is a non-heap object
bytes_before(&$heap_267997)' = 0
strlen(&$heap_267997)' = $input_429964
$heap_267998' is allocated by malloc
$heap_267998' is allocated
bytes_before(&$heap_267998)' = 0
strlen(&$heap_267998)' = strlen(&buf[0])'
i' = 1
j' = 1
log_fd' = -1
name' = &#string0[0]
p' = &$heap_267996
pe' = 0
pvm_useruid' != -1
pvmdebmask' = $input_429956
pvmmyupid' != -1
rd' = &$heap_267997
testmode' = 0
tmbuf.tm_sec' = &$unknown_3916350




Change Warning 2972.3057 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: