Find Jobs
Hire Freelancers

Heap Overflow

$30-250 USD

Completed
Posted about 3 years ago

$30-250 USD

Paid on delivery
Alice wrote a heap management library, and she uses the following data structures to manage heap: struct heap_sector { int size; // size of the heap sector char *sector; // pointer to the first char struct heap_sector *prev; // pointer to previous sector struct heap_sector *next; // pointer to next sector }; struct heap_sector *heap_free; // pointer to the list of free heap memory struct heap_sector *heap_used; // pointer to the list of used heap memory And use the following logic to manage memory: • heap used is initialized as NULL, and heap free is initialised to the first available byte; • malloc(int n) function always allocates the first a few memory sectors whose size is larger than sizeof(struct heap sector) + 1 (until the total size equals to n) to user process, and moves the memory from heap free to heap used; if there is no enough space to allocate, it returns NULL; • free(char* h) will free the corresponding heap and move the memory from heap used to heap free. Answer the following questions: Please write the pseudo code for malloc(int n) and free(char* h); • The design is potentially vulnerable to integer overflow. Please explain how this may happen, and how your pseudo code avoids this problem. • The design is potentially vulnerable to heap overflow. Please explain how it may happen and how your pseudo code avoids such problems. • The design is potentially vulnerable to off-by-one attack. Please explain how this attack may happen and how your pseudo code avoids such problems. • The design is potentially vulnerable to TOCTTOU problem. Please explain how it may happen and how your design avoids such problems. • Users may free the allocated memory twice or multiple times. Please explain how your design can prevent this.
Project ID: 30123439

About the project

2 proposals
Remote project
Active 3 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello I check your project requirements, I'm qualified for this task. Let me assist you with this task this time , I'm happy to assist you . Thanks
$150 USD in 1 day
5.0 (1 review)
2.2
2.2
2 freelancers are bidding on average $200 USD for this job
User Avatar
Hi there, I'm bidding on your project "Heap Overflow" please leave a message on my chat so we can discuss the budget and deadline of the project. I have read your project description and i'm confident i can do this project for you perfectly. Thanks Note: This is not an automated bid and i'm ready to discuss your project right now. ..
$250 USD in 4 days
5.0 (31 reviews)
7.1
7.1

About the client

Flag of UNITED STATES
Iselin, United States
5.0
4
Payment method verified
Member since May 7, 2020

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.