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
To enter new code that performs as intended in the place of the old code that produces an error is the goal of
Tanzania [10]

Answer:

Fixing code in a software program.

Explanation:

It is regarded the easiest application development method, that is in many cases the standard (method)

Fixing code well into the software program because they came to realize that there was some error while they compose the program, then he will modify the program and then they will fix that again.

5 0
3 years ago
Which feature of a typical professional networking site helps users add professional details to their profile?
BigorU [14]
That's a good question I think it's LinkedIn where they have professional profiles
5 0
3 years ago
Read 2 more answers
Which of the following is NOT a reason to include comments in programs
wel

Answer:

C. Comments help document how code was written for other programmers to use.

Explanation:

I think it i C.

7 0
3 years ago
Read 2 more answers
Which action should you take when sending a large attachment?
zlopas [31]
Cancel out other tasks, let the internet focus upon the one attachment.
7 0
3 years ago
You upgrade your office graphics workstation with more memory. You replace two of the four inexpensive memory chips with expensi
Gennadij [26K]

Answer:

the two other inexpensive memory chips don't calibrate with the two expensive memory chips because they're not the same

Explanation:

3 0
3 years ago
Other questions:
  • The tuning systems were not always reliable during the Baroque period. Why did composers use key signatures?
    10·1 answer
  • Vanessa and Marie are best friends. Vanessa tells Marie that one of their classmates has been posting nasty comments about Vanes
    10·2 answers
  • The CPU (central processing unit), also known as a processor, is considered the brain of the computer. What is the CPU’s functio
    6·1 answer
  • John is a mechanical engineer. His first task at his job is to build any microphone of his choice. He chooses to build a dynamic
    12·1 answer
  • Ian recently earned his security certification and has been offered a promotion to a position that requires him to analyze and d
    6·1 answer
  • The technology dealing with robots is called
    6·1 answer
  • 54 points!!! Cyber security
    14·1 answer
  • I need answer for this urgent plsdsss
    10·2 answers
  • _____________programs and features are often integrated into video editing software.
    13·1 answer
  • What is the role of a control in a system that is functioning correctly
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!