[Freeipa-devel] Memory issue in INI
Stephen Gallagher
sgallagh at redhat.com
Tue Apr 14 19:07:09 UTC 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dmitri Pal wrote:
> Patch to address the memory issue in INI.
> read_line() was using an internal buffer allocated on stack and returned
> pointers into that buffer - bad!!!
> Now buffer is passed in by the calling function.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Freeipa-devel mailing list
> Freeipa-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/freeipa-devel
Nack
You need to memset to BUFFER_SIZE+1, or a line that is exactly
BUFFER_SIZE long will result in an overrun.
Or, better, omit the memset altogether and use
buf[length] = '\0';
immediately following the status=read_line(...)
This is much faster than writing zeroes across the whole buffer every
time you read a line.
- --
Stephen Gallagher
RHCE 804006346421761
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iEYEARECAAYFAknk3tgACgkQeiVVYja6o6N54gCghlbMVRWupwbnbw/6T9ZUrm4j
x14An0/p+q6dflhhrFhfirsXRlfhWUBh
=dM6n
-----END PGP SIGNATURE-----
More information about the Freeipa-devel
mailing list