[Linux-ha-dev] Re: [Linux-ha-cvs] Linux-HA CVS: lib by zhenh from
lmb at suse.de
Thu Sep 16 02:31:26 MDT 2004
Alan Robertson <alanr at unix.sh> said:
> >>>IMHO strndup will not work if there is '\0' in middle of binary values
> >However, in this context, we just need get string type data from message.
> >>Right, that very likely should be a ha_malloc() + memcpy.
> Then what you want to do is verify that it's a string, and exit with an
> error if it's not. Simply assuming it's a string isn't sufficient.
If it is not, it'll get truncated to the first \0 or the length of the
field (and add a terminating \0). I've got to admit that this seems
fairly sane, and is about the only option available to recover.
A LOG_WARN may be in order though if the strlen of the new field differs
from the output_len before.
(I guess we are nitpicking quite badly here ;-)
Lars Marowsky-Brée <lmb at suse.de>
High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX AG - A Novell company
More information about the Linux-HA-Dev