1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ann [662]
3 years ago
15

Explain in detail what this code does, Whats the flow in it, and whats the risk that its creating and what can i do to fix it? (

c language)
*please explain it like im a 5 year old and write the code because i dont know alot about buffer overflow or pointers lol <3
#include
#include
int main (int argc, char ** argv)
{
char buffer[500];
strcpy(buffer, argv[1]);

return 0;
}
Computers and Technology
1 answer:
kodGreya [7K]3 years ago
5 0

Answer:

The buffer has room for 499 characters (you always have to reserve 1 for the terminating \0 character).

The code copies all characters passed in the commandline (argv[1]) into this buffer without checking. If there are more than 499 characters supplied, these will be copied into a memory location that is not intended for it. This will probably cause your program to crash, but if the extra data is somehow executed by the processor as if it were a program, this could be a way to sneak a virus into your computer.

So, while copying data, it is important to always limit the maximum amount to the allocated space.

You might be interested in
Suppose there is a class AirConditioner. The class supports the following behaviors: turning the air conditioner on and off. The
Sunny_sXe [5.5K]

Answer:

The code is given in the explanation section

Explanation:

//Class Airconditioner

public class AirConditioner {

   private boolean turnOnOff;

//The Constructor

   public AirConditioner(boolean turnOnOff) {

       this.turnOnOff = turnOnOff;

   }

//method turn_on

   public void turn_on(){

       this.turnOnOff = true;

   }

//method turn_off

   public void turn_off( ){

       this.turnOnOff = false;

   }

}

// A new class to test the airconditional class

class AircondionTest{

   public static void main(String[] args) {

//Creating an object of the Aircondional class

       AirConditioner office_a_c = new AirConditioner(false);

//Using the reference varible to call method turn_on      

office_a_c.turn_on();

   }

}

8 0
3 years ago
which of the following formatting tools would i use if i really wanted a word to stand out in my document​
sweet-ann [11.9K]
You should change the font of that specific word to another colour. And you can also make it bold and italic. Furthermore, you may even italicize it and make the font larger.

Hope it helps :)
6 0
3 years ago
Which control chart would you use to track rejections in a maintenance projeg when bug arrival pattern is not constant?
Mkey [24]

Answer:

<u>P chart</u> is the control chart that is used to monitor the rejection or acceptance whenever the bug arrival in pattern is not constant.

Explanation:

In case of only two possible outcomes, such as yes or no, accept or reject, P chart is used as control chart to track rejections. It is used to track rejections whenever the pattern of rejection is not constant. In this type of charts we collect the information from last few days to analyze and predict the next data to track rejections.

<u>For example:</u>

If we want to know that, in admission department of the university, how many students arrives to take admission in university, does not meet the qualification criteria each week. In this case there are only two options available either they meet criteria or not. In this case we use P chart with the help of previous week data to analyze the no. of students who are meeting qualification criteria in this week.

3 0
4 years ago
Complete the paragraph below.
tiny-mole [99]

Answer:

inject, update

Explanation:

Dependency injection is a concept in object-oriented programming that links or transfers the functionality of an independent class to a dependent class.

Assuming two classes, Vehicle and Bus are created, the Bus class inherits from the Vehicle. The Bus class is dependent on the Vehicle class and its instances create instances of the Vehicle object.

It is easier and faster to update the Bus class and other classes that inherit from the Vehicle class by updating only the Vehicle class.

3 0
3 years ago
Line 9 and 10
Reika [66]

Answer:

22,332

Explanation:

The taxable income :

Line 8 = Standard deduction or itemized deduction

Line 9 = Qualified business income deduction

Line 7 = Adjusted gross income

Taxable income = Adjusted gross income - (Qualified business income deduction + standard deduction)

Taxable income = 34732 - (12400 + 0)

Taxable income = 34732 - 12400

Taxable income = 22,332

4 0
3 years ago
Other questions:
  • What was the impact of the rise of the Japanese auto industry and the semiconductor industry in south eastern​ Asia? A. It incre
    13·1 answer
  • What is the difference between a design pattern and a DLL?
    12·1 answer
  • Define a class named ComparableSquare that extends Square (defined above) and implements Comparable. Implement the compareTo met
    7·1 answer
  • What is aperture priority mode? When might you use this mode on a camera? What is depth of field? How can you adjust the depth o
    13·1 answer
  • Ashley Baker has been the webmaster for Berryhill Finance only ten days when she received an e-mail that threatened to shut down
    13·1 answer
  • Look at the picture lol
    6·2 answers
  • What is one of four key principles of Responsible Artificial Intelligence
    5·1 answer
  • Assume you have a button control named btndisplaylist. Which is the default name for an event procedure that will be executed wh
    14·1 answer
  • Michael works for a graphic design firm. He is creating an informative poster. He needs to add a great deal of text in the poste
    6·1 answer
  • Write a function called st_dev. st_dev should have one
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!