Changeset 140 for trunk/lib


Ignore:
Timestamp:
02/09/09 14:53:39 (16 years ago)
Author:
tim
Message:

Misc error message changes.

Added and removed some comments.

Updated TODO list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/regfi.c

    r139 r140  
    200200  if(fo != ret_val)
    201201    fo[-1] = '\0';
    202 
    203   /* XXX: what was this old VI flag for??
    204      XXX: Is this check right?  0xF == 1|2|4|8, which makes it redundant...
    205   if (flags == 0xF) {
    206     if (some) strcat(flg_output, " ");
    207     some = 1;
    208     strcat(flg_output, "VI");
    209   }
    210   */
    211202
    212203  return ret_val;
     
    814805  ret_val->magic[1] = sk_header[1];
    815806
    816   /* XXX: Can additional validation be added here? */
    817807  ret_val->unknown_tag = SVAL(sk_header, 0x2);
    818808  ret_val->prev_sk_off = IVAL(sk_header, 0x4);
     
    821811  ret_val->desc_size = IVAL(sk_header, 0x10);
    822812
     813  if(ret_val->prev_sk_off != (ret_val->prev_sk_off & 0xFFFFFFF8)
     814     || ret_val->next_sk_off != (ret_val->next_sk_off & 0xFFFFFFF8))
     815  {
     816    regfi_add_message(file, REGFI_MSG_WARN, "SK record's next/previous offsets"
     817                      " are not a multiple of 8 while parsing SK record at"
     818                      " offset 0x%.8X.", offset);
     819    free(ret_val);
     820    return NULL;
     821  }
     822
    823823  if(ret_val->desc_size + REGFI_SK_MIN_LENGTH > ret_val->cell_size)
    824824  {
    825     regfi_add_message(file, REGFI_MSG_ERROR, "Security descriptor too large for"
     825    regfi_add_message(file, REGFI_MSG_WARN, "Security descriptor too large for"
    826826                      " cell while parsing SK record at offset 0x%.8X.",
    827827                      offset);
     
    886886  if((num_values * sizeof(uint32)) > cell_length-sizeof(uint32))
    887887  {
    888     regfi_add_message(file, REGFI_MSG_ERROR, "Too many values found"
     888    regfi_add_message(file, REGFI_MSG_WARN, "Too many values found"
    889889                      " while parsing value list at offset 0x%.8X.", offset);
     890    /* XXX: During non-strict, should reduce num_values appropriately and
     891     *      continue instead of bailing out.
     892     */
    890893    return NULL;
    891894  }
     
    10801083      if(nk->subkeys == NULL)
    10811084      {
    1082         /* XXX: Should we free the key and bail out here instead? 
    1083          *      During nonstrict?
    1084          */
     1085        regfi_add_message(file, REGFI_MSG_WARN, "Could not load subkey list"
     1086                          " while parsing NK record at offset 0x%.8X.", offset);
    10851087        nk->num_subkeys = 0;
    10861088      }
     
    18431845     || (strict && ret_val->cell_size != (ret_val->cell_size & 0xFFFFFFF8)))
    18441846  {
    1845     regfi_add_message(file, REGFI_MSG_ERROR, "A length check failed while"
     1847    regfi_add_message(file, REGFI_MSG_WARN, "A length check failed while"
    18461848                      " parsing NK record at offset 0x%.8X.", offset);
    18471849    free(ret_val);
     
    19611963                        offset);
    19621964    }
    1963     /* XXX: Should add this back and make it more strict?
    1964     if(strict && ret_val->classname == NULL)
    1965         return NULL;
    1966     */
     1965
     1966    if(ret_val->classname == NULL)
     1967    {
     1968      regfi_add_message(file, REGFI_MSG_WARN, "Could not parse class"
     1969                        " name while parsing NK record at offset 0x%.8X.",
     1970                        offset);
     1971      return NULL;
     1972    }
    19671973  }
    19681974
     
    23032309     
    23042310      if((cell_len == 0) || ((cell_len & 0xFFFFFFF8) != cell_len))
    2305         /* XXX: should report an error here. */
     2311      {
     2312        regfi_add_message(file, REGFI_MSG_ERROR, "Bad cell length encountered"
     2313                          " while parsing unallocated cells at offset 0x%.8X.",
     2314                          hbin->file_off+curr_off);
    23062315        break;
    2307      
     2316      }
     2317
    23082318      /* for some reason the record_size of the last record in
    23092319         an hbin block can extend past the end of the block
Note: See TracChangeset for help on using the changeset viewer.