Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Buffer Overrun  at cons.c:423

Categories: LANG.MEM.BO CWE:120 CWE:121 CWE:122 CWE:126
Warning ID: 496.29277
Procedure: main
Trace: view
Modified: Thu Nov 26 11:36:45 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
   /kat0/fletcher/SATE/2010/pvm3/console/cons.c
   Enter main
$input_694076 > 1016290 main(argc, argv) 
 291         int argc;
 292         char **argv;
 293 {
 294         static struct timeval more_msgs = { 0, 0 };
 295         char cmd[1024];
 296         int cc;
 297         int i;
 298         int src, cod, len;
 299         char *p;
 300         FILE *ff;
 301 #ifdef FDSETNOTSTRUCT 
 302         fd_set rfds, fds;
 303 #else 
 304         struct fd_set rfds, fds; 
 305 #endif 
 306         int nfds;
 307         int n;
$input_694084 > 1016308         int *np = 0;
 309         struct pvmminfo minfo;
 310         struct timeval *timeout;
 311         int more;
 312         int ac;
 313         char *av[128];
 314  
 315 #ifdef WIN32 
 316  
 317         /* WSAStartup has to be called before any socket command */ 
 318         /* can be executed. Why ? Ask Bill */ 
   ...
 355                         fprintf(stderr,  
 356                                 "SET CYGWIN=tty   (Cygwin B20)\n");
 357                         fprintf(stderr,  
 358                                 "SET CYGWIN32=tty (Cygwin B19)\n");
 359                         exit(1);
 360                 }
 361         }               
 362  
 363 #endif 
 364  
$input_694092 > 1016365         pvm_setopt(PvmResvTids, 1);
 366  
$input_694236 > 1016367         aliases = TALLOC(1, struct alias, "alias");
$input_694268 > 1016368         BZERO((char*)aliases, sizeof(struct alias));   /* Null Pointer Dereference (ID: 497.29278) */
$input_694300 > 1016369         aliases->a_link = aliases->a_rlink = aliases;
 370  
$input_694316 > 1016371         if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'd')
$input_694340 > 1016372                 pvm_setopt(PvmDebugMask, pvmstrtoi(argv[1] + 2));
 373  
 374         pvm_setopt(PvmRoute, PvmDontRoute);
 375  
 376         pvm_setopt(PvmSelfTraceTid, -1);
 377         pvm_setopt(PvmSelfOutputTid, -1);
 378  
 379         i = pvm_setopt(PvmAutoErr, 0);
 380         cc = pvm_start_pvmd(argc - 1, argv + 1, 1);
 381         if (cc < 0) {
 382                 if (cc != PvmDupHost) {
 383                         pvm_perror("Console");
 384                         exit(1);
 385                 }
 386                 printf("pvmd already running.\n");
 387         }
 388         pvm_setopt(PvmAutoErr, i);
 389  
 390         if ((mytid = pvm_mytid()) < 0)
 391                 exit(1);
 392  
 393         (void)signal(SIGINT, SIG_IGN);
 394         /* (void)signal(SIGTERM, SIG_IGN); now PvmNoReset */ 
 395  
 396 #ifndef WIN32   /* NT console problem - original NT codes had commented out */ 
 397         pvm_setopt( PvmNoReset, 1 );
 398         pvm_setopt( PvmTraceOptions, PvmTraceFull );
 399         pvm_setopt( PvmTraceBuffer, 0 );
 400 #endif 
 401         job_init();
 402  
 403         /* set default trace mask to xpvm */ 
 404         sprintf(cmd, "trace xpvm");
 405         ac = sizeof(av)/sizeof(av[0]) - 1;
 406         if (!acav(cmd, &ac, av) && ac)
 407                 trace_cmd(ac, av);
 408  
 409         pvm_notify(PvmHostAdd, HostsAddedTag, -1, (int*)0);
 410  
 411         BZERO(&minfo, sizeof(minfo));
 412         minfo.src = -1;
 413         minfo.ctx = -1;
 414         minfo.tag = MyExitTag;
 415  
 416 #ifndef WIN32   /* NT console problem - original NT codes had commented out */ 
 417         pvm_addmhf(minfo.src, minfo.tag, minfo.ctx, exit_handler);
$input_12 > 1016418         pvm_notify(PvmTaskExit, MyExitTag, 1, &mytid);
 419 #endif 
 420  
 421         if (!(p = getenv("HOME")))
 422                 p = ".";
strlen(p) > 1016423         sprintf(cmd, "%s/.pvmrc", p);     /* Buffer Overrun */
Preconditions
argc >= 2
argv[1][2] != 48
argv[1][1] = 100
*argv[1] = 45
strlen(argv[1]) != 0
strlen(argv[1]) != 1
cmd[0] != 0
cmd[0] != 35
joblist = 0
pvmautoerr != 2
pvmautoerr != 3
pvmtoplvl = 0
$input_694396 >= 0
Postconditions
ac' = 1
aliases' = &$heap_443154
av[0]' = &cmd[0]
cc' = -28
cmd[10]' = 0
$heap_443154' = &$heap_443154
bytes_after(&$heap_443154)' = 24
$heap_443154' is allocated by malloc
$heap_443154' is allocated
bytes_before(&$heap_443154)' = 0
((char*)&$heap_443154)[4]' = &$heap_443154
bytes_after(&$heap_443155)' = 28
$heap_443155' is allocated by malloc
$heap_443155' is allocated
bytes_before(&$heap_443155)' = 0
$heap_443156' = $input_444
bytes_after(&$heap_443156)' = $input_694396 + 1
$heap_443156' is allocated by malloc
$heap_443156' is a non-heap object
bytes_before(&$heap_443156)' = 0
strlen(&$heap_443156)' = $input_694396
joblist' = &$heap_443155
minfo.len' = 0
minfo.src' = -1
minfo.ctx' = -1
minfo.tag' = 1
mytid' >= 0
np' = 0
p' = &$heap_443156
pvm_errno' = -14
pvmrescode' = 1




Change Warning 496.29277 : Buffer Overrun

Priority:
State:
Finding:
Owner:
Note: