Re: [PATCH] alloc_ref(): allow for trailing NUL
- From
Daniel Barkalow <barkalow@iabervon.org>
- Date
- Sep 28, 2007, 05:03 UTC
- Message-ID
- <Pine.LNX.4.64.0709280046241.5926@iabervon.org>
- In-Reply-To
- <Pine.LNX.4.64.0709280356550.28395@racer.site>
On Fri, 28 Sep 2007, Johannes Schindelin wrote:
Show 8 quoted lines
> The parameter name "namelen" suggests that you pass the equivalent of > strlen() to the function alloc_ref(). However, this function did not > allocate enough space to put a NUL after the name. > > Since struct ref does not have any member to describe the length of the > string, this just does not make sense. > > So make space for the NUL.
Good point, but shouldn't you then fix call sites that use strlen(name) + 1?
-Daniel *This .sig left intentionally blank*