[PATCH 15/16] virNetLibsshAuthenticatePrivkeyCb: Use virStrcpy instead of virStrncpy

Peter Krempa posted 16 patches 4 years, 11 months ago
[PATCH 15/16] virNetLibsshAuthenticatePrivkeyCb: Use virStrcpy instead of virStrncpy
Posted by Peter Krempa 4 years, 11 months ago
We already assume that 'retr_passphrase.result' is a string, thus we can
use virStrcpy instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/rpc/virnetlibsshsession.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c
index 0fc1f66706..2dc8cc8911 100644
--- a/src/rpc/virnetlibsshsession.c
+++ b/src/rpc/virnetlibsshsession.c
@@ -437,8 +437,7 @@ virNetLibsshAuthenticatePrivkeyCb(const char *prompt,
         return -1;
     }

-    p = virStrncpy(buf, retr_passphrase.result,
-                   retr_passphrase.resultlen, len);
+    p = virStrcpy(buf, retr_passphrase.result, len);
     virSecureEraseString(retr_passphrase.result);
     g_free(retr_passphrase.result);
     if (p < 0) {
-- 
2.29.2

Re: [PATCH 15/16] virNetLibsshAuthenticatePrivkeyCb: Use virStrcpy instead of virStrncpy
Posted by Ján Tomko 4 years, 11 months ago
On a Tuesday in 2021, Peter Krempa wrote:
>We already assume that 'retr_passphrase.result' is a string, thus we can
>use virStrcpy instead.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/rpc/virnetlibsshsession.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>

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

Jano