Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at ddpro.c:2125

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2561.2593
Procedure: startack
Trace: View
Modified: Wed Sep 2 12:41:20 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 startack
 2056 startack(wp, mp) 
 2057         struct waitc *wp;               /* wait context on hoster */ 
 2058         struct pmsg *mp;
 2059 {
 2060         struct hostd *hp;
 2061         struct pmsg *mp2;
 2062         struct waitc *wp2;              /* seed waitc for htupd peer group */ 
 2063         struct waitc *wp3;
 2064         int count;                              /* num of new hosts */ 
 2065         int happy;                              /* num of happy new hosts */ 
 2066         struct waitc_add *wxp;
   ...
 2070         int i, j;
 2071         int t;
 2072         int hh;
 2073         char *buf;
 2074         char buf2[256];
 2075  
 2076         /*
 2077         * unpack startup results, update hosts in wait context 
 2078         */ 
 2079  
 2080         wxp = (struct waitc_add *)wp->wa_spec;
 2081         count = wxp->w_num;
 2082         upkint(mp, &j);
 2083  
 2084         while (j-- > 0) {
 2085                 if (upkuint(mp, &t) || upkstralloc(mp, &buf)) {
 2086                         pvmlogerror("startack() bad message format\n");
 2087                         pkint(wp->wa_mesg, PvmDSysErr);
 2088                         sendmessage(wp->wa_mesg);
 2089                         wp->wa_mesg = 0;
 2090                         wait_delete(wp);
 2091                         busyadding = 0;
 2092                         return 0;
 2093                 }
 2094                 for (i = count; i-- > 0 && wxp->w_hosts[i]->hd_hostpart != t; ) ;
 2095                 if (i < 0) {
 2096                         pvmlogprintf("startack() what? some random tid %x\n", t);
 2097                         pkint(wp->wa_mesg, PvmDSysErr);
 2098                         sendmessage(wp->wa_mesg);
 2099                         wp->wa_mesg = 0;
 2100                         wait_delete(wp);
 2101                         busyadding = 0;
 2102                         PVM_FREE(buf);   /* Free Null Pointer (ID: 2562.2594) */
 2103                         return 0;
 2104                 }
 2105                 hp = wxp->w_hosts[i];
 2106                 ac = sizeof(av)/sizeof(av[0]);
 2107                 if (crunchzap(buf, &ac, av) || ac != 5) {
 2108                         pvmlogprintf("startack() host %s expected version, got \"%s\"\n",
 2109                                         hp->hd_name, buf);
 2110                         if (!(hp->hd_err = errnamecode(buf)))
 2111                                 hp->hd_err = PvmCantStart;
 2112                         PVM_FREE(buf);
 2113                         continue;
 2114                 }
 2115  
 2116                 ver = atoi(av[0]);
 2117                 if (ver != DDPROTOCOL) {
 2118                         pvmlogprintf( 
 2119                                         "slave_exec() host %s d-d protocol mismatch (%d/%d)\n",
 2120                                         hp->hd_name, ver, DDPROTOCOL);
 2121                         hp->hd_err = PvmBadVersion;
 2122                         continue;
 2123                 }
 2124  
true2125                 hp->hd_arch = STRALLOC(av[1]);     /* Null Pointer Dereference */
Preconditions
&$unknown_603675 >= 1
&$unknown_603677 >= 1
((char*)*$param_1)[72] >= 1
strlen(&$unknown_603680) > 0
$heap_36110 != 0
strlen(&$heap_36110) != 0
$input_12 = 2316
Postconditions
ac' = 5
av[0]' = &$unknown_603680
buf' = &$heap_36110
count' = ((char*)*$param_1)[72]
bytes_after(&$heap_36110)' = &$unknown_603677
$heap_36110' is allocated by malloc
bytes_before(&$heap_36110)' = 0
i' = ((char*)*$param_1)[72] - 1
j' = &$unknown_603675 - 1
mp' = $param_2
ver' = 2316
wp' = $param_1
wxp' = ((char*)$param_1)[72]




Change Warning 2561.2593 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: