~ubuntu-branches/ubuntu/gutsy/syslog-ng/gutsy

« back to all changes in this revision

Viewing changes to src/filter.c

  • Committer: Bazaar Package Importer
  • Author(s): SZALAY Attila
  • Date: 2006-10-25 22:06:48 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061025220648-t39ltx1h9iyyikzs
Tags: 2.0rc3-2
Fixed NULL dereference when (Closes: #384021)

Show diffs side-by-side

added added

removed removed

Lines of Context:
189
189
    }
190
190
  else
191
191
    {
192
 
      static gchar bitpos[32] = 
 
192
      static gint8 bitpos[32] = 
193
193
      { 
194
194
        -1, -1, -1, -1, -1, -1, -1, -1, 
195
195
        -1, -1, -1, -1, -1, -1, -1, -1, 
237
237
{
238
238
  FilterPri *self = (FilterPri *) s;
239
239
  guint32 pri = msg->pri & LOG_PRIMASK;
240
 
  gint i;
241
 
  static gchar bitpos[8] = 
242
 
  {
243
 
    -1, -1, -1, -1, -1, -1, -1, -1
244
 
  };
245
240
  
246
 
  if (G_LIKELY(bitpos[pri] != -1))
247
 
    {
248
 
      return (!!(self->valid & (1 << bitpos[pri]))) ^ s->comp;
249
 
    }
250
 
  else
251
 
    {
252
 
      guint32 bits = self->valid;
253
 
          
254
 
      for (i = 0; bits && sl_levels[i].name; i++, bits >>= 1) 
255
 
        {
256
 
          if ((bits & 1) && sl_levels[i].value == pri) 
257
 
            {
258
 
              bitpos[pri] = i;
259
 
              return !self->super.comp;
260
 
            }
261
 
        }
262
 
    }
263
 
  return self->super.comp;
 
241
  return !!((1 << pri) & self->valid) ^ self->super.comp;
264
242
}
265
243
 
266
244
FilterExprNode *