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
In 2011 a program named Watson running on an IBM supercomputer
lora16 [44]

Answer:C)Defeated the two most successful human Jeopardy! champions in a three-game match.

Explanation:  Watson emerged from the IBM supercomputer made by Thomas Watson .It is made from the two main component analytical software and the artificial intelligence which made it a optimal for the question-answer feature.

Watson defeated Ken Jennings and Brad Rutter(earlier successful contestants) in the program named Jeopardy by answering questions correctly and quickly in 2011.Other options are incorrect because it did not worked as the software engineer,humane genome or won crossword puzzle.Thus the correct option is option (c).

8 0
3 years ago
I need answer poooo<br>​
Fiesta28 [93]

Answer:

what is this?Are yhere any options for this question ❓

7 0
3 years ago
a solid state drive is a removable flash memory device that you insert and remove from a slot in a computer, mobile device, or c
yulyashka [42]
It is true, Because all the the drives or memories which doesn't have a plates spinning like hard disk are called solid state drives.
4 0
3 years ago
___________ are the constant values that are used in a program. ​
77julia77 [94]

Answer: Data

Explanation:

3 0
3 years ago
(Python question)
Law Incorporation [45]

Hey!

---------------------------------------------------

Definition:

A "for loop" is something used for repeating things over a list of items. For instance, a list or a dictionary.

Code:

colors = ["red", "green", "blue"]

for x in colors:

 print(x)

---------------------------------------------------

Definition:

A "while loop" is is something used for carrying out a set of lines that are true.

Code:

n = 1

while i < 4:

 print(n)

 n += 1

---------------------------------------------------

Real-Life Example:

A real-life example would if I was a manager or boss for a company say that everyone was off a certain day. Like, if I said everyone was off for Christmas the 25th. If I had 1000 employees that would take a very long time to send an email to everyone. Instead of sending an email to everyone I can program code that uses "for loops" and "while loops" to create a message and send it to everyone.

---------------------------------------------------

Hope This Helped! Good Luck!

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which is not an example of a boolean operator?
    6·2 answers
  • Select the correct answer.
    8·2 answers
  • One of the difficult decisions a systems analyst has to make when it comes to software is whether to recommend making, buying, o
    8·1 answer
  • Jason wants to open a program with the command prompt window. Which command should he type in the Run dialog box to open the com
    10·1 answer
  • If I put a short clip from a copyrighted video to Facebook and make it only viewable to friends, is that illegal?
    12·1 answer
  • Examine the exhibit above. "Device A" is an 8-port layer 2 managed switch and "Device C" is a 4-port hub. Which of the following
    13·1 answer
  • Two threads try to acquire the same resource at the same time and both are blocked. Then, they continually change their states i
    14·1 answer
  • Examples of analog computer
    8·1 answer
  • In the second example with modulus math, why can't Eve find the solution?
    10·1 answer
  • What is the purpose of the Subtotal feature?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!