[Libguestfs] [nbdkit PATCH 2/8] server: Don't leave uninit variable on failure

Eric Blake eblake at redhat.com
Wed Jul 31 21:31:30 UTC 2019


It is not good to leak uninitialized variables back to the user on
failure paths.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 server/utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server/utils.c b/server/utils.c
index 57910f07..5a2d471a 100644
--- a/server/utils.c
+++ b/server/utils.c
@@ -201,6 +201,8 @@ nbdkit_read_password (const char *value, char **password)
   size_t n;
   FILE *fp;

+  *password = NULL;
+
   /* Read from stdin. */
   if (strcmp (value, "-") == 0) {
     printf ("password: ");
-- 
2.20.1




More information about the Libguestfs mailing list