Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at host.c:1108

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2519.2550
Procedure: acav
Trace: View
Modified: Wed Sep 2 12:40:08 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/ddpro.c
   Enter addhosts
 840 addhosts(mp, rmp) 
 841         struct pmsg *mp;        /* the request message */ 
 842         struct pmsg *rmp;       /* reply message blank */ 
 843 {
 844         struct hostd *hp, *hp2;
 845         struct pmsg *mp2;
 846         struct waitc *wp = 0;
 847         struct waitc_add *wxp = 0;
 848         int i, j;
 849         int count;
 850         int ngood;
 851         int ntid;
 852         struct hostent *he;
 853         int maxhostid = (tidhmask >> ffs(tidhmask) - 1);
 854         int hh;
 855         int pid;
 856         int *tids;
 857         char *winpvmdpath;
 858         char *pvmdpath;
 859         char *vmid;
 860         char *buf;
 861         int len;
 862  
 863         /*
 864         * have to lock this for 2 reasons:
 865         *  1. system can't handle overlapping host table updates,
 866         *  2. the new host tids aren't reserved 
 867         */ 
 868         if (busyadding) {
 869 /*
 870                 pvmlogerror("addhosts() already adding new hosts\n");
 871 */ 
 872                 pkint(rmp, PvmAlready);
 873                 sendmessage(rmp);
 874                 return 0;
 875         }
 876  
 877         busyadding = 1;
 878  
 879         /* sanity check count */ 
 880  
 881         if (upkint(mp, &count) || count < 1 || count > maxhostid) {
 882                 pvmlogerror("addhosts() bad msg format\n");
 883                 goto bad;
 884         }
 885  
 886         /*
 887         * make wait context, extract host list from message,
 888         */ 
 889  
 890         wp = wait_new(WT_HOSTSTART);
 891         wp->wa_tid = mp->m_src;
 892         wp->wa_dep = mp->m_wid;
 893         wxp = TALLOC(1, struct waitc_add, "waix");
 894         wxp->w_num = count;   /* Null Pointer Dereference (ID: 2522.2553) */
 895         wxp->w_hosts = TALLOC(count, struct hostd *, "waiv");
 896         BZERO((char*)wxp->w_hosts, count * sizeof(struct hostd *));   /* Null Pointer Dereference (ID: 2521.2552) */
 897         wp->wa_spec = (void *)wxp;
 898  
 899         for (i = 0; i < count; i++) {
 900                 hp = hd_new(0);
 901                 wxp->w_hosts[i] = hp;
true902                 if (upkstralloc(mp, &buf)) {
 903                         pvmlogerror("addhosts() bad msg format\n");
 904                         goto bad;
 905                 }
buf <= 4095906                 if (parsehost(buf, hp)) {
     /u1/paul/SATE/2010/c/pvm/pvm3/src/host.c
     Enter addhosts / parsehost
$param_1 <= 4095726   parsehost(buf, hp) 
 727           char *buf;
 728           struct hostd *hp;
 729   {
 730           char *av[10];           /* parsed words */ 
 731           int ac;
 732           int err = 0;
 733    
 734           ac = sizeof(av)/sizeof(av[0]);
buf <= 4095735           if (acav(buf, &ac, av)) {
       Enter addhosts / parsehost / acav
$param_1 <= 40951096     acav(s, acp, av) 
 1097             char *s;                /* the string to parse */ 
 1098             int *acp;               /* max words in, ac out */ 
 1099             char **av;              /* pointers to args */ 
 1100     {
 1101             register int ac;
s <= 40951102             register char *p = s;
 1103             register int n = *acp;
 1104      
 1105             /* separate out words of command */ 
 1106      
 1107             ac = 0;
p <= 40951108             while (*p) {     /* Null Pointer Dereference */
       Exit addhosts / parsehost / acav
     Exit addhosts / parsehost
 907                         hp->hd_err = PvmBadParam;   /* Null Pointer Dereference (ID: 2518.2549) */
 908  
 909                 } else {
 910  
 911                 /* Set unspecified fields from hostfile if available */ 
 912  
 913                         if (filehosts &&
 914                                         ((hp2 = nametohost(filehosts, hp->hd_name)) 
 915                                         || (hp2 = filehosts->ht_hosts[0])))
 916                                 applydefaults(hp, hp2);
 917                 }
 918                 PVM_FREE(buf);
Preconditions
&$unknown_329382 >= 3
busyadding = 0
Postconditions
waitlist->wa_link->wa_rlink' = &$heap_21511
waitlist->wa_link->wa_rlink->wa_link' = &$heap_21511
ac' = 10
ac' = 0
acp' = &ac
av' = &av[0]
buf' = 0
buf' = 0
busyadding' = 1
count' = &$unknown_329382
err' = 0
$heap_21511' = waitlist->wa_link
bytes_after(&$heap_21511)' = 80
$heap_21511' is allocated by malloc
$heap_21511' is allocated
bytes_before(&$heap_21511)' = 0
((char*)&$heap_21511)[20]' = 3
((char*)&$heap_21511)[24]' = 0
((char*)&$heap_21511)[56]' = 0
((char*)&$heap_21511)[64]' = 0
((char*)&$heap_21511)[72]' = &$heap_21512
((char*)&$heap_21511)[8]' = waitlist->wa_link->wa_rlink
$heap_21512' = &$unknown_329382
bytes_after(&$heap_21512)' = 16
$heap_21512' is allocated by malloc
$heap_21512' is allocated
bytes_before(&$heap_21512)' = 0
((char*)&$heap_21512)[8]' = &$heap_21513
$heap_21513' = 0
bytes_after(&$heap_21513)' = 8 * &$unknown_329382
$heap_21513' is allocated by malloc
$heap_21513' is allocated
bytes_before(&$heap_21513)' = 0
strlen(&$heap_21513)' = 0
$heap_21515' = 1
bytes_after(&$heap_21515)' = 200
$heap_21515' is allocated by malloc
bytes_before(&$heap_21515)' = 0
strlen(&$heap_21515)' = 0
((char*)&$heap_21515)[136]' = &$heap_21518
((char*)&$heap_21515)[152]' = 1
((char*)&$heap_21515)[168]' = 1000
((char*)&$heap_21515)[176]' = 0
((char*)&$heap_21515)[88]' = 2
((char*)&$heap_21515)[104]' = 1
((char*)&$heap_21515)[108]' = 1
((char*)&$heap_21515)[112]' = &$heap_21516
((char*)&$heap_21515)[120]' = &$heap_21517
bytes_after(&$heap_21516)' = 184
$heap_21516' is allocated by malloc
$heap_21516' is allocated
bytes_before(&$heap_21516)' = 0
((char*)&$heap_21516)[16]' = 0
((char*)&$heap_21516)[176]' = 0
((char*)&$heap_21516)[24]' = 0
((char*)&$heap_21516)[32]' = 0
((char*)&$heap_21516)[40]' = 0
bytes_after(&$heap_21517)' = 184
$heap_21517' is allocated by malloc
$heap_21517' is allocated
bytes_before(&$heap_21517)' = 0
((char*)&$heap_21517)[16]' = 0
((char*)&$heap_21517)[176]' = 0
((char*)&$heap_21517)[24]' = 0
((char*)&$heap_21517)[32]' = 0
((char*)&$heap_21517)[40]' = 0
bytes_after(&$heap_21518)' = 184
$heap_21518' is allocated by malloc
$heap_21518' is allocated
bytes_before(&$heap_21518)' = 0
((char*)&$heap_21518)[16]' = 0
((char*)&$heap_21518)[176]' = 0
((char*)&$heap_21518)[24]' = 0
((char*)&$heap_21518)[32]' = 0
((char*)&$heap_21518)[40]' = 0
hp' = &$heap_21515
hp' = &$heap_21515
maxhostid' >= 3
maxhostid' >= &$unknown_329382
mp' = $param_1
n' = 10
p' = 0
rmp' = $param_2
s' = 0
wp' = &$heap_21511
wxp' = &$heap_21512




Change Warning 2519.2550 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: