[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] storage: Properly terminate secrets



On Mon, Aug 13, 2018 at 10:44:20AM +0200, Michal Privoznik wrote:
The virSecretGetSecretString() helper looks up a secret for given
pool and returns its value in @secret_value and its length in
@secret_value_size. However, the trailing '\0' is not included in
either of the variables. This is because usually the value of the
secret is passed to some encoder (usually base64 encoder) where
the trailing zero must not be accounted for.

However, in two places we actually want the string as we don't
process is any further.

s/is/it/


Signed-off-by: Michal Privoznik <mprivozn redhat com>
---

I wonder if putting this realloc into virSecretGetSecretString() would
be a better fix or not. I mean, without changing @secret_size. Opinions?


Relying on returning a null-terminated string from a function that also
returns its size would look odd to me.

src/storage/storage_backend_iscsi.c        | 5 +++++
src/storage/storage_backend_iscsi_direct.c | 5 +++++
2 files changed, 10 insertions(+)


Reviewed-by: Ján Tomko <jtomko redhat com>

Jano

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]