Text  |   XML   |   Visible Warnings:

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

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2693.2745
Procedure: main
Trace: View
Modified: Wed Sep 2 12:43:39 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
 947 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);
true1023         pvmputenv(STRALLOC(buf));     /* Null Pointer Dereference */
Preconditions
((char*)&$heap_159160)[1] <= 120
((char*)&$heap_159160)[1] >= 48
rd != 0
$input_12 >= 1
$input_60 = 48
$input_61812 >= 0
td = 0
Postconditions
PASSWD_COUNTER' = 0
argc' = $param_1
argv' = $param_2
$heap_159160' = $input_60
bytes_after(&$heap_159160)' = $input_12 + 1
$heap_159160' is allocated by malloc
$heap_159160' is a non-heap object
bytes_before(&$heap_159160)' = 0
strlen(&$heap_159160)' = $input_12
bytes_after(&$heap_159161)' = $input_61812 + 1
$heap_159161' is allocated by malloc
$heap_159161' is a non-heap object
bytes_before(&$heap_159161)' = 0
strlen(&$heap_159161)' = $input_61812
$heap_159162' = *stored_passwd.pw_name'
$heap_159162' is allocated by malloc
$heap_159162' is allocated
bytes_before(&$heap_159162)' = 0
strlen(&$heap_159162)' = strlen(stored_passwd)'
name' = &#string0[0]
p' = &$heap_159160
pe' = &stored_passwd.pw_name
pvm_useruid' != -1
pvmmyupid' != -1
td' = &$heap_159161
testmode' = 0
username' = &$heap_159162




Change Warning 2693.2745 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: