Commit Graph

2 Commits

Author SHA1 Message Date
Andrea Bolognani
85390e6bf9 tests: Fix flake8 errors in virsh-auth
Specifically

  E111 indentation is not a multiple of four

This commit is better viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-03-22 12:05:18 +01:00
Daniel P. Berrangé
415e022118 src: fix mixup of stack and heap allocated data in auth callback
In the following recent change:

  commit db72866310
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Tue Jan 14 10:40:52 2020 +0000

    util: add API for reading password from the console

the fact that "bufptr" pointer may point to either heap or stack
allocated data was overlooked. As a result, when the strdup was
removed, we ended up returning a pointer to the local stack to
the caller. When the caller referenced this stack pointer they
got out garbage which fairly quickly resulted in a crash.

We need to copy the stack buffer into heap memory in the username
case.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-03-06 17:02:10 +00:00