Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at tdpro.c:634

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2698.2750
Similar Warnings: 2698.2751
Procedure: tm_connect
Trace: View
Modified: Wed Sep 2 12:43:49 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/tdpro.c
   Enter tm_connect
 536 tm_connect(tp, mp) 
 537         struct task *tp;
 538         struct pmsg *mp;
 539 {
 540         int ver;                                                /* task's libpvm t-d proto version */ 
 541         char authfn[PVMTMPNAMLEN];      /* t-auth file name */ 
 542         int d;
 543         int cc;
 544  
 545         if (upkint(mp, &ver) || upkstr(mp, authfn, sizeof(authfn))) {
 546                 pvmlogerror("tm_connect() bad msg format\n");
 547                 goto bail;
 548         }
 549  
 550         /*
 551         *       if protocols are not compatible, send nack 
 552         *       context will get flushed after reply is sent 
 553         */ 
 554  
 555         if (ver != TDPROTOCOL) {
 556                 pvmlogprintf("tm_connect() t-d protocol mismatch (%d/%d)\n",
 557                         ver, TDPROTOCOL);
 558  
 559                 mp = replymessage(mp);
 560                 pkint(mp, TDPROTOCOL);
 561                 pkint(mp, 0);
 562                 pkstr(mp, "");
 563                 mp->m_flag |= MM_PRIO;   /* Null Pointer Dereference (ID: 2698.2751) */
 564                 mesg_to_task(tp, mp);
 565                 pmsg_unref(mp);
   ...
 569 #ifdef NOPROT 
 570         tp->t_authnam = TALLOC(PVMTMPNAMLEN, char, "auth");
 571         (void)PVMTMPNAMFUN(tp->t_authnam); 
 572 #else 
 573  
 574         /*
 575         *       write in t-auth file, create empty d-auth file that task 
 576         *       must write and we'll check later 
 577         */ 
 578  
 579         if ((d = open(authfn, O_WRONLY, 0)) == -1) {
 580                 pvmlogperror("tm_connect() can't open t-auth file");
 581                 goto bail;
 582         }
 583         cc = write(d, authfn, 1);
 584         if (cc != 1) {
 585                 if (cc == -1)
 586                         pvmlogperror(authfn);
 587                 pvmlogerror("tm_connect() can't write t-auth file\n");
 588         }
 589         (void)close(d);
 590  
 591         tp->t_authnam = TALLOC(PVMTMPNAMLEN, char, "auth");
   ...
 613  
 614         mp = replymessage(mp);
 615         pkint(mp, TDPROTOCOL);
 616         pkint(mp, 1);
 617         pkstr(mp, tp->t_authnam);
 618         mp->m_flag |= MM_PRIO;
 619         mesg_to_task(tp, mp);
 620         pmsg_unref(mp);
 621         return 0;
 622  
 623 bail: 
 624  
 625         tp->t_flag |= TF_CLOSE;
 626  
 627         /* better send a failure notification to the task... */ 
 628         /* (is this a good idea, or better to let task hang, */ 
 629         /* i.e. for security purposes - unresponsiveness...?) */ 
true630         mp = replymessage(mp);
 631         pkint(mp, TDPROTOCOL);
 632         pkint(mp, 0);
 633         pkstr(mp, "");
mp <= 4095634         mp->m_flag |= MM_PRIO;     /* Null Pointer Dereference */
Preconditions
&$unknown_907155 = 0
&$unknown_907156 = 0
&$unknown_907157 = 0
numpmsgs = 0
Postconditions
authfn[0]' is opened
d' = -1
freepmsgs.m_link' = &freepmsgs.m_link
freepmsgs.m_rlink' = &freepmsgs.m_link
mp' = 0
tp' = $param_1
ver' = 1318




Change Warning 2698.2750 : Null Pointer Dereference

Because they are very similar, this warning shares annotations with warning 2698.2751.

Priority:
State:
Finding:
Owner:
Note: