Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at waitc.c:274

Categories: LANG.MEM.NPD CWE:476
Warning ID: 22026.28619
Procedure: wait_new
Trace: view
Modified: Thu Nov 26 11:27:06 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/waitc.c
   Enter wait_new
 227 struct waitc * 
 228 wait_new(kind) 
 229         int kind;
 230 {
 231         static int lastwid = 0;         /* last wid assigned */ 
 232  
 233         int startwid;                           /* to detect when we've tried all */ 
 234         int wid;
 235         struct waitc *wp, *wp2;
 236  
 237         /*
 238         * find a unique wid by incrementing lastwid and stepping through 
 239         * waitlist until we find a vacant slot.
 240         */ 
 241  
 242         if (++lastwid > widrange)
 243                 lastwid = 1;
 244         startwid = lastwid;
 245         wp = waitlist;
 246  
 247         while (1) {
 248                 wid = widbase + lastwid;
 249                 while (wp->wa_wid < wid)   /* Use After Free (ID: 22062.28796) */
 250                         if ((wp = wp->wa_link) == waitlist)
 251                                 break;
 252  
 253                 if (wp->wa_wid != wid)
 254                         break;
 255  
 256                 if (++lastwid > widrange) {
 257                         lastwid = 1;
 258                         wp = waitlist;
 259                 }
 260                 if (lastwid == startwid) {
 261                         pvmlogprintf("wait_new() out of wids\n");
 262                         pvmbailout(0);          /* XXX this is kinda harsh */ 
 263                 }
 264         }
 265  
 266         /*
 267         * initialze new w context and add to list 
 268         */ 
 269  
true270         if (!(wp2 = TALLOC(1, struct waitc, "wait"))) {
 271                 pvmlogprintf("wait_new() can't get memory\n");
 272                 pvmbailout(0);
 273         }
wp2 <= 4095274         wp2->wa_wid = wid;     /* Null Pointer Dereference */
Preconditions
*$unknown_3923 != waitlist
widrange >= lastwid + 1
Postconditions
startwid' = lastwid + 1
wid' >= ((char*)$unknown_3923)[8] + 1
wid' <= ((char*)*$unknown_3923)[8]
wid' <= ((char*)*$unknown_3923)[8] - 1
wp' = *$unknown_3923
wp2' = 0




Change Warning 22026.28619 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: