[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fwd: Possible bug in the memory chunk management.]
From: |
Wolfram Gloger |
Subject: |
Re: [Fwd: Possible bug in the memory chunk management.] |
Date: |
17 Feb 2002 22:59:35 -0000 |
Hello,
> You are right, we did made a mistake but nevertheless you missed
> the point, Hence even if we will make buf_h = calloc(1, 7);
> the problem is with the second loop who overwrite the buffer.
No way, note that buf_h is a pointer to _pointers_ (or array of
_pointers_), hence you need to make at least
char **buf_h;
buf_h = calloc(7, sizeof(char*));
or
buf_h = calloc(1, 7*sizeof(char*))
if you want to later access buf_h[6].
> Please take a second look at the source (change buf_h = calloc(1, 6) to
> buf_h = calloc(1, 7); ) and still the output will be buf_h[4] = 1
> This been tested on slackware linux 8.0.
I haven't checked your source further.
Regards,
Wolfram.