Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Buffer Overrun  at pvmd.c:1035

Categories: LANG.MEM.BO CWE:120 CWE:121 CWE:122 CWE:126
Warning ID: 2971.3056
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
$param_1 >= ( 8 * bytes_after($param_2) + 1 ) / 64947 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  
argc >= ( 8 * bytes_after(argv) + 1 ) / 641034         for (i = j = 1; i < argc; i++) {
i >= ( 8 * bytes_after(argv) - 63 ) / 641035                 if (argv[i][0] == '-') {     /* Buffer Overrun */  /* Null Pointer Dereference (ID: 2972.3057) */
 1036                         switch (argv[i][1]) {
 1037  
 1038                         case 'd': 
 1039                                 pvmdebmask = pvmstrtoi(argv[i] + 2);
 1040                                 break;
 1041  
 1042                         case 'n': 
 1043                                 name = argv[i] + 2;
 1044                                 break;
 1045  
 1046                         case 'S': 
 1047                                 argv[j++] = argv[i];
 1048                         case 's': 
 1049                                 slavemode = 1;
 1050                                 break;
 1051  
 1052                         case 't': 
 1053                                 testmode = 1;
 1054                                 break;
 1055  
 1056 #ifdef WIN32 
 1057                         case 'u':
 1058                                 if (os_is_NT==FALSE) {
 1059                                         /* someone is on win95 ... */ 
 1060                                         argv[i]++;argv[i]++;
 1061                                         strcpy(username,argv[i]);
 1062                                 }
 1063                                 else 
 1064                                         if (strcmp(strcat("-u",username),argv[i])) {
   ...
 1066                                                                 "Provided Username(%s) does not match ",
 1067                                                                 username);
 1068                                                 fprintf(stderr,"with OS (%s).\n",
 1069                                                                 argv[i]);
 1070                                                 fprintf(stderr,"Wrong rshd ?!\n");
 1071                                                 exit(1);
 1072                                 }
 1073                                 break; 
 1074 #endif 
 1075  
 1076                         default: 
 1077                                 argv[j++] = argv[i];
 1078                         }
 1079  
 1080                 } else {
 1081                         argv[j++] = argv[i];
Preconditions
&$unknown_3915749 >= 2
myfmt = -1
rd != 0
$input_12 = &$unknown_3915748
$input_12 >= 4
$input_418428 >= 0
$input_418436 >= 0
$input_418452 >= 0
$input_418468 >= 0
$input_418484 = &$unknown_3915749
$input_418484 >= 2
$input_418492 >= 0
$input_418508 >= 0
Postconditions
PASSWD_COUNTER' = 0
argc' = &$unknown_3915748
argv' = &$heap_266224
environ' = &$heap_266229
$heap_266224' = &$heap_266225
bytes_after(&$heap_266224)' = 4 * &$unknown_3915748 + 4
$heap_266224' is allocated by malloc
$heap_266224' is a non-heap object
bytes_before(&$heap_266224)' = 0
((char*)&$heap_266224)[4]' = &$heap_266228
((char*)&$heap_266224)[8]' = &$heap_266227
((char*)&$heap_266224)[12]' = &$heap_266226
$heap_266225' = $input_60
bytes_after(&$heap_266225)' = $input_418428 + 1
$heap_266225' is allocated by malloc
$heap_266225' is a non-heap object
bytes_before(&$heap_266225)' = 0
strlen(&$heap_266225)' = $input_418428
$heap_266226' = $input_418444
bytes_after(&$heap_266226)' = $input_418436 + 1
$heap_266226' is allocated by malloc
$heap_266226' is a non-heap object
bytes_before(&$heap_266226)' = 0
strlen(&$heap_266226)' = $input_418436
$heap_266227' = $input_418460
bytes_after(&$heap_266227)' = $input_418452 + 1
$heap_266227' is allocated by malloc
$heap_266227' is a non-heap object
bytes_before(&$heap_266227)' = 0
strlen(&$heap_266227)' = $input_418452
$heap_266228' = $input_418476
bytes_after(&$heap_266228)' = $input_418468 + 1
$heap_266228' is allocated by malloc
$heap_266228' is a non-heap object
bytes_before(&$heap_266228)' = 0
strlen(&$heap_266228)' = $input_418468
$heap_266229' = &$heap_266231
bytes_after(&$heap_266229)' = 4 * $input_418484 + 4
$heap_266229' is allocated by malloc
$heap_266229' is a non-heap object
bytes_before(&$heap_266229)' = 0
((char*)&$heap_266229)[4]' = &$heap_266230
$heap_266230' = $input_418500
bytes_after(&$heap_266230)' = $input_418492 + 1
$heap_266230' is allocated by malloc
$heap_266230' is a non-heap object
bytes_before(&$heap_266230)' = 0
strlen(&$heap_266230)' = $input_418492
$heap_266231' = $input_418516
bytes_after(&$heap_266231)' = $input_418508 + 1
$heap_266231' is allocated by malloc
$heap_266231' is a non-heap object
bytes_before(&$heap_266231)' = 0
strlen(&$heap_266231)' = $input_418508
$heap_266232' is allocated by open
$heap_266232' is allocated
((char*)&$heap_266232)[-4096]' is open
$heap_266233' is allocated by malloc
$heap_266233' is allocated
bytes_before(&$heap_266233)' = 0
strlen(&$heap_266233)' = strlen(stored_passwd)'
$heap_266234' is allocated by malloc
$heap_266234' is allocated
bytes_before(&$heap_266234)' = 0
strlen(&$heap_266234)' = strlen(&buf[0])'
i' = &$unknown_3915748 - 1
log_how' = 3
p' = 0
pe' = &stored_passwd.pw_name
pvm_useruid' != -1
pvmmyupid' != -1
username' = &$heap_266233




Change Warning 2971.3056 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: