]> git.evergreen-ils.org Git - OpenSRF.git/commit
Patch that:
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 1 Oct 2007 02:47:44 +0000 (02:47 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 1 Oct 2007 02:47:44 +0000 (02:47 +0000)
commitf5d44299163376415b0a5d837a34f2872d307afe
tree6fbc7e9f760d2dc48906cb22d28fe0c3503845ea
parent0d8e9364d292ca969f95ac93c3cb050bcba262e0
Patch that:

1) Creates safe_calloc, suggested by Scott McKellar which includes
memset, as calloc does.  safe_malloc will eventually lose its call
to memset.

2) Creates a macro in utils.h called osrf_clearbuf which

 * under CLFAGS=-DNDEBUG fills the buffer with !s and a trailing nul
 * otherwise (currently) uses memset to fill with nuls

The secondary behavior should be changed to a no-op after no more
problems arise under NDEBUG mode.  I reversed the suggested semantics
because I'm not ready to completely break trunk.  To break everything
(AKA find where we should be providing a terminal nul) just compile
like this:

 $ CLFAGS=-DNDEBUG make clean all

3) replaces all memsets (excepting the ones in safe_?alloc) that act
on char bufs with said macro, so they can be spotted and improved to
deal with nul terminators where needed.  I didn't touch any memsets on
struct pointers.

4) made jid_get_*() from src/libopensrf/transport_message.c safe for
use with NDEBUG mode.  They were depending on the target buffer that
the caller passes in to be nul-filled (they use strncpy/memcpy which
don't guarantee terminal nul) -- now they provide their own terminal
nul.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1099 9efc2488-bf62-4759-914b-345cdb29e865
include/opensrf/utils.h
src/libopensrf/basic_client.c
src/libopensrf/log.c
src/libopensrf/osrf_legacy_json.c
src/libopensrf/osrf_message.c
src/libopensrf/osrf_prefork.c
src/libopensrf/osrf_transgroup.c
src/libopensrf/socket_bundle.c
src/libopensrf/transport_client.c
src/libopensrf/transport_message.c
src/libopensrf/utils.c