[PATCH 01/16] util: virstring: Always copy string in virStrcpy
Ján Tomko
jtomko at redhat.com
Thu Mar 4 18:18:38 UTC 2021
On a Tuesday in 2021, Peter Krempa wrote:
>15 out of 72 invocations of virStrcpy(Static)
That's almost 21%
>ignore the return value as
>it's either impossible to fail or in certain cases a truncated copy is
>still good enough.Unfortunately virStrcpy doesn't copy anything in
>such case as the checks are done first.
>
>Fix this by using g_strlcpy for the implementation and removing
>G_GNUC_WARN_UNUSED_RESULT from the function so that callers can decide
>when it's okay.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/util/virstring.c | 12 +++++++-----
> src/util/virstring.h | 3 +--
> 2 files changed, 8 insertions(+), 7 deletions(-)
>
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: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210304/bddeb647/attachment-0001.sig>
More information about the libvir-list
mailing list