bytestring: Allow bytestring_from_string to be called on NULL
authorDavid Gibson <david@gibson.dropbear.id.au>
Mon, 8 Oct 2012 08:05:48 +0000 (19:05 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 8 Oct 2012 10:44:00 +0000 (21:44 +1100)
commit89f4cfdd19a1ad7fa17bd1149ddd49874f7dd115
tree3c3863fc2d38aa2c0ac675d67d4b1895870978f3
parent850364146a1cc66a92943f43dc4012d9c70902eb
bytestring: Allow bytestring_from_string to be called on NULL

Currently, calling bytestring_from_string(NULL) will result in a SEGV
within strlen().  This patch makes this construct safe, returning
bytestring_NULL, which seems a less surprising result.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ccan/bytestring/bytestring.h
ccan/bytestring/test/run.c