This is an oddball API choice (and there is a bug in the implementation),
in that option_value* is being used as both and input and an output
parameter.
The size you pass in must be be *at least* sizeof(fd_t) bytes, because it
will overwrite the supplied identity string with the resulting file
yes.
using blob_t = std::basic_stringunsigned char;
char buf[8] = { 'f', 'o', 'o', 0, 0, 0, 0, 0 };
blob_t a(foo);
blob_t b(buf, 8);
assert(a == b); // fails
I think there is another issue with all of this. By default (IIRC) the
identity is 5 bytes, so on a 64 bit platform, the passed in
Thomas Rodgers schreef op de 8e dag van de louwmaand van het jaar 2015:
This is an oddball API choice (and there is a bug in the implementation),
in that option_value* is being used as both and input and an output
parameter.
The size you pass in must be be *at least* sizeof(fd_t) bytes,
Sorry to keep flogging this particular horse, but in re-reading the docs
for this option as I'm trying to clean it up...
NB: _option_value_ must be always big enough to hold sizeof(fd_t) bytes
no matter how small the identity length is.
There are few issues here -
Prior to commit 45c681