- Timestamp:
- 05/04/08 14:29:02 (17 years ago)
- Location:
- trunk/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/range_list.c
r111 r113 320 320 return true; 321 321 } 322 323 324 bool range_list_has_range(range_list* rl, uint32_t start, uint32_t length) 325 { 326 int32_t idx1, idx2; 327 328 idx1 = range_list_find(rl, start); 329 if(idx1 < 0) 330 return false; 331 332 idx2 = range_list_find(rl, start+length); 333 if(idx2 < 0) 334 return false; 335 336 if(idx1 == idx2) 337 return true; 338 339 while(idx1 != idx2) 340 { 341 if(rl->elements[idx1]->offset + rl->elements[idx1]->length 342 != rl->elements[idx1+1]->offset) 343 return false; 344 idx1++; 345 } 346 347 return true; 348 } -
trunk/lib/regfi.c
r111 r113 1665 1665 if(ret_val->flag & VK_FLAG_NAME_PRESENT) 1666 1666 { 1667 if(ret_val->name_length + REGFI_VK_MIN_LENGTH > ret_val->cell_size)1667 if(ret_val->name_length + REGFI_VK_MIN_LENGTH + 4 > ret_val->cell_size) 1668 1668 { 1669 1669 if(strict) … … 1673 1673 } 1674 1674 else 1675 ret_val->name_length = ret_val->cell_size - REGFI_VK_MIN_LENGTH ;1675 ret_val->name_length = ret_val->cell_size - REGFI_VK_MIN_LENGTH - 4; 1676 1676 } 1677 1677 1678 1678 /* Round up to the next multiple of 8 */ 1679 length = (ret_val->name_length + REGFI_NK_MIN_LENGTH) & 0xFFFFFFF8;1680 if( length < ret_val->name_length + REGFI_NK_MIN_LENGTH)1681 length+=8;1679 cell_length = (ret_val->name_length + REGFI_VK_MIN_LENGTH + 4) & 0xFFFFFFF8; 1680 if(cell_length < ret_val->name_length + REGFI_VK_MIN_LENGTH + 4) 1681 cell_length+=8; 1682 1682 1683 1683 ret_val->valuename = (char*)zalloc(sizeof(char)*(ret_val->name_length+1)); … … 1687 1687 return NULL; 1688 1688 } 1689 1690 /* Don't need to seek, should be at the right offset */ 1689 1691 1690 length = ret_val->name_length; 1692 1691 if((regfi_read(file->fd, (uint8*)ret_val->valuename, &length) != 0) … … 1700 1699 } 1701 1700 else 1702 length = REGFI_VK_MIN_LENGTH;1701 cell_length = REGFI_VK_MIN_LENGTH + 4; 1703 1702 1704 1703 if(unalloc) 1705 1704 { 1706 1705 /* If cell_size is still greater, truncate. */ 1707 if( length < ret_val->cell_size)1708 ret_val->cell_size = length;1706 if(cell_length < ret_val->cell_size) 1707 ret_val->cell_size = cell_length; 1709 1708 } 1710 1709 … … 1816 1815 break; 1817 1816 1818 if((cell_len == 0) || ((cell_len & 0xFFFFFFF C) != cell_len))1817 if((cell_len == 0) || ((cell_len & 0xFFFFFFF8) != cell_len)) 1819 1818 /* TODO: should report an error here. */ 1820 1819 break;
Note: See TracChangeset
for help on using the changeset viewer.