[libvirt] [PATCH] storage: Properly terminate secrets

Ján Tomko jtomko at redhat.com
Wed Aug 15 13:33:28 UTC 2018


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 at 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 at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180815/4c7b8a1a/attachment-0001.sig>


More information about the libvir-list mailing list