Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8662931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:51:21+00:00 2026-06-12T16:51:21+00:00

I have an buffer of size 101 char buffer[101] I am trying to copy

  • 0

I have an buffer of size 101

 char buffer[101]

I am trying to copy an address to the array

 int i;
 for(i=0;i<sizeof(buffer);i+=4)
     *(long*)&buffer[i] = address

in which address is of type long.

However I met with a stack smashing detection when I am running it. Any idea why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:51:22+00:00Added an answer on June 12, 2026 at 4:51 pm

    Alignment issues aside,

     for(i=0;i<sizeof(buffer);i+=4)
         *(long*)&buffer[i] = address
    

    when i == 100 you write past the allocated buffer. You should stop when i > sizeof buffer - 4.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following in C++: char buffer[SIZE]; char * ptr = &buffer[SIZE];
I understand that certain data type object have certain buffer size. E.g. a char
Suppose I have the following: std::string TestFragmentation() { std::vector<char> buffer(500); SomeCApiFunction( &buffer[0], buffer.size() );
i have a char buffer[100] and i'm trying to use gdb to read the
So far, I have this code sample: ... int nbytes =0; vector<unsigned char> buffer;
I want to make a FIR filter. I have an array of coefficients (buffer[size])
Say you have a buffer of size N which must be set to definite
I'm trying to make fdisk program in Linux. I have a buffer which contains
I have some buffer and known size #define BUFFER_SIZE 1024*1024 char buffer[BUFFER_SIZE]; I must
I have a fixed size circular buffer (implemented as an array): upon initialization, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.