static void check_guards (void *free_block, dbus_bool_t overwrite) { if (free_block != NULL) { unsigned char *block = ((unsigned char*)free_block) - GUARD_START_OFFSET; size_t requested_bytes = *(dbus_uint32_t*)block; BlockSource source = *(dbus_uint32_t*)(block + 4); unsigned int i; dbus_bool_t failed; failed = FALSE; #if 0 _dbus_verbose ("Checking %d bytes request from source %s\n", requested_bytes, source_string (source)); #endif i = GUARD_INFO_SIZE; while (i < GUARD_START_OFFSET) { dbus_uint32_t value = *(dbus_uint32_t*) &block[i]; if (value != GUARD_VALUE) { _dbus_warn ("Block of %lu bytes from %s had start guard value 0x%ux at %d expected 0x%x\n", (long) requested_bytes, source_string (source), value, i, GUARD_VALUE); failed = TRUE; } i += 4; } i = GUARD_START_OFFSET + requested_bytes; while (i < (GUARD_START_OFFSET + requested_bytes + GUARD_END_PAD)) { dbus_uint32_t value = *(dbus_uint32_t*) &block[i]; if (value != GUARD_VALUE) { _dbus_warn ("Block of %lu bytes from %s had end guard value 0x%ux at %d expected 0x%x\n", (long) requested_bytes, source_string (source), value, i, GUARD_VALUE); failed = TRUE; } i += 4; } /* set memory to anything but nul bytes */ if (overwrite) memset (free_block, 'g', requested_bytes); if (failed) _dbus_assert_not_reached ("guard value corruption"); } }
static int dconfirm(directive_t * d) { source_t * src; if (d->values[0] == NULL) return 0; d->nd = new_dir(d->values[0], d->par); confirm_common(d); if (d->values[1] != NULL) { src = source_string(d->values[1]); d->nd = parse_directory(src, d->nd); free(src); } return 1; }