- Timestamp:
- 03/04/09 16:14:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/reglookup-recover.c
r150 r151 263 263 uint32 virt_offset, i, stack_size, ret_val_size, ret_val_used; 264 264 uint32 max_length; 265 /* A little hack so we don't have to walk a quoted string twice. */ 266 struct name_holder 267 { 268 char* quoted_name; 269 uint32_t length; 270 }; 271 struct name_holder* path_element; 272 265 REGFI_BUFFER* path_element; 273 266 274 267 /* The path_stack size limit should guarantee that we don't recurse forever. */ … … 298 291 virt_offset = cur_ancestor->parent_off; 299 292 300 path_element = talloc(path_stack, struct name_holder);293 path_element = talloc(path_stack, REGFI_BUFFER); 301 294 if(path_element != NULL) 302 path_element-> quoted_name =quote_string(cur_ancestor->keyname,295 path_element->buf = (uint8*)quote_string(cur_ancestor->keyname, 303 296 key_special_chars); 304 297 305 if(path_element == NULL || path_element-> quoted_name== NULL298 if(path_element == NULL || path_element->buf == NULL 306 299 || !void_stack_push(path_stack, path_element)) 307 300 { … … 316 309 * 16 bits and the max depth is 512. 317 310 */ 318 path_element->len gth = strlen(path_element->quoted_name);319 ret_val_size += path_element->len gth+ 1;311 path_element->len = strlen((char*)path_element->buf); 312 ret_val_size += path_element->len + 1; 320 313 321 314 regfi_free_key(cur_ancestor); … … 338 331 path_element = void_stack_pop(path_stack); 339 332 snprintf(ret_val+ret_val_used, ret_val_size-ret_val_used, 340 "/%s", path_element-> quoted_name);341 ret_val_used += path_element->len gth+ 1;342 free(path_element-> quoted_name);333 "/%s", path_element->buf); 334 ret_val_used += path_element->len + 1; 335 free(path_element->buf); 343 336 talloc_free(path_element); 344 337 } … … 471 464 REGFI_VK_REC* vk; 472 465 const REGFI_HBIN* hbin; 466 REGFI_BUFFER data; 473 467 uint32 i, off, data_offset, data_maxsize; 474 468 … … 488 482 if(vk->data_in_offset) 489 483 { 490 vk->data = regfi_parse_data(f, vk->type, vk->data_off, 491 vk->data_size, 4, 492 vk->data_in_offset, false); 484 data = regfi_parse_data(f, vk->type, vk->data_off, 485 vk->data_size, 4, 486 vk->data_in_offset, false); 487 vk->data = data.buf; 488 vk->data_size = data.len; 493 489 } 494 490 else if(range_list_has_range(unalloc_cells, off, vk->data_size)) … … 499 495 data_offset = vk->data_off+REGFI_REGF_SIZE; 500 496 data_maxsize = hbin->block_size + hbin->file_off - data_offset; 501 vk->data = regfi_parse_data(f, vk->type, data_offset, 502 vk->data_size, data_maxsize, 503 vk->data_in_offset, false); 497 data = regfi_parse_data(f, vk->type, data_offset, 498 vk->data_size, data_maxsize, 499 vk->data_in_offset, false); 500 vk->data = data.buf; 501 vk->data_size = data.len; 502 504 503 if(vk->data != NULL) 505 504 { … … 509 508 * wrong. Need a feedback mechanism to be more fuzzy with 510 509 * data cell lengths and the ranges removed. 510 * 511 * The introduction of REGFI_BUFFER in regfi_parse_data has 512 * fixed some of this. Should review again with respect to 513 * the other issues mentioned above though. 511 514 */ 512 515 /* A data record was recovered. Remove from unalloc_cells. */
Note: See TracChangeset
for help on using the changeset viewer.