Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Im trying to get rid of the buffer overflow but my output when I input 1234 it says segmentation fault(core dumped) how can I fix

image text in transcribed

Im trying to get rid of the buffer overflow but my output when I input "1234" it says "segmentation fault(core dumped)" how can I fix this?

37 1 #include 2 int main(int argc, char **argv) 4 char buf1[8]; // buffer for eight characters string 1 5 char buf2[8]; // buffer for eight characters string 2 6 fgets(bufi,8, stdin); // read from stdio 7 fgets(buf2,8, stdin); //read from stdio 8 sprintf("You entered: %s And also: %s ", bufi, buf2); // print out data stored in buf 9 return 0; // O as return value

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

How flying airoplane?

Answered: 1 week ago

Question

9. Mohawk Industries Inc.

Answered: 1 week ago

Question

8. Satyam Computer Services Limited

Answered: 1 week ago