[PATCH 3/5] Add a ckpt_read_string() function to allow reading of a variable-length (but length-capped) string from the checkpoint stream.
danms at us.ibm.com
Thu Jul 23 09:58:29 PDT 2009
OL> You can avoid the memcpy() if you first read only the header, allocate
OL> the string, and then read data into it.
I've changed it to a _ckpt_read_obj_type(.., NULL, ..) and a
ckpt_kread() to avoid the memcpy().
OL> On top of this you can have ckpt_read_string() that will verify that
OL> the buffer is of non-zero length and null terminated ?
What I had ensured a null-terminated string (kzalloc() and len+1).
Is this really the appropriate place to ensure that the string is
non-zero length? Maybe not in the realm of paths and socket names,
but I can see other places where writing a zero-length string might be
IBM Linux Technology Center
email: danms at us.ibm.com
More information about the Containers