Stack overflow | Computer Science homework help


Paste the code into MIPS 

Next, please comment each line of code in the .text section. Please do this FIRST! It will make tracing through the code much easier. 

Once you understand what the code is doing, you’ll notice there is a ‘print_a’ function that is not reachable through the execution path of the code as it’s written. Your job is to devise an input that overflows the call stack and overwrites the $ra register causing the program to execute the ‘print_a’ function. Please provide the successful input that triggers the overflow, a screenshot of the successful execution of your attack that prints the A+ message, and a detailed description of how you figured out how to exploit the buffer overflow and how you devised the proper input. 

Code used for the assignment above


    str: .asciiz “You’ve earned an A+!”

    buffer: .space 28



    li $v0,8

    la $a0, buffer

    li $a1, 28

   move $t0,$a0



    move $a0, $t0

    jal print


   li $v0, 10




     addi $sp, $sp, -20

     sw $ra, 16($sp)

     sw $a0, 12($sp)


     addi $t4, $sp, 0

     la $t1, ($a0)



   lbu $t2, ($t1)

   slti $t3, $t2, 1

   beq $t2, 48, null




         sb $t2, 0($t4)

         addi $t4, $t4, 1

         addi $t1, $t1, 1

         bne $t3, 1, load_str


        li $v0, 4



        lw $ra 16($sp)

        lw $a0 12($sp)

        jr $ra



     addi $t2, $t2, -48

     j resume


    li $v0, 4

    la $a0, str


Link to the code as well:

Calculate Your Essay Price
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Enjoy 10% OFF today with the coupon code: best10