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
Sql is an example of a ________ category programming language. 4gl 3gl 5gl 2gl
kicyunya [14]
The answer is Fourth-generation language (4GL).  <span>Sql is an example of a 4GL category programming language.  </span>SQL<span> is considered a Fourth-generation </span>language<span> (</span>4GL), whereas Java and C++ are third-generation languages<span> (3GLs). Fourth-generation </span>languages<span> are programming  </span>languages<span> that are closer to human </span>language<span> than the high-level </span>languages<span>  like Java.</span>
8 0
3 years ago
A. True
Artist 52 [7]

This is true. In some languages, constructors can be made private to restrict the ways in which objects can be created.

4 0
3 years ago
Local laws passed councils are called
anzhelika [568]
An ordinance is the name typically used for a law passed by a local political subdivision, such as a city, county, village, or town. Ordinances may address a wide variety of local issues, from local government structure to speed limits and sign sizes.
4 0
3 years ago
What does 32mb SVGA do
Nadya [2.5K]

Answer:

hope it helps PLZ MARK ME BRAINLIEST,,!

Explanation:

They stabilize your grpahic image.

5 0
2 years ago
2. A host computer with an IP address of 172.16.29.155 using a subnet mask of 255.255.255.0 and a gateway of 172.16.29.1 pings a
ASHA 777 [7]

Answer:

From the host IP address and subnet mask, you can tell that both computers are on the same network. Host 172.16.29.155 will need to send an ARP request broadcast for 172.16.29.83 to get the MAC address and update its ARP table if the host 172.16.29.83 has not already done so.

Explanation:

<h2>ADDRESS RESOLUTION PROTOCOL (ARP)</h2>

Address Resolution Protocol (ARP) is a procedure for mapping a logical address known as the IP address to a physical address known as MAC (Media Access Control) address in a local area network. The job of the ARP is essentially to translate 32-bit addresses to 48-bit addresses and vice-versa when using IP Version 4 (IPv4) to communicate on the network.

Most of the computer programs/applications use logical address (IP address) to send/receive messages, however, the actual communication happens over the physical address (MAC address) this happens in the layer 2 of the OSI model. An ARP request is a broadcast, and an ARP response is a Unicast.

Scenarios when ARP is used:

Scenario-1: The sender is a host and wants to send a packet to another host on the same network.

·        Use ARP to find another host’s physical address

Scenario -2: The sender is a host and wants to send a packet to another host on another network.

·        Sender looks at its routing table.

·        Find the IP address of the next-hop (router) for this destination.

·        Use ARP to find the router’s physical address

Scenario -3: the sender is a router and received a datagram destined for a host on another network.

·        Router checks its routing table.

·        Find the IP address of the next router.

·        Use ARP to find the next router’s physical address.

Scenario -4: The sender is a router that has received a datagram destined for a host in the same network.

·        Use ARP to find this host’s physical address.

The situation in the question above falls under scenario-1. From the host IP address and subnet mask, you can tell that both computers are on the same network. Host 172.16.29.155 will need to send an ARP request broadcast for 172.16.29.83 so to get the MAC address and update its ARP table if the host 172.16.29.83 has not already done so.

7 0
3 years ago
Other questions:
  • Why don't we get together to watch the Academy Awards?
    15·2 answers
  • ________ employees state-of-the-art computer software and hardware to help people work better together.
    15·1 answer
  • A. True
    7·1 answer
  • The faster the clock speed, the more of these the processor can execute per second. what are they?
    15·2 answers
  • The DNS server at your headquarters holds a standard primary zone for the abc domain. A branch office connected by a slow WAN li
    14·1 answer
  • If a user wished to insert a triangle or a callout figure in a document, he or she should select the _____ option.
    8·1 answer
  • According the Keown book, which Web-based personal financial planning website is known as "the best free way to manage your mone
    6·1 answer
  • Explain the developments RAM since it was created in 1968 til today.
    7·1 answer
  • Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither.
    5·1 answer
  • Create a paper of at least 1,800 words describing the situation you selected and explaining the logic that would support an arra
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!