Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct ccnl_buf_s has only one byte of data #7

Closed
mehlis opened this issue Sep 1, 2013 · 2 comments
Closed

struct ccnl_buf_s has only one byte of data #7

mehlis opened this issue Sep 1, 2013 · 2 comments

Comments

@mehlis
Copy link
Contributor

mehlis commented Sep 1, 2013

https://github.com/cn-uofbasel/ccn-lite/blob/master/ccnl-core.h#L112

I think this should be like MAX_DATA_LEN not 1

the data field is used for storing the content, right now it uses the memory after this struct. this struct is created via calloc, so we are in the heap.

@tschudin
Copy link
Contributor

tschudin commented Sep 2, 2013

On Mon, 2 Sep 2013, Christian Mehlis wrote:

https://github.com/cn-uofbasel/ccn-lite/blob/master/ccnl-core.h#L112

I think this should be like MAX_DATA_LEN not 1

the data field is used for storing the content, right now it uses the memory after
this struct. this struct is created via calloc, so we are in the heap.

The ccnl_buf_s structure is but a header.

The len of 1 is correct (with 0, which I would have preferred, the
compiler is not happy).

The real length of a buffer is allocated in ccnl-core.c#L35
In fact, we allocate 1 byte too much.

best, christian

@mehlis
Copy link
Contributor Author

mehlis commented Sep 4, 2013

I see, you are right. I don't see a better way to implement this without this dummy array. Perhaps a comment in source code would be nice for the next time someone is confused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants