Subject: knownhost_writeline buffer length

knownhost_writeline buffer length

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Wed, 24 Feb 2010 17:37:30 +0000

Do we want libssh2_knownhost_writeline to NULL-terminate the line it
writes to the buffer? I know what the code does at the moment (it
NULL-terminates) but I'm asking if that's what we want.

The reason I ask is that the documentation says the value put in the
outlen parameter when the buffer is too small is "the size libssh2
wanted to store, which then is the smallest sufficient buffer it would
require". This isn't true as it doesn't include the NULL. I want to
know which way to fix this bug: stop writing the NULL-terminator to
the buffer or start including it in the outlen count. A third option
is to change the docs to say that outlen returns the count-1 of the
necessary buffer but this seems messy.

Opinions?

Alex
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-02-24