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
Is this App for real?​
zhannawk [14.2K]

Answer:

Yeah?

Explanation:

I use it to do my homeworks lol

7 0
2 years ago
What did major networks do to combat audience erosion in the 1990s?
S_A_V [24]

Answer: I think is 3. They acquired cable channels. They acquired cable operators.

Explanation:

6 0
3 years ago
Is megan the stallion hot
astraxan [27]

Answer:

Explanation:

Cool

8 0
2 years ago
Read 2 more answers
How is your favorite singer and why I will give Brainliest
Lorico [155]

Answer:

Eslabon Armando

His songs hit different ;-;

5 0
2 years ago
Read 2 more answers
If you create an object using Java’s BigDecimal class, and then perform a division that results in a non-terminating decimal div
azamat

Answer:

Arithmetic Exception is the correct answer to the following blank.

Explanation:

Because the BigDecimal class is the class of the Java Programming Language that deal with the double data type numbers for the arithmetic expressions and also for the format conversions and it is the math type class of the Java Programming language which is used in arithmetic operations. So, that's why the following answer is not wrong.

3 0
3 years ago
Other questions:
  • What type of wireless connection requires an unobstructed "line of sight" between transmitter and receiver?
    8·1 answer
  • What are the features of the Outline view in Word? Select three options.
    12·2 answers
  • What are finger nails made of?-
    12·2 answers
  • Assume that an array named salarySteps whose elements are of type int and that has exactly five elements has already been declar
    12·1 answer
  • Software is the word for:
    15·1 answer
  • Which technology will a business use to figure out who accessed confidential files on a company's computer system
    12·1 answer
  • Which list shows a correct order of mathematical operations that would be used by a spreadsheet formula?
    5·2 answers
  • Does anyone know how to change your username? plz help I don't want my name on this lmo
    8·2 answers
  • HELP ME?!!?!?!?!?!?
    9·2 answers
  • Amber, a network administrator, is conducting VoIP training for other IT team members. Melanie, a new team member, is confused a
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!