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]
2 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]2 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
The fall of the Berlin Wall and the emergence of a way to find things on the Web through the Netscape browser were two that was
Romashka-Z-Leto [24]
<h2>Answer:</h2>

Option 4. a way for software to communicate and become interactive

is the correct answer.

<h2>Explanation:</h2>

<h2>The fall of the Berlin Wall and the emergence of a way to find things on the Web through the Netscape browser were two that was browser were two events that flattened the world. A third platform was needed to change the world and that was a way for software to communicate and become interactive.</h2><h2 />

This question belongs to the advent of software and technology that has made world a global village. The factors that played important roles are Fall of Berlin wall and Netscape browser.

The third thing the added to connectivity among people is the production of softwares like Skype and other social applications that made it easier for people to interact with other and communicate faster.

<h2>i hope it will help you!</h2>
5 0
3 years ago
What is the definition of "potential energy"?
muminat
Well potential energy is energy that is in a object while its not moving so i would go your third option 
4 0
3 years ago
Read 2 more answers
Again, suppose that n and r denote integer values where r &gt; 0 and n ≥ 0. What are two "simple" values, say lowEnough and tooH
enyata [817]

Answer:

Answer explained

Explanation:

From the previous question we know that while searching for n^(1/r) we don't have to look for guesses less than 0 and greater than n. Because for less than 0 it will be an imaginary number and for rth root of a non negative number can never be greater than itself. Hence lowEnough = 0 and tooHigh = n.

we need to find 5th root of 47226. The computation of root is costlier than computing power of a number. Therefore, we will look for a number whose 5th power is 47226. lowEnough = 0 and tooHigh = 47226 + 1. Question that should be asked on each step would be "Is 5th power of number < 47227?" we will stop when we find a number whose 5th power is 47226.

6 0
2 years ago
Cuthbert Industrials, Inc., prepares 3-year comparative financial statements. In Year 3, Cuthbert discovered an error in the pre
Lelechka [254]

Answer:

Restate financial statement for the first and second year.

Prepare financial statement of year 3 reflecting the effects of error from year one and two

Explanation:

A revision of the the entire financial statement from year one will be helpfull, when this is re-stated for the first and second year. Then in stating the amount of assets and liabilities carried into year three, the cummulative effect of the error from the previous two years should be reflected.

8 0
2 years ago
Whats the name of the windows 10 nucleus
stepan [7]

Answer:

motheboard

Explanation:

7 0
3 years ago
Other questions:
  • A four year old laptop will not boot and presents error messages on the screen
    8·1 answer
  • The network layer of the Internet model uses the _____________ protocol to route messages though the network.
    13·1 answer
  • Which one is correct?
    7·2 answers
  • What is a computer dedicated to a single function, such as a calculator or computer game? A. TabletB. PDAC.ApplianceD. Minicompu
    6·1 answer
  • Select the correct answer from each drop-down menu.
    8·1 answer
  • What is motivation and state the two forms​
    14·1 answer
  • When looking at security standard and compliance, which three (3) are characteristics of best practices, baselines and framework
    8·1 answer
  • Write a definition in your own words for intranet. Please don't copy and paste.
    7·2 answers
  • Write a Python class that inputs a polynomial in standard algebraic notation and outputs the first derivative of that polynomial
    9·1 answer
  • How to execute python code in command prompt *window*?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!