Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at ddpro.c:907

Categories: LANG.MEM.NPD CWE:476
Warning ID: 22054.28725
Procedure: addhosts
Trace: view
Modified: Thu Nov 26 11:27:36 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/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: 22059.28730) */
 895         wxp->w_hosts = TALLOC(count, struct hostd *, "waiv");   /* Integer Overflow of Allocation Size (ID: 22058.28729) */
 896         BZERO((char*)wxp->w_hosts, count * sizeof(struct hostd *));   /* Null Pointer Dereference (ID: 22057.28728) */
 897         wp->wa_spec = (void *)wxp;
 898  
 899         for (i = 0; i < count; i++) {
true900                 hp = hd_new(0);
 901                 wxp->w_hosts[i] = hp;
 902                 if (upkstralloc(mp, &buf)) {
 903                         pvmlogerror("addhosts() bad msg format\n");
 904                         goto bad;
 905                 }
 906                 if (parsehost(buf, hp)) {
hp <= 4095907                         hp->hd_err = PvmBadParam;     /* Null Pointer Dereference */
 908  
 909                 } else {
 910  
 911                 /* Set unspecified fields from hostfile if available */ 
 912  
 913                         if (filehosts &&
 914                                         ((hp2 = nametohost(filehosts, hp->hd_name))   /* Null Pointer Dereference (ID: 22053.28724) */
 915                                         || (hp2 = filehosts->ht_hosts[0])))
 916                                 applydefaults(hp, hp2);
 917                 }
 918                 PVM_FREE(buf);
Preconditions
&$unknown_373189 >= 2
&$unknown_373193 >= 1
busyadding = 0
$heap_56986 != 0
strlen(&$heap_56986) != 0
widrange <= lastwid
Postconditions
atnewline' = 1
buf' = &$heap_56986
busyadding' = 1
count' = &$unknown_373189
$heap_56982' = $unknown_373190
bytes_after(&$heap_56982)' = 48
$heap_56982' is allocated by malloc
$heap_56982' is allocated
bytes_before(&$heap_56982)' = 0
((char*)&$heap_56982)[16]' = 0
((char*)&$heap_56982)[36]' = 0
((char*)&$heap_56982)[40]' = 0
((char*)&$heap_56982)[4]' = ((char*)$unknown_373190)[4]
((char*)&$heap_56982)[44]' = &$heap_56983
((char*)&$heap_56982)[8]' >= ((char*)&$unknown_373190)[8] + 1
((char*)&$heap_56982)[12]' = 3
$heap_56983' = &$unknown_373189
bytes_after(&$heap_56983)' = 8
$heap_56983' is allocated by malloc
$heap_56983' is allocated
bytes_before(&$heap_56983)' = 0
((char*)&$heap_56983)[4]' = &$heap_56984
$heap_56984' = 0
bytes_after(&$heap_56984)' = 4 * &$unknown_373189
$heap_56984' is allocated by malloc
$heap_56984' is allocated
bytes_before(&$heap_56984)' = 0
bytes_after(&$heap_56986)' = &$unknown_373193
$heap_56986' is allocated by malloc
bytes_before(&$heap_56986)' = 0
hp' = 0
maxhostid' >= 2
maxhostid' >= &$unknown_373189
wp' = &$heap_56982
wxp' = &$heap_56983




Change Warning 22054.28725 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: